AccountManager does not add custom account in Android N preview - android

I have implemented a sync adapter in my app which requires an account to be added in the device account settings. I followed the same approach given in the Android docs. It works fine till Marshmallow and I can see my account listed in the device accounts. But in Android N preview, account does not add to the device accounts. AccountManager's addAccountExplicitly() method always returns false. Has anyone faced this problem?

Not sure if this is the same issue, but there's an issue with AccountManager on the current version of the Android N image. Basically, if you:
Add an account to AccountManager
Uninstall the app
Reinstall the app
Try to add account again
This will fail and you'll see the following in the log:
W/AccountManagerService( 1503): insertAccountIntoDatabase: Account {name=foo#bar.com, type=com.foo.bar}, skipping since the account already exists
This is a known issue and it's been reported to Google:
https://code.google.com/p/android/issues/detail?id=210992
https://code.google.com/p/android/issues/detail?id=210951

I have totally the same issue.
I could fix it by manually going to the application settings and enabling Сontacts permission. I don't know how, but after that I was able to use addAccountExplicitly() method without issues. I even disabled that permission again and cleared app data but it still was working properly...
After app was reinstalled - problem appeared again.

Has this been fixed now in the latest Android N release.

Related

Notifications.requestPermissionsAsync() not show prompt to user - react native

i am facing problem related to requestPermissionAsync this method does not show prompt to the user. Any help would be highly appreciated
Android Version: 12
Expo SDK: 47
Can you put the code where you have invoked the method 'requestPermissionsAsync()'
Make sure that you did not use the method before that,If the user has
already granted permissions for notifications, the prompt will not be
shown again. You can check the current status of the permissions by
using the getPermissionsAsync() method and see if the status is
"granted"
Make sure you are using the latest version of the expo-notifications library. There could be compatibility issues with the current version of your expo sdk.
It is also possible that the problem is related to the Android version 12, as there have been some reports of issues with notifications on this version. If this is the case, you can try testing on a different version of Android to see if the issue persists.
Another solution is to check if the code is running on an emulator or real device, sometimes the permission prompt doesn't work well on emulators.
-You could also try to check the logs of your app and see if there are any error messages related to notifications.
If you are still facing problem, please provide more details about your problem, the error logs and the code you are using.

Trying to use Google Firebase Authentication with Android Studio

We're using Firebases authentication for logging in and registering accounts. For some reason, one person on the team (member 1) is able to use it properly but when myself or another team member (member 3) tries to test it by creating an account or logging in we get the error
com.google.firebase.auth.FirebaseAuthException: The given sign-in
provider is disabled for this Firebase project. Enable it in the
Firebase console, under the sign-in method tab of the Auth section.
We have tried everything we can think of to fix this error. Email/password sign-in is enabled in the firebase project. We've tried completely copying the files on his machine to ours and it still won't work. What's even odder is that it works fine on member 3's laptop, but not his desktop. I've also had member 1 send me a build from his machine onto my phone and it will work then. I tried completely reinstalling Android Studio as well. I'm not even sure what files to show because I can't imagine it's a problem with the code, since it works perfectly fine for member 1 and member 3 on his laptop. If there's any file you need to see I'll be glad to add it.
That might actually be working in the third members laptop because he would have linked the firebase with your project and put the SHA-1 of his laptop, If you want that to work with yours as well then you need to go to firebase console and add SHA-1 to the console to have it work. try this.
And if it helps please do accept i, if I didnt help let me know and il check more for you.

AccountManager fails to add account on Sony XZ 7.1.1

The app I'm currently developing has recently been showing problems when users update to 7.1.1 om Sony mobiles
On a Sony XZ we can see this in the log when trying to addAccountExplicitly:
AccountManagerService( 1503): insertAccountIntoDatabase: Account {name=something#something.com, type=com.myapplication.go}, skipping since the account already exists
The application was installed and the account was added by our app prior to upgrade. It seems as if the account has not been completely removed/readded.
How can we in our app recover from this?
Why is this happening?
I have read of similar problems in Nougat preview but we can not recover from it with removeAccountExplicitly and then add it again as suggested in link below. The result is the same as above and uninstallation of the app does not clear the account and neither does a phone restart.
AccountManager does not add custom account in Android N preview
We found a possible cause and solution for the problem.
Symptoms
TL;DR It's Sony's fault.
From our user base, it looked like only Sony XZ users who used our app prior to upgrading their device to 7.1.1.
We went as far as buying several Sony XZ devices (and eventually returning them back to the shop), upgrading them from Android 6.0 to 7.1.1 and trying to reproduce the issue. But with no luck.
However, we found another way to achieve the same "symptoms" using the Android emulator. The steps are:
Launch emulator
Login into your app (so that user is added to AccountManager)
Go to the terminal, and do the following
Steps:
adb shell
su
cd /data/system_de/0/
rm accounts_de.db
Restart your emulator
From now on your issue is reproducible.
Moreover, if you'll check /data/system_ce/0/accounts_ce.db you will see that this is a database which still contains your previous user. That is most likely why AccountManager does not allow you to insert same user again.
It looks like that during update to Android 7.1.1, Sony somehow corrupted accounts_de.db which contained the original account.
Solution
Since account with the same name is already in the database (and you can't really remove it from there), we basically can't insert user with the same username again. However, we can insert account with slightly updated username:
if (!accountManager.addAccountExplicitly(account, password, bundle)) {
// We failed to add the account. Fallback to workaround.
accountManager.addAccountExplicitly(
new Account(username + "\n", accountType), // this line solves the issue
password,
bundle
);
}
Since this account is now different from original account (thanks to \n character), it can be inserted into AccountManager database.
The issue is known by Google: https://issuetracker.google.com/issues/142699760

Facebook SDK 5.0.4 for Unity, Android, Login Fails, Correct Hash Key

I think I have the same problem as in this post.
I am using Unity4.3.0f4 and Facebook SDK 5.0.4 beta.
I use the correct key hash (not the debug one) which I obtained by FB.Android.KeyHash. On my own device, as well as on BlueStacks emulator, I manage to log in and FB.Feed normally. However, other users that have tested the app cannot login. FB.Login("publish_actions", callback) is called, the permission dialog is shown, the user taps OK and then returns to game. Result.text is then
{"is_logged_in":false, "user_id":"", "access_token":"", "access_token_expires_at":"01/01/0001 00:00:00"}
Any idea?
ps. On my phone i have an earlier version of the Facebook app, not the last one.
ps2. You can download my app and take part in the beta testing to see the problem yourself.
Ok, after all the problem was that I was trying to log in while immediately requesting the publish_actions permission, which by the way is NOT needed for FB.Feed().
FB.Login ("publish_actions", AuthCallback); // WRONG!!!!!!
Finally I used
FB.Login ("", AuthCallback); // Ok
and it works properly at last.
Make sure your test users can see the app.
My guess in your app is sandboxed and your test users are not listed on Developer Dashboard.
Either un-sandbox it, or add them as Testers(its in Roles tab)

Unauthorize and App from AccountManager Credential Access

I have an app that I'm developing that uses AccountManager to get credentials for a Google account that is subsequently used for getting a cookie from AppEngine. I've noticed that I find bugs when I send the app to testers because they get prompted to authorize the account. I need to do a bunch of testing and am looking for a way to "unauthorize" an app from a particular credential so I can do my testing on the next install. I can't find anything in settings where I can remove the authorization to an account from an app. Do you know of a way to do this?
Thank you,
Stateful
It is true that uninstalling is most of the time not enough. You need to uninstall and restart the phone right afterwards. At least this works for me
At least as of 2.3, there is no API for this. IIRC, if you install the application, the authorization entry will be removed from the database, so a re-install should work.
You can try to remove from this page:
https://accounts.google.com/b/0/IssuedAuthSubTokens?hl=it

Categories

Resources