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.
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 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)
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)
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.