Google Plus API get Person by ID - android

In my app I am using the Google API Client with the Google Plus API to get a Google Plus Person's friends.
I want to do this without making the user sign-in.
When a user signs up with my app's account system, they can link their account with Google Plus.
I can store any values in my app's account system, and I have tried storing the Person's ID, which I got like this:
I store the Google Plus Person's ID in my app's account system. Here is how I get the Person ID:
Plus.PeopleApi.getCurrentPerson(
mGoogleApiClient).getId()
I don't know if this is the right approach though, and I couldn't find a way to retrieve the Person later by his ID.
How can I later get an updated instance of the Person object from Google Plus?

Plus.People.load() takes a list of personIds and returns a Person object. Note, however, to do this call:
This call returns all information in Person, but only for the people specified and for data that is public in their profiles.
Required Scopes: SCOPE_PLUS_LOGIN
Meaning you must have a connected GoogleApiClient with the proper scope and you'll only get back public information.

Related

With Google People API, grabbing privately set profile data?

I got my Android Application to successfully pull the user's profile via Google People API to get the Person object. I am also successful in grabbing the user's birthday and gender from that object. Though after testing with my own Gmail and switching my account's gender and/or birthday to private, I was getting no response back from the API calls.
I am wondering if there is any way to be able to pull this information even if the user sets it to private? If I do a verification submission to Google of my application with the request scope of https://www.googleapis.com/auth/userinfo.profile to get the user's profile, will there be an option to request to be able to read private data as well if it gets approved? Or am I out of luck getting the privately set data for the user? (This is mainly just to help the user not have to worry about additional screens for entering in data).
You can get it by requesting non-public profile scopes.
More information here : https://developers.google.com/people/v1/how-tos/authorizing#profile-scopes

Android multi-user: get current user info

Strangely there isn't a question on SO regarding this topic. At least I couldn't find one.
Like Windows & Linux, Android too allows us to have multiple user accounts on the same device/computer:
Each user is the FIRST (or primary) Google account with which the device/user partition was activated. Hence, one way to get the name/email associated with this user is through Google Sign-In:
My question is, is there a way to get at least the name (if not the
email) of the device user? Without using Google Sign-In, which
requires both the Play Services library and the GET_ACCOUNTS permission?
There should be some Android API or Provider that tells us the name of the current device user. I've already looked at the following documents:
Supporting Multiple Users
Manage multiple users
AccountManager
.... and I couldn't find anything there.
Does anyone know of a way to get the name/email of the primary Google account on the current user/partition? WITHOUT Google Sign-In, which requires Play Services? Is there some Java/Android API that gives us the account details for the current user?
Related:
1. How to get active account Id in android multi user
2. How Gmail does it
3. Getting it without the GET_ACCOUNTS permission
4. Getting Android owner's email address nicely

Organizer.displayName is null for some users

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.

Android: Get information about app purchase

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.

Determine users who installed an app using Google Plus API

Is there an easier way to check who has installed my app using the Google plus API? I am listing out friends list where I would like to show the user if the his/her friends are using the app if not invite them?
As of now, I am getting the unique ID from the friends list and checking in backend with a database if the user is present or not.
Can somebody let me know what could be the best way to achieve this?
The people.list API method supports a collection value of connected.
The list of visible people in the authenticated user's circles who also use the requesting app. This list is limited to users who made their app activities visible to the authenticated user.

Categories

Resources