# Get Player's unique Google Play ID

**URL:** <https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902>\
**Category:** Mobile\
**Tags:** unreal-engine, Android\
**Created:** [July 19, 2015, 8:44pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902 "2015-07-19T20:44:45Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_f2ac25f11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f2ac25f11](https://forums.unrealengine.com/u/anonymous_user_f2ac25f11)\
**Post date:** [July 19, 2015, 8:44pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/1 "2015-07-19T20:44:45Z")

</div>

Quick question due to the current lack of OnlineSubsystem documentation. How - if possible - would I get the player’s unique Google Play ID from the subsystem or otherwise, or some other player specific unique identification. I’ve looked through the source of various OnlineSubsystemGooglePlay files but haven’t yet found anything promising. Some thing’s I’ve tried include:

- onlineSubsystem-\>GetIdentityInterface()-\>GetUniquePlayerId(0).Get().ToString();

- Returns empty string

- onlineSubsystem-\>GetIdentityInterface()-\>GetPlayerNickname(0);

- Returns “NONE”. Set in FOnlineIdentityGooglePlay constructor and does not appear to be set to anything else in the rest of the code.

- PlayerController-\>PlayerState-\>PlayerID;

- Always 256 whether on PC or Android

- PlayerController-\>PlayerState-\>UniqueId.ToString();

- Returns “INVALID”

- PlayerController-\>PlayerState-\>PlayerName;

- Returns “INVALID”

- PlayerController-\>PlayerState-\>GetNetDriver()-\>LowLevelGetNetworkNumber();

- Crashes. Idea from: [How to get player steam id? - C++ - Epic Developer Community Forums](https://forums.unrealengine.com/showthread.php?59847-How-to-get-player--id)

One potential way I thought of would be to work through onlineSubsystem-\>GetGameServices()-\> **Android Functions** but it appears impossible to include OnlineSubsystemGooglePlay.h itself in my files (I have OnlineSubsystemGooglePlay as a dependency on Android builds but the build still fails).

Thanks,

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_d7940737](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_d7940737](https://forums.unrealengine.com/u/anonymous_user_d7940737)\
**Post date:** [July 20, 2015, 8:02pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/2 "2015-07-20T20:02:56Z")

</div>

Hi danm36,

See if this thread helps: [android - Get a user ID from Google Play Services? - Stack Overflow](http://stackoverflow.com/questions/26413589/get-a-user-id-from-google-play-services)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f2ac25f11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f2ac25f11](https://forums.unrealengine.com/u/anonymous_user_f2ac25f11)\
**Post date:** [July 21, 2015, 9:25am UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/3 "2015-07-21T09:25:24Z")

</div>

Hey,

I’m trying to do something similar, and the Google Play SDK in the third party directories seem to contain exactly what I need, but I can’t seem to include that directly (And that’s probably not the best way to do things). I do notice that OnlineSubsystemGooglePlay provides a method to access these services through GetGameServices() but I cannot find any way to cast the default IOnlineSubsystem pointer to a OnlineSubsystemGooglePlay pointer, mainly due to the include failing. I include:

/Runtime/Online/Android/OnlineSubsystemGooglePlay/Public/OnlineSubsystemGooglePlay.h

and only do so during an Android build, but the include fails when trying to include the various files within OnlineSubsystemGooglePlay.h (A lot of which are in the Private directory) with file not found errors. I have tried various combinations of PublicDependencyModuleNames, PrivateDependencyModuleNames, PublicIncludePaths and PrivateIncludePaths in my build.cs but it still doesn’t appear to recognize these other header files and I cannot complete the cast.

**Edit:**

Actually I’m not sure if I tried PublicIncludePaths. I’ll give that an attempt when I get home.

---

<div class="post-metadata">

**Author:** ![KillerSneak](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/killersneak/32/754802_2.png) [@KillerSneak](https://forums.unrealengine.com/u/KillerSneak)\
**Post date:** [July 21, 2015, 7:04pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/4 "2015-07-21T19:04:10Z")

</div>

Would be nice to have this as a blueprint node ☹

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f2ac25f11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f2ac25f11](https://forums.unrealengine.com/u/anonymous_user_f2ac25f11)\
**Post date:** [July 21, 2015, 7:33pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/5 "2015-07-21T19:33:53Z")

</div>

Alright, tried all the various combinations and more, and have learnt a lot more about the public/private system, the end result seemingly making including OnlineSubsystemGooglePlay.h impossible.

It seems a bit odd - as a result of this system - to have certain Google Play Subsystem headers in the private directory, making it impossible to include OnlineSubsystemGooglePlay.h anywhere but the OnlineSubsystemGooglePlay module. After all, the GetGameServices() method provided by this particular class would be extremely useful. Is there any potential workaround for this that would allow me to access the current user’s data, or will I have grab a copy of the engine source and implement various methods that way? (I might still do this anyway and send a pull request).

---

<div class="post-metadata">

**Author:** ![Ryan\_Gerleve](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ryan\_Gerleve](https://forums.unrealengine.com/u/Ryan_Gerleve)\
**Post date:** [July 22, 2015, 9:17pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/6 "2015-07-22T21:17:28Z")

</div>

Hi danm36,

Unfortunately, I think the only workarounds for this will involve modifying the engine, though you might be able to just move the other Google Play subsystem headers you need from the “Private” directory to the “Public” directory. As you’ve discovered, access to this data hasn’t been hooked up in the Google Play subsystem yet :(. The GetGameServices() function was meant to be used internally by the individual Google Play subsystem interfaces, since they need access to it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f2ac25f11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f2ac25f11](https://forums.unrealengine.com/u/anonymous_user_f2ac25f11)\
**Post date:** [July 23, 2015, 10:26am UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/7 "2015-07-23T10:26:16Z")

</div>

Alright, thanks for the info. I’m currently adding a small bit of code to the subsystem with help from the , and subsystems. It ain’t going to be that pretty, but I’ll probably send a pull request when I get it working (It will only handle the unique ID for now).

Thanks again!

---

<div class="post-metadata">

**Author:** ![Ryan\_Gerleve](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ryan\_Gerleve](https://forums.unrealengine.com/u/Ryan_Gerleve)\
**Post date:** [July 23, 2015, 2:21pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/8 "2015-07-23T14:21:01Z")

</div>

> [@danm36;338524](#):
>
> Alright, thanks for the info. I’m currently adding a small bit of code to the subsystem with help from the , and subsystems. It ain’t going to be that pretty, but I’ll probably send a pull request when I get it working (It will only handle the unique ID for now).
> 
> Thanks again!

Sorry for the inconvenience. If you’re working on a pull request, I’ll mention that I refactored how login is handled for Google Play [in this commit](https://github.com/EpicGames/UnrealEngine/commit/4a6eccd449649a9b507605edacea32ef215da77f) for 4.9. We’ll post more information about this change soon, and it will be documented in the release notes. Just a friendly note that if your PR changes this code, in this case we’ll be more likely to integrate it if it’s based off the master branch! 🙂

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f2ac25f11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f2ac25f11](https://forums.unrealengine.com/u/anonymous_user_f2ac25f11)\
**Post date:** [July 23, 2015, 2:31pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/9 "2015-07-23T14:31:03Z")

</div>

Currently working on promoted but I’ll switch to master for this. No worries with regards to the inconvenience, just wanted to make sure there wasn’t a system in place that I missed or would circumvent if I implemented my own system. The way I’ve got it now is a very feeble FUserOnlineAccountGooglePlay class that only implements and stores the unique ID, and a few modifications to FOnlineIdentityGooglePlay to use that class instead of returning nullptr, mainly because my knowledge of the other core details like the user/auth attributes and such is minimal at the moment (Although I hope to build upon this more over time)

---

<div class="post-metadata">

**Author:** ![Ryan\_Gerleve](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ryan\_Gerleve](https://forums.unrealengine.com/u/Ryan_Gerleve)\
**Post date:** [July 23, 2015, 3:02pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/10 "2015-07-23T15:02:56Z")

</div>

> [@danm36;338650](#):
>
> Currently working on promoted but I’ll switch to master for this.

I know I mentioned master but the 4.9 branch would work as well and should be more stable. I’m sure the commit I mentioned will make it into the promoted branch too, I’m just not sure when.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f2ac25f11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f2ac25f11](https://forums.unrealengine.com/u/anonymous_user_f2ac25f11)\
**Post date:** [July 23, 2015, 11:45pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/11 "2015-07-23T23:45:18Z")

</div>

Alright, interesting issue has popped up. I’ve moved to master and am correctly showing the login UI (Well, I think I’m correct using a simple call to onlineSubsystem-\>GetExternalUIInterface()-\>ShowLoginUI()) but when I try to grab the user data from gpg::PlayerManager::FetchSelfBlocking(), it results in response with ERROR\_NOT\_AUTHORIZED as the status. Naturally I assumed this was a permissions issue, but no matter what permissions I add, it still reports ERROR\_NOT\_AUTHORIZED. From logging in via one of my classes, I call onlineSubsystem-\>GetIdentityInterface()-\>GetUserAccount() where the following extremely ugly test code resides:

```auto

UE_LOG(LogOnline, Warning, TEXT("XYZ GP - Begin get game services."));
gpg::GameServices* gs = MainSubsystem->GetGameServices();

UE_LOG(LogOnline, Warning, TEXT("XYZ GP - Begin fetch self blocking."));
gpg::PlayerManager::FetchSelfResponse playerFetch = gs->Players().FetchSelfBlocking();
UE_LOG(LogOnline, Warning, TEXT("XYZ GP - Response Status %i."), playerFetch.status);

UE_LOG(LogOnline, Warning, TEXT("XYZ GP - Begin get own player data."));
gpg::Player gsplayer = playerFetch.data;
UE_LOG(LogOnline, Warning, TEXT("XYZ GP - Player valid = %s."), gsplayer.Valid() ? TEXT("true") : TEXT("false"));

FString ID = FString(gsplayer.Id().c_str());
UE_LOG(LogOnline, Warning, TEXT("XYZ GP - Got ID %s."), *ID);

return MakeShareable(new FUserOnlineAccountGooglePlay(ID)); //FUserOnlineAccountGooglePlay is essentially a stipped down clone of FUserOnlineAccountAmazon

```

I fully realise that this code can be shrunk down to two or three lines.

Now, I’m just wondering if you can provide any insight as to why I would get ERROR\_NOT\_AUTHORIZED for this, or at the very least some hints as to how the system works or where I’m going wrong. Surprisingly, Google searching for this returned very few errors, and the GPG docs don’t help much with regards to permissions or whatnot.

**Edit:**  
Just like to add that I’m running launching this from the editor. My signing keys are correctly set up (Achievements work correctly at least) and my account is a valid tester for the Google Play Services, although I don’t know how launching from editor differs from packaging for shipping in this case. When I’m next available, I’ll package the game properly and test using that.

In addition, I just noticed that the small banner telling you that you’ve signed in no longer appears in this version.

**Edit 2: Electric Boogaloo:**  
Well I’m a dunce. Just looked through LogCat and found in big red text that the Google Play Game Services API is not enabled for my project (I can confirm it is in my Alpha published version, so the settings are correct), which gives me almost 100% confidence that I just need to package the game and I’ll be golden.

**Edit 3**  
Nope, packaging didn’t help (Although I can’t see any Google Play Service errors in LogCat now, so maybe it did something)

---

<div class="post-metadata">

**Author:** ![Ryan\_Gerleve](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ryan\_Gerleve](https://forums.unrealengine.com/u/Ryan_Gerleve)\
**Post date:** [July 24, 2015, 3:43pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/12 "2015-07-24T15:43:28Z")

</div>

Ah, I suspect your .apk is being signed with the debug key in your Android SDK directory - which will be the case if you’re launching from the editor or packaging without the “For distribution” option checked. If so, you’ll need to make sure that the debug signing key fingerprint is [registered with another linked app on the Google developer console](https://developers.google.com/games/services/console/enabling).

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_f2ac25f11](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_f2ac25f11](https://forums.unrealengine.com/u/anonymous_user_f2ac25f11)\
**Post date:** [July 24, 2015, 10:04pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/13 "2015-07-24T22:04:52Z")

</div>

Excellent! Thanks for the help, it works perfectly with the debug key (I completely forgot about that)! Now to just neaten up the code and send a pull request. I’ll even make a get unique ID blueprint node for KillerSneak.

---

<div class="post-metadata">

**Author:** ![KillerSneak](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/killersneak/32/754802_2.png) [@KillerSneak](https://forums.unrealengine.com/u/KillerSneak)\
**Post date:** [July 25, 2015, 12:42pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/14 "2015-07-25T12:42:29Z")

</div>

> [@danm36;339876](#):
>
> Excellent! Thanks for the help, it works perfectly with the debug key (I completely forgot about that)! Now to just neaten up the code and send a pull request. I’ll even make a get unique ID blueprint node for KillerSneak.

That would be awesome, if you’re able to pull it of it’s also much easier to integrate the Google Play Services Save Game feature(s) (I hope)

---

<div class="post-metadata">

**Author:** ![KillerSneak](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/killersneak/32/754802_2.png) [@KillerSneak](https://forums.unrealengine.com/u/KillerSneak)\
**Post date:** [August 3, 2015, 2:32pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/15 "2015-08-03T14:32:21Z")

</div>

> [@danm36;339876](#):
>
> Excellent! Thanks for the help, it works perfectly with the debug key (I completely forgot about that)! Now to just neaten up the code and send a pull request. I’ll even make a get unique ID blueprint node for KillerSneak.

Any news / progress on this? This will be very handy for storing progress on a server bound to the users GoogleID(s)

---

<div class="post-metadata">

**Author:** ![Jambax](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jambax/32/904177_2.png) [@Jambax](https://forums.unrealengine.com/u/Jambax)\
**Post date:** [January 25, 2016, 3:43pm UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/16 "2016-01-25T15:43:06Z")

</div>

This is still completely impossible in 4.10, and I **really** do not want to avoid to a source build of the engine to try and work around this.

I need this to be able to have Save-Games on the device that are tied to profiles. Without it there’s no way to do this!

> **[Why no Unique User ID functionality for Google Play?](https://forums.unrealengine.com/showthread.php?98485-Why-no-Unique-User-ID-functionality-for-Google-Play&p=460661#post460661)**
>
> Currently it’s completely impossible to get any form of unique information about a GooglePlay user, such as their ID, Nickname etc. The OnlineSubsystemGooglePlay() just returns default values for lot’s of things, even though Google fully supports all...

---

<div class="post-metadata">

**Author:** ![Hanzyusuf](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Hanzyusuf](https://forums.unrealengine.com/u/Hanzyusuf)\
**Post date:** [April 11, 2022, 6:08am UTC](https://forums.unrealengine.com/t/get-players-unique-google-play-id/35902/17 "2022-04-11T06:08:31Z")

</div>

I have made a plugin for getting the user’s unique id, nickname and auth token through blueprints (and c++ of course). This is only valid for google play logins.

> **[GitHub - Hanzyusuf/UE4-GooglePlayUtils: Plugin for unreal engine 4 to get...](https://github.com/Hanzyusuf/UE4-GooglePlayUtils)**
>
> Plugin for unreal engine 4 to get 'unique id' and 'nickname' of the user from the user's google play account. Also gives access to the auth token. Accessible in blueprints as we...
