Login through Twitter and Google Plus in Appcelerator Studio - twitter

It been two days I'm working with twitter and google plus Signup/Signin but unfortunately unable to hit it.
For twitter, I tried Aaron K Saunders's test app https://github.com/aaronksaunders/test_social. It says "You've granted access to your app. Next, return to your app and enter this PIN (XXXXXXX) to complete authentication process". What really is that??? I'm confused in it.
For google plus, I tried Google Auth for Titanium test app https://github.com/ejci/Google-Auth-for-Titanium. But it shows simple white screen.
I'm stuck into both of these. Can anyone please help. I'd be grateful.
Thanks a lot!!

I believe you posted this issue on Test Social's GitHub page? Here's what I had to do to get Twitter working on Android - Test Social still works as intended on iOS.
"I have the same issue (Android only, iOS still works as before). This is an issue with Android, not this module. Here is how I go about fixing this on Android.
getHtml on the webView is returning null in Android, but again fine in iOS - Just putting this out there in case anybody runs into this error. Doesn't seem to be a fault of this module.
I modified the authorizeUICallback function inside Test Social:
function authorizeUICallback(e) {
var promptView = Ti.UI.createView({
width:'30%',
height:'10%',
layout: "vertical",
backgroundColor:'black',
bottom:"20%"
}),
pinField = Ti.UI.createTextField({
width: Ti.UI.FILL,
height: Ti.UI.SIZE,
hintText: 'Enter PIN'
}),
pinButton = Ti.UI.createButton({
width: Ti.UI.SIZE,
height: Ti.UI.SIZE,
title: "Authorize"
});
promptView.add(pinField);
promptView.add(pinButton);
view.add(promptView);
pinButton.addEventListener('click', function() {
if (!pinField.value) {
alert('No PIN found');
} else {
pin = pinField.value;
response = 1;
response ? ( pin = pinField.value, /*pin = response.split("<code>")[1].split("</code>")[0]*/ destroyAuthorizeUI(), receivePinCallback()) : (loadingView && loadingView.hide(), loadingContainer && loadingContainer.hide(), webView && webView.show()), loading = !1, clearInterval(intervalID), estimates[estimateID] = (new Date).getTime() - startTime, Ti.App.Properties.setString("Social-LoadingEstimates", JSON.stringify(estimates));
}
});
}
There was another issue created on the GitHub page and they haven't found a solution either. This seems to be the only way to get Twitter to work with Test Social (or the ONLY way I've found to get it to work with Appcelerator at all).
I can't help you with Google+ just yet. I'm looking to implement that later, but it's not super high on my priority list with their recent changes... Who knows how much longer people will be using it, but I digress... Are you getting any kind of error in the console when you get a 'white screen'?

Related

Flutter: Safari cannot open the page because the address in invalid

I am trying to do something super simple just launch the android or apple play store from my app so a user can go rate the app from my settings but I get this error when testing in my iOS simulator:
Safari cannot open the page because the address in invalid
onTap: () {
if (Platform.isAndroid || Platform.isIOS) {
final url = Uri.parse(
Platform.isAndroid
? "https://play.google.com/store/apps/details?id=com.dontforgetthespoon.dont_forget_the_spoon"
: "https://apps.apple.com/us/app/dont-forget-the-spoon/id6444052519?platform=iphone",
);
launchUrl(
url,
mode: LaunchMode.externalApplication,
);
}
}
I feel like this should be super simple. Any ideas on what may be going wrong for me? Thanks!
The easyiest way is to use launch_review flutter package.
LaunchReview.launch(androidAppId: "com.example.app",
iOSAppId: "511431312");

Facebook share counter not working on iOS

I have facebook share counter on my website and it works correct,but on iOS Safari it doesn't show show number of shares. If I'm using incognito mode (private), it works correctly... Any suggestions?
$.getJSON( 'http://graph.facebook.com/?id=http://example.com', function( fbdata ) {
$('#fb-count').text(fbdata.share.share_count)
});
Even if I'll use simple alert() inside function it won't appear...
Ok, found a solution using PHP.
$fb = json_decode( file_get_contents('https://graph.facebook.com/http://example.com') );
$shares = $fb->share->share_count;

Changing CurrentAccessToken in Facebook Unity SDK

