Android 2.0+ account duplication - android

I know that you can setup accounts in Android 2.0+ and thats great but as i have recently found out, it can create duplication.
My phone(Sprint HTC hero 2.1-upadate1) comes with HTC Sense and thats great, it also has Peep pre-installed and it asked me when i setup the phone to add a twitter account, and so i did. I can now open peep and it all works, perfect.
But I decided i wanted to try the Twitter for Android app. I installed it and it also asked me to create a twitter account, not good. I did create the new account and the app worked just like it was supposed to.
Then when i go into my accounts i can see that i have two twitter accounts(the same one). Is this something that can be avoided in the programming or is this something that can be fixed with the os?
I also noticed the same for the facebook account. Is there something in the SDK that can prevent this...or combine the accounts after the fact? or is this all completely up to the developers.
If its up to the developers then i would really like to see some code/documentation so i can avoid such things.

Accounts on Android have a notion of account 'types'; see AccountManager for details. For example, Google Accounts are of the type com.google. Peep and the Twitter for Android apps may be using different account types, and may not be using compatible authentication tokens (also see AccountManager and AbstractAccountAuthenticator). More on accounts and authenticators can be found in the SampleSyncAdapter SDK sample code.
The 'right' thing to do in my opinion is for developers to standardize on and document account types for services they're consuming, provide account authenticators for those account types, and then authenticate to said services using tokens obtained via AccountManager. There are also many opportunities to integrate deeper with contacts, sync, etc.

Related

Android Dev. - I'm designing an app that will require sign-ups with a college email, but all i find are things for Google+. Any suggestions?

Like how I tried to effectively word in the title, my issue with Sign-ups and log-ins for my application is that it would work best with a college email, as it's an app designed for college campuses, but I can only find APIs and information regarding the Google+ sign-up that is everywhere.
For instance, an app like Kik does not require a Google+ sign-in and you can make your account however you like, but I've not found any information on how to go about creating a sign-in like that. The only substantial information regarding sign-ups/log-ins I've found are for the Google+ API.
The only other thing i thought of was using the Google+ sign-in to verify the person, and then having something in the settings to enter and save the college email for the uses it'll have.
Would any of you have thoughts on this? I'd prefer not to do the latter simply because it requires more for set-up of the app on the users part (which isn't ideal) to use it's full functionality, but I don't really see any other way of doing it at this point.

In-app purchases with multiple accounts

