I am using the Google Calendar apps API in Android. For some users in my organization the field displayName is always null for an Organizer* instance that represents them. To get the organizer and display name I call eventInstance.getOrganizer().getDisplayName().
It's not for all accounts, though. I can't figure out the pattern here. Does something need to be set in their Google account? Why would the display name not be available, anyway?
P.S. - I haven't gotten to parsing attendees yet but I assume the same issue will exist there.
References:
* com.google.api.services.calendar.model.Event.Organizer
It usually happens to users who have not enabled Google+ on their accounts. You can refer here. For now, make sure that you enable Google+ on your domain and then on your account. If still persists, try deleting the account from your app's accounts list for your account to be updated properly.
Related
I've implemented Firebase Invites as described in the documentation and it works fine.
I've discovered that if a user has multiple Google accounts then the first time the Intent is invoked, Firebase asks the user to select one of these accounts (if they choose to send an invite via email, the selected account is the one it comes from).
However, my users have complained that that there is no way to change the account that is used. Uninstalling the app and reinstalling does not cause the prompt again, so apparently Firebase is storing the selection internally.
I've found the setAccount method, but that would require me to launch the account-chooser dialog and specify the Account every time. I was hoping there would be some mechanism to cause Firebase to reset the choice that it has stored internally. Is there a way to do that?
Note that calling FirebaseAuth.getInstance().signOut() has no effect. In fact, calling FirebaseAuth.getInstance().getCurrentUser() returns null. That seems to confirm that Firebase Invites is not using Firebase Auth. [It would be nice if Google documented what is going on, instead of us having to guess how it works.]
Here's the private response I got from a Google engineer:
No, there's no way to clear the default account. As they mentioned, setAccount would be the recommended way to choose the account. For this case, though, you might want to tell them that the user actually can change the account from the Invites screen by tapping on the user avatar. If they have more than one account on the device, this should bring up the account chooser to change what account emails are sent from.
I'm using AccountAuthenticator and SyncAdapter in application, for accounts stored in AccountManager I use my own ACCOUN_TYPE and server specific identifier as ACCOUNT_NAME (Let's say "com.example.account_type" and "xxx-long-hashed-id" respectively).
I have to use this identity to keep that account distinct from another, because as far as I understand AccountManager uses both type and name to ensure account uniqueness.
The problem is, when I open system Settings->Account page for my app I see this ugly identifier as name, but I wanted put there username associated with this identity (I also see this in Contacts app - I export contacts there). If I started to use username as ACCOUNT_NAME, any time I change username in my app, I would see another account there, although it should be the same. Is there any way or workaround to use identity as name, but provide user-readable name to the system?
No, there is no alias mechanism for accounts in Android. Using the actual username is the intended way to create accounts. If you need to change the account name, you have to remove and re-add the account. For API level 21+ there is a method called AccountManager.renameAccount(...) but it does essentially the same. It's up to your app to migrate any data from the old account to the new one, Android won't do that for you.
Regarding the uniqueness of accounts, it's sufficient if the account name is unique among all accounts of your account type. So given all users of your service have unique usernames, there is nothing to worry about.
Is there any android api to get information about the purchase of the app? I don't talk about in-app purchases. Just the Plain APP-Purchase.
I need any unique identifier like an transaction id or something like that.
As mentioned in other answers, it looks like there's no public API for it. (I believe, the reason for it is that by default - once user starts the app - he has already got if from Google Play. So in the ideal world, there should be no need for this check)
If I were you, I'd implement some tiny API endpoint on your server side and sends it hashed version of the user's accountId (see Accessing Google Account Id /username via Android ) and Timestamp-response(or any other reasonable data back) of initial call of this method for this particular user Id (i.e. once he changed his phone - you'll still track him).
To get current Account do this:
Account[] accounts = AccountManager.get(this).getAccountsByType("com.google");
if (accounts.length != 0) {
String myEmailid=accounts[0].toString();
}
(taken from here)
Tested on API 19 and API 23(In Android M it requires a bit extra work due to permission-check)
As per my understanding of question you want to get information of your app buyers or you want to check particular user's purchase status for your app.
AFAIK :
As of now I can't able to see any buyers info for your android application purchase.
Reference : https://support.google.com/googleplay/android-developer/answer/6056620?hl=en
But in past may be we were able to see such information.
Reference : Android Market (Google Play). Get buyer information
As far as I know there is no way to persist this information across app uninstall/reinstalls. You can get the installation timestamp but this will be reset when reinstalling.
However, a workable solution may be to set a flag in SharedPreferences and save the data using Android Backup (http://developer.android.com/guide/topics/data/backup.html#SharedPreferences)
The most reliable way would be to create your own (web-)service and have the app register itself with the google user name (How do I retrieve the logged in Google account on android phones?), and check the registration on later reinstall.
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)
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 ;)