I'm trying to post to a Facebook page AS the page using the Unity Facebook SDK running on iOS. As I understand, to do that, I need the pages access token with manage_pages and publish_pages. I know that I can get it from /me/accounts?fields=access_token, but how do I tell AccessToken.CurrentAccessToken to use my pages access token instead?
Right now i'm using the following:
var wwwForm = new WWWForm();
//wwwForm.AddField ("access_token", "A-T I NEED");
wwwForm.AddBinaryData("image", screenshot, "InteractiveConsole.png");
wwwForm.AddField("message", "herp derp. I did a thing! Did I do this right?");
FB.API("/PAGE-ID/photos", HttpMethod.POST, HandleResult, wwwForm);
I tried putting the access token manually, but that didn't work (so I commented it out).
With this as it is I'm getting an error, telling me that I need publish_actions, wich is not correct since I'm not trying to post as the user. If I also get publish_actions the Post goes online, but is posted to the page as the user speaking. (User is also Admin)
Any Ideas ? Thanks!
So, I filed a bug report to facebook and as it turns out: "… at this time this functionality is not supported." Wich simply means there is now way to use the Page Access Token you acquired via the FB.API within the FB.API. And they are not going to tell you abot it in the documentation.
As a workaround I simply use a UnityWebRequest like this:
IEnumerator UploadToPage(byte[] screenshot) {
var wwwForm = new WWWForm();
wwwForm.AddField("message", "herp derp. I did a thing! Did I do this right?");
wwwForm.AddBinaryData("image", screenshot, "Test.png");
string url = "https" + "://graph.facebook.com/"+ PageID + "/photos";
url += "?access_token=" + PageAccessToken;
using (UnityWebRequest www = UnityWebRequest.Post(url, wwwForm))
{
yield return www.Send();
if (www.isError)
{
Debug.Log(www.error);
}
else
{
Debug.Log("Form upload complete!");
}
}
Debug.Log(url);
}

ie9 not supporting geolocation?

Greetings Everyone,
I am creating a web application that uses the Geolocation API to locate the end user. It works great on almost every platform I can think of except for Internet Explorer 9. Things get a little stranger though. If I have my Google Toolbar loaded into my Internet Explorer browser window, everything sails smoothly. Here is the offending chunk of code that I have been working with:
if (navigator.geolocation) {
var locationMarker = null;
navigator.geolocation.watchPosition(
function( position ){
var point = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
if (!locationMarker) {
locationMarker = addMarker(
position.coords.latitude,
position.coords.longitude,
"Initial Position"
);
}
else{
updateMarker(
locationMarker,
position.coords.latitude,
position.coords.longitude,
"Updated / Accurate Position"
);
};
map.setCenter(point);
if (map.zoom < 17){
map.setZoom(17);
};
},
function( error ){
console.log( "Something went wrong: ", error );
},
{
timeout: (5 * 1000),
maximumAge: (1000 * 60 * 15),
enableHighAccuracy: true
}
);
}
else {
alert("Geolocation is not supported by this browser");
}
Whenever I access my application with Internet Explorer 9 I get the "Geolocation is not supported by this browser" alert. That is unless I have my Google Toolbar active. If the Google Toolbar is active however, then the Google Toolbar handles the permissions.
How do I get geolocation to work in IE9? My application works flawlessly in Safari, Firefox, Chrome, iOS and Android. I am totally stumped.
Thanks, Tyler Waring
user1303379,
IE9 and IE10 both support geolocation, however earlier versions of IE do not support it ( reference http://caniuse.com/#feat=geolocation ). Here is a blog post by IE about geolocation in IE9 http://blogs.msdn.com/b/ie/archive/2011/02/17/w3c-geolocation-api-in-ie9.aspx and here is a test page using navigator.geolocation.watchPosition like you are above.
For browsers that don't support geolocation you may consider using one of the geolocation polyfills listed here https://github.com/Modernizr/Modernizr/wiki/HTML5-Cross-Browser-Polyfills
IE9 & IE10 ask the user if they would like to share their location http://cl.ly/image/0X0o2F0s1N03 My guess is that you may have denied access to your location at some point.
The Google Toolbar added a feature to determine geolocation back in the IE8 days http://googletoolbarhelp.blogspot.com/2010/02/google-toolbar-6413211732-for-ie.html From what you describe it sounds like the Google Toolbar started to provide geolocation since the native IE9 geolocation was denied access.

Facebook Private Message in Titanium

I am trying to send Facebook Private in my Titanium Application.I have tried in following two ways but i didn't get any success.
Method 1:
var data = {
link: "https://developer.mozilla.org/en/JavaScript",
name: "Best online Javascript reference",
message: "Use Mozilla's online Javascript reference",
test: [ {foo:'Encoding test', bar:'Durp durp'}, 'test' ]
};
var friendFbId = "xxx"
var path = friendFbId+"/feed"
Titanium.Facebook.requestWithGraphPath(path, 'POST', data, showRequestResult);
It is works fine but it is posted in my friend's timeline. But I need a private message(should be visible to my friend only).
Method 2:
var data1 = {
link: "https://developer.mozilla.org/en/JavaScript",
name: "Best online Javascript reference"
};
Titanium.Facebook.dialog("send", data1, showRequestResult);
I am getting folowing error
error_code=3&error_msg=This+method+is+not+supported+for+this+display+type
Any one help me to solve this issue. I am using Titanium 1.7.5 and ios. Thanks in Advance
According to Facebook the send dialog is currently not supported on mobile devices:
https://developers.facebook.com/docs/reference/dialogs/send/
The API doesn't allow for private messages, the closest you'll get would be to use the send dialog.
http://developers.facebook.com/blog/post/514/
https://developers.facebook.com/docs/reference/dialogs/send/
I'd suggest playing around with the different display parameter settings to see if one of them might work
http://developers.facebook.com/docs/reference/dialogs/#display
page
popup
iframe
touch
wap

Resources