I am facing a problem with in app purchases/subscriptions:
If there are multiple accounts on the device, I can't get the purchases, which were made with the second account.
This can sometimes be temporarily fixed, by installing the app from the Google Play web interface, but after a while, the purchases won't appear in the query, forcing the user to reinstall.
I am using the IabHelper classes from this sample.
Doing some Google searches, I found that this bug exists since a while, but unfortunately I couldn't find out if the error is in the IabHelper classes or on Google's side.
I'd like to draw attention to Google, so they provide a proper fix for this, either in the IabHelper classes or in the Play Services or to provide information, how this should be handled.
I am using the code in an app with (at the time of writing) 900.000 active user installs and I have to trigger quite a lot of refunds, due to this.
If there is a fix for this, which I missed, please let me know.
Edit:
Sometimes it's not possible at all to retrieve the purchases, even if there is only one account on the phone.
It seems like there isn't a one way road to solve this, but let's try do this.
When the user first install the app get his/her primary email or all accounts on the device
Ask the user what email will they be using for future payment/ or which account is active for google play.
you can use this code to get the account
Pattern emailPattern = Patterns.EMAIL_ADDRESS; // API level 8+
Account[] accounts = AccountManager.get(context).getAccounts();
for (Account account : accounts) {
if (emailPattern.matcher(account.name).matches()) {
String possibleEmail = account.name;
...
}
}
Don't forget to ask for permission
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
After the user selects the email, you can send a link via email to confirm this email address
Lead all the payment to that specific email.
Method 2
Use the new "Send & Receive money using Gmail" future
Create a email intent and send specific data to the email intent and make payments.
Upon success, send a code to the user email
Use the code to activate whatever purchased they make.
Method 3
Use another payment library or gateway for your in app purchase instead of Google play.
As others have noted, this is a bug with the Google Play Billing Library. If it affects you, star this issue on https://issuetracker.google.com/issues/139597485 so Google can notice it (really?) and start working on a fix.
It is sure a bug in the in-app billing service apis. This is a similar question and as mentioned in one of the answers, may be you need to introduce login mechanism and store the purchases made from an account to your server or locally on the device in an encrypted file or something similar.
I had ran into same problem couple of months later.
After hours of finding solutions and all i came up with a work around something like this,
You can use OAuth 2.0.
But you also have to manage it from your backend.
I am not a backend developer so i didnt know how exactly it does in backend but at app side i have done something like this,
You can use the first Google account allowing authentication on your serve side. OAuth 2.0 is a tool that simplifies and get developers an easy way to allow users to access your application. The OAuthHmacSigner class does manages the authentication.
signer = new OAuthHmacSigner();
signer.clientSharedSecret = Constants.CONSUMER_SECRET;
Then the Android activity uses the following code to launch the OAuth flow :
launchOauth.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
startActivity(new Intent().setClass(v.getContext(),
PrepareRequestTokenActivity.class));
}
});
In order to get an OAuth 2.0 access token, you simply need to call:
AccountManager.getAuthToken()
I Hope this might help :)
I have two accounts, but one does not work. What I did is I went into android's settings, and then went into account preferences. I changed my main account from the one that does not work to the working one. Then I assigned the new account to be the main one for all of my applications, including google play. That worked for me. Sometimes, if it does not work for some reason, you can also go online and access the Google Play store from the internet.
Try to get dup...duplicate dot with file signature ending in .apk or .xcode
I'm not sure if this is the answer you're searching for, but perhaps setting up a shared Google Play Family Library would suffice. It works for up to 5 users sharing the same purchases (app, music, movies, etc), if desired.
(See: https://support.google.com/googleplay/answer/7007852?hl=en)

Where is AccountManager in Amazon Kindle HDX?

I have implemented the AccountManager workflow to add accounts to my service in the standard Android settings screen.
In typical Android devices, I successfully get my App's icon, settings, login workflow, etc. in the "Accounts" section of the settings screen, and I am able to add accounts.
However, in an Amazon Kindle HDX, even though the API exists, and in my App details I can see the permissions are identified (android.permission.AUTHENTICATE_ACCOUNTS, ...), I can't find the AccountManager anywhere in the settings screen. Everything seems related to Amazon authentication. The closest thing is "Social Network Accounts" under "My Account", but only displays Facebook and Twitter, and seems a proprietary account manager rather than Android's.
Does anybody know if
The standard Account list exists in Kindle HDX?
The AccountManager API is the way to go? or shall I write a custom account dialog in case the App is running on a Kindle?
Regarding the second question, Amazon claims the API is supported https://forums.developer.amazon.com/forums/thread.jspa?threadID=906 but if accounts can't be listed or managed, I suppose it's better to use a proprietary approach. Am I wrong?

Enterprise Mobile SSO On Android

I have around three to four enterprise mobile applications targeted for employees of an organization. We would like to implement something like SSO, where you login with any of the applications, the other applications need not login. Also when you logout in any of the application the same has to be reflected in other applications as well.
I tried googling on this, I'm sure on which is the best approach for implementing the same.
Content Provider:
Using content provider, we have to make one of the applications as master which gives us the data needed to other applications. But here raises a query on what will happen if the master application is uninstalled?
Shared Preferences:
I also noted that applications can access other apps Shared Preferences, by defining userid for applications. But again here we use the concept of master which has the same flaw of application getting uninstalled, or what if the no of applications grows.
Isnt there a common repository there all the applications from the same developer can share, and repository will be available till the last application of the developer is uninstalled. Am I missing something here?
I was also looking for SDKs which does the SSO for mobile apps like Layer7 . Has anyone worked on any such SDKs? Any suggestions?
Thanks.
Another option would be to go with Centrify SDK solution for ios and Android - http://developers.centrify.com, which provides authentication & SSO via its Centrify application on the device similar to "FB login" style. You install Centrify application from any of the app stores (Google Play or Apple Appstore), and then use Centrify SDKs to integrate your apps for authentication via Centrify app. With this solution, you can claim Active Directory support into your enterprise application and add-on bonus is SSO for all of them.
Centrify App, Centrify SDKs are FREE.
Disclaimer: I work for Centrify.

Android sync adapter with appengine Google user accounts

I am implementing a sync adapter for my app to sync with an appengine backend. On appengine I am using the built in User api for authentication. There is a post HERE that tells how to do it, however the app is listed under the gmail account. Ideally my app would be listed in the accounts. I don't want to ask the user for username and password, just use the existing google account for authentication. Has anyone done this before??
Update:
I've been working on this and it looks like I could implement the AuthenticationService and store the users account name and leave the password as an empty string. In the getAuthToken() methods I should be able to simple return the google auth token. Will post once I get further along...
Perhaps you have misunderstood the Android account system. When you go to Settings -> Accounts & Sync and add a new account what you see then is a list of account types. Often there is a relationship between account types and apps, for example Facebook accounts are used together with Facebook. Normally you would add a new account type if you have a different backend system for handling authentication etc.
If I understand you correctly, you use Google accounts but want it to appear as your own account type. That sounds wrong to me. You'll end up reimplementing the Google account handling, with little value. I believe it is simpler for users if you simply piggyback on what Google provides you with. Your app / service / content provider can be seen when clicking on the account. For example, after installing "Tasks" by "Team Task" (disclaimer: I'm not affiliated with that company) they add "Sync Tasks" to the list of data & sync options.
But if you really want to create your own account type, follow the sample Sample Sync Adapter. Look for the Authenticator code and related resources (e.g., manifest, activity layout, etc.).
This is indeed possible and I have implemented this with success but be warned it is a bit of a headache.
There is an excellent tutorial available called writing-an-android-sync-provider-part-1
... don't forget to check the follow up in part 2
Beyond this there is also an example in the Android SDK samples called SampleSyncAdapter which was invaluable in my development.
With a little hard work and a lot of coffee you should be able to get this working ;)

Categories

Resources