I need help about an issue that I am looking for hours and still not solved.
I am trying to use the linking current user with facebook property of parse server using android. I am also using the singin with facebook property, but have no problems there. However, when I use the linking property with the code below, the facebook enter username password dialog opens. Then I give permission to read the listed data from facebook and click ok. When it turns back to my app, nothing happens and I see the lines below in the log.
As the emulator I use Nexus 6 API 23 Android 6.0 x86
My code is:
System.out.println("I am here 1");
List<String> permissions = Arrays.asList("public_profile", "email", "user_friends");
System.out.println("I am here 2");
if (!ParseFacebookUtils.isLinked(ParseUser.getCurrentUser())) {
System.out.println("I am here 3");
ParseFacebookUtils.linkWithReadPermissionsInBackground(ParseUser.getCurrentUser(), this, permissions, new SaveCallback() {
#Override
public void done(ParseException ex) {
System.out.println("I am here 4");
if (ParseFacebookUtils.isLinked(ParseUser.getCurrentUser())) {
Log.d("MyApp", "Woohoo, user logged in with Facebook!");
}
else {
Log.e("MyLast", "unexpected error of mine", ex);
}
}
});
}
In the log I see:
06-16 10:57:40.049 11878-11878/com.my_last.mylast W/BindingManager: Cannot call determinedVisibility() - never saw a connection for the pid: 11878
06-16 10:57:40.084 11878-11987/com.my_last.mylast E/Surface: getSlotFromBufferLocked: unknown buffer: 0x9cbad8b0
06-16 10:57:40.305 11878-11987/com.my_last.mylast E/Surface: getSlotFromBufferLocked: unknown buffer: 0xb40982e0
In the println lines, I see until "I am here 3". before the log lines above.
Any help would be great, I looked everywhere but could not found any reasons. I use the code inside a fragment, and I also tried using getActivity() rather than this, but same result.
Related
In an app we upload user activity data to Google Fit like this :
Fitness.getSessionsClient(context, GoogleSignIn.getLastSignedInAccount(context))
.insertSession(((SessionInsertRequest) object))
.addOnSuccessListener(new OnSuccessListener<Void>() {
#Override
public void onSuccess(Void aVoid) {
// At this point, the session has been inserted and can be read.
if (BuildConfig.DEBUG) {
Log.i(TAG, "Session insert was successful!");
}
//more success handling
}
})
.addOnFailureListener(new OnFailureListener() {
#Override
public void onFailure(#NonNull Exception e) {
if (BuildConfig.DEBUG) {
Log.w(TAG, "There was a problem inserting the session: " + e.toString()+ "\n"+ e.getLocalizedMessage());
}
//more error handling
}
}
});
This was working fine until approx sep 4 2019.
Then Google seemed to have changed something resulting in the following warning when creating the SessionInsertRequest
App com.foo.bar does not have access to data types in request
and in onFailureListener(...) we get the following message:
There was a problem inserting the session: com.google.android.gms.common.api.ApiException: 5002: DataType's name does not match package name.
DataTypes were not changed. They are requested when the user is asked to give permission to upload :
private FitnessOptions getFitnessSignInOptions(OAuthType type) {
switch (type) {
case Activity:
return FitnessOptions.builder()
.addDataType(DataType.TYPE_LOCATION_SAMPLE, FitnessOptions.ACCESS_WRITE)
.addDataType(DataType.TYPE_CALORIES_EXPENDED, FitnessOptions.ACCESS_WRITE)
.build();
}
}
and created in a DataSource like :
DataSource locationDataSource = new DataSource.Builder()
.setAppPackageName(packageName)
.setDataType(DataType.TYPE_LOCATION_SAMPLE)
.setName(uniqueIdentifier + "-locations")
.setType(DataSource.TYPE_RAW)
.build();
similar as the Google sample shows.
It does not matter if we omit setting the name of the dataSource or using setName(packageName). Also using setStreamName(packageName) instead does not resolve the issue.
Anybody else having this or a similar issue ?
Thank you
Robert
I wonder if the issue is related to the use of GoogleSignIn.getLastSignedInAccount. Apparently in the new version of the library this is not liked. Using GoogleSignIn.getAccountForExtension should do the trick. It worked for my issue with locations
I believe that you may have provided an invalid google-services.json file or at least one that is not compatible with the one used when you acquired permission from the user to use Google Fit.
I had the same issue: when I uploaded the new version of my app on top of the one downloaded from Google Play, it gave this error. It did not happen if instead I installed the new version of the app from scratch.
Regenerating the google-services.json file on Firebase and giving it to the new version of the app solved the issue. Now I can upload the app on top of the existing one and I do not get this error any more.
Note however that before I did not have Firebase enabled so it is possible that Google does not allow any more using google-services.json that is not generated via Firebase
Am trying to build a dynamic url, using Firebase dynamic links but i get a exception.
private void sendNativeInvites(){
String email = UserUtils.getCurrentUser(this).getEmail();
String link = "https://play.google.com/store/apps/details?id=com.mindedges.beephourly?invitedby=" + email;
FirebaseDynamicLinks.getInstance().createDynamicLink()
.setLink(Uri.parse(link))
.setDomainUriPrefix("https://c6yge.app.goo.gl")
.setAndroidParameters(
new DynamicLink.AndroidParameters.Builder("com.example.android")
.setMinimumVersion(125)
.build())
.buildShortDynamicLink()
.addOnSuccessListener(new OnSuccessListener<ShortDynamicLink>() {
#Override
public void onSuccess(ShortDynamicLink shortDynamicLink) {
Log.e(TAG, "Successfully built build dynamic link");
Uri invitationUrl = shortDynamicLink.getShortLink();
doSendInvite(invitationUrl);
}
}).addOnFailureListener(new OnFailureListener() {
#Override
public void onFailure(#NonNull Exception e) {
Log.e(TAG, "failed to build dynamic link", e);
}
});
}
failed to build dynamic link
com.google.android.gms.common.api.ApiException: 400: Request contains an invalid argument.
at com.google.android.gms.common.api.internal.TaskUtil.setResultOrApiException(Unknown Source:12)
at com.google.firebase.dynamiclinks.internal.zzi.zza(Unknown Source:4)
at com.google.firebase.dynamiclinks.internal.zzn.dispatchTransaction(Unknown Source:10)
at com.google.android.gms.internal.firebase_dynamic_links.zzb.onTransact(Unknown Source:12)
at android.os.Binder.execTransact(Binder.java:697)
Am not getting what wrong param am passing. I own the domain "https://c6yge.app.goo.gl" as per firebase console.
I can see a minor error in your code. That have been caused by mistakenly copying some codes from the documentation without editing them.
Here is the lines that has caused your problems:
.setAndroidParameters(
new DynamicLink.AndroidParameters.Builder("com.example.android")
.setMinimumVersion(125)
.build())
Instead of "com.example.android" you were supposed to replace that with your own package name which I think it is "com.mindedges.beephourly". So in the documentation they wrote that just like an example but you were expected to change it to your own package name.
Also in the same code above instead of (125) you are supposed to change that to your own version code. In android there are version codes for Apps and when you update an app you will have to change version code (integer) and version name (String) so you may have a number of App versions but in there you were supposed to pass the minimum the lowest version code that can open that dynamic link. I am forced not to believe you have ever made 125 updates in your app in Playstore. So if you want all your apps old and new version to open you could replace (125) with (1). You can find the current version code in your build.gradle files. In your project.
Let me know if you still face some difficulties.
Can you double check if you got the correct domain? Based on your code, it looks like everything works fine. However, the issue seems to be with your domain.
Checking the link as https://c6yge.app.goo.gl/?link=https://google.com, you should be redirected to https://google.com but it didn't. Instead, it just shows Dynamic Link not Found. So I'm thinking it's not properly configured.
Here's a sample working link: https://ratbu.page.link/?link=https://google.com.
I am trying to integrate Facebook and Twitter in my Android app just to post some text information.
Facebook is almost working, user can log normally, but when I execute
mSocialNetworkManager.getFacebookSocialNetwork().requestPostMessage("Facebook test",
new OnPostingCompleteListener() {
#Override
public void onPostSuccessfully(int i) {
System.out.println("Facebook post success!");
}
#Override
public void onError(int i, String s, String s2, Object o) {
System.out.println("Facebook error: " + s2);
}
});
No onPostSuccessfully nor onError get called. Same thing with the demo app (it shows eternally the waiting dialog). Is it a recent change in Facebook API or something wrong with the lib?
On the other side, Twitter always returns an error when trying to SocialNetwork.REQUEST_LOGIN.
Error:
401:Authentication credentials (https://dev.twitter.com/pages/auth) were missing or incorrect. Ensure that you have set valid consumer key/secret, access token/secret, and the system clock is in sync.
<?xml version="1.0" encoding="UTF-8"?>
<hash>
<error>Desktop applications only support the oauth_callback value 'oob'</error>
<request>/oauth/request_token</request>
</hash>
I think consumer key and secret are correctly set.
mSocialNetworkManager = SocialNetworkManager.Builder.from(getActivity())
.twitter(SocialNetworkConstants.TWITTER_API_KEY, SocialNetworkConstants.TWITTER_API_SECRET)
.facebook().build();
Image from API keys section
Do you know why do I get that error?
Thanks in advance.
v0.3.2 includes fix for Facebook sharing.
As for Twitter,
When you created application, did you enter OAuth callback like 'oob'?
Possibly try to enter some website url as OAuth callback. Another possible issue is that you have invalid time on your phone, please check Settings -> Date & Time and insure that Automatic Date & Time checkbox is checked.
I'm having such a big headache trying to use the Facebook plugin of Phonegap Cordova 2.3.0 on Android
I've installed the last Facebook Android SDK (3.0) and it works fine as I'm able to launch the examples and they work.
But I'm not so lucky with Phonegap because neither the examples are working, the problem is that when calling this:
FB.login(
function(response) {
//NEVER FIRED !!
alert(JSON.stringify(response));
if (response.session) {
alert('logged in');
} else {
alert('not logged in');
}
},
{ scope: "email" }
);
when I click on login button I call the FB.login and a dialog is shown asking permission to read user personal data. When I click "ok" the dialog disappear and nothing else happens.
I tried to debug the plugin (ConnectPlugin.java) and I see it correctly calls the method:
public PluginResult execute(String action, JSONArray args, final String callbackId)
and all parameters seem to have correct values. When the plugin makes the call I get this JSON:
{Session state:CLOSED_LOGIN_FAILED, token:{AccessToken token:ACCESS_TOKEN_REMOVED permissions:[]}, appId:xxxxxxxx}
in the following method:
onSessionStateChange(SessionState state, Exception exception)
I can't understand where is the problem... whet is this code CLOSED_LOGIN_FAILED ?
Well, the solution is so trivial that I am ashamed... I didn't set up the Android section on the Facebook App configuration!
seriously going insane here....
I'm trying to get the phonegap facebook plugin for android to work, but it's really driving me up the wall (no pun intented).
I am using the code from https://github.com/irnc/phonegap-plugin-facebook-connect/tree/oauth-2.0+irnc, at least I think I am.
I appear to have two problems:
the following callback in the login (from pg-plugin-fb-connect) gives an error because "FB.Auth.setAuthResponse(response.authResponse, response.status);" cannot be found. Am I using an incorrect facebook sdk? Apparently no, see edit below
PhoneGap.exec(function (response) {
console.log('PG.FB.login.success: ' + JSON.stringify(response) + ', store into localStorage ...');
localStorage.setItem(key, JSON.stringify(response));
FB.Auth.setAuthResponse(response.authResponse, response.status);
if (cb) {
cb(response);
}
}, null, service, 'login', ['publish_stream', 'read_stream']);
},
When I comment the FB.Auth.setAuthResponse(response.authResponse, response.status); statement, my login returns successfull! I get an authresponse with an accesstoken and status set to connected. When I try to execute the following code (on success callback)
FB.api('/me/feed', 'post', { message: body }, function(response) {
if (!response || response.error) {
console.log(JSON.stringify(response.error, null, 4));
alert('We are very sorry, but somthing went wrong');
} else {
alert('Message was successfully posted to your wall!');
}
});
it gives me an oauthexception message: "An active access token must be used to query information about the current user."
I authenticated with 'read_stream, publish_stream' permissions.
These two are probably related, but I can't find anything about the setAuthReponse call in the facebook api.
EDIT help is apparently not on it's way, but i've continued my quest to get this to work.
The facebook js sdk I got from the github repo's are all using the 'old' auth methods. I've downloaded the new facebook js sdk and FB.Auth.setAuthResponse is there. I copied the code to my existing js sdk and changed all calls to setSession to setAuthRepsonse. Everything is working fine, except that the access token doesn't appear to be posted when I make above FB.api calls. After these changes, the error remains exactly the same!
Oh yeah, I also changed the check in the login callback to check for authResponse instead of session (it's in the example).
Help is more than welcome,
rinze
I think I fixed this. Basically the ConnectPlugin.java is still returning a "session" response object instead of the "authResponse" that the new SDK expects.
See https://github.com/odbol/phonegap-plugin-facebook-connect/commit/0ef84e29603338930ff82fc6d6ef8525b668077d for details.