Announcement

Collapse
No announcement yet.

Why no Unique User ID functionality for Google Play?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [FEATURE REQUEST] Why no Unique User ID functionality for Google Play?

    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 of this! I've noticed that the Match3 example attempts to get the HexEncodedString from the User ID, but it too doesn't work with Google (but that would work with IOS).

    I want the device to be able to store multiple save-games from different players, but I can't do that unless each player has a unique ID and I can name the save file with a unique name too! Surely there is a way to achieve this?!

    The following, will return nothing for a Google user, but will work with Steam, iOS, Facebook - even Amazon etc..

    Code:
    	ULocalPlayer* LP = Cast<ULocalPlayer>(ForController->Player);
    	if (Identity.IsValid() && LP->GetPreferredUniqueNetId().IsValid())
    	{
    		FUserOnlineAccount Account = Identity->GetUserAccount(*LP->GetPreferredUniqueNetId());
                    return Account.GetUserId();
    	}

    #2
    Hello, TheJamsh. I've checked with our QA staff, and the Match3 learning sample has been confirmed to support different saved games on a single Android device based on logged-in user ID.

    I'm sure you've seen it, but for the benefit of anyone who finds this via a search engine, here's the function that we use. We take the output from that function and incorporate it into the name of the saved game file, which gives us a unique name per user ID, or an empty string if the user isn't logged in.
    Code:
    FString UMatch3BlueprintFunctionLibrary::GetOnlineAccountID(APlayerController* PlayerController)
    {
    	if (PlayerController && PlayerController->PlayerState && PlayerController->PlayerState->UniqueId.IsValid())
    	{
    		return PlayerController->PlayerState->UniqueId->GetHexEncodedString();
    	}
    	return FString();
    }
    I've passed your concern along to the appropriate parties in case there is something going wrong in platform-specific online subsystem code. For now, I'm unable to reproduce the Match3 function failing on the Android devices we've tested here in our office. Just out of curiosity, if you use the Match3 function while logged in, are you getting empty strings? Is your code hitting the inside of the conditional block? Is there any information about the device you're using that might be relevant? If possible, it might even be a good test case just to play Match3 on your device with some of the accounts you're using to test your own game.

    Comment


      #3
      Hello. I've applied this code on my project. I succeed to get unique id on IOS(GameCenter), Windows.
      But I can't get unique id on Android(GooglePlay). my Engine version is 4.10.1 by github.

      I tried to this code on release package and development package.
      These case connected google play successfully.
      But when I execute InitUniqueId Function after google play login successfully, this function always call UDCLibrary::PrintErrorMessage(this, ": InitUniqueId fail").

      I don't know why can not I get unique ID.

      This is my code.

      Code:
      void ADCInAppPurchaseManager::InitUniqueId(APlayerController * PlayerControllerInst)
      {
      	if (PlayerControllerInst)
      	{
      		if (PlayerControllerInst->PlayerState)
      		{
      			if (PlayerControllerInst->PlayerState->UniqueId.IsValid())
      			{
      				UniqueId = PlayerControllerInst->PlayerState->UniqueId->GetHexEncodedString();
      				UDCLibrary::PrintErrorMessage(this, "UniqueId: " + UniqueId);
      			}
      			else
      			{
      				UDCLibrary::PrintErrorMessage(this, ": InitUniqueId fail");
      			}
      		}
      		else
      		{
      			UDCLibrary::PrintErrorMessage(this, ": PlayerState fail.");
      		}
      	}
      	else
      	{
      		UDCLibrary::PrintErrorMessage(this, ": PlayerController fail.");
      	}
      }
      Thank you.
      Last edited by minnow; 01-27-2016, 11:05 AM.

      Comment


        #4
        Originally posted by Richard Hinckley View Post
        Hello, TheJamsh. I've checked with our QA staff, and the Match3 learning sample has been confirmed to support different saved games on a single Android device based on logged-in user ID.

        I'm sure you've seen it, but for the benefit of anyone who finds this via a search engine, here's the function that we use. We take the output from that function and incorporate it into the name of the saved game file, which gives us a unique name per user ID, or an empty string if the user isn't logged in.
        Code:
        FString UMatch3BlueprintFunctionLibrary::GetOnlineAccountID(APlayerController* PlayerController)
        {
        	if (PlayerController && PlayerController->PlayerState && PlayerController->PlayerState->UniqueId.IsValid())
        	{
        		return PlayerController->PlayerState->UniqueId->GetHexEncodedString();
        	}
        	return FString();
        }
        Hi Richard,

        Even with the Match 3 example, that function returns an empty string regardless of whether the player is logged in or not. The code does indeed go into the block, but the string returns nothing

        This is easy enough to test even with the downloaded app from the store too. If you find the save-game file for the player on the device you've been playing on, you'll notice that it's just called _Match3.sav. The player ID is supposed to come before that underscore so that each player that logs in on the device has their own save game file. At the moment, logging in as another player just overwrites the existing save.

        Note: I've been testing this on two devices, one an nVidia Shield and the other a Sony Xperia Z3. Both give the same results, and both login to google succesfully.

        EDIT: Just tested again with debug strings. The 'UniqueID' isn't valid. I was looking into this pull request yesterday to see if it fixed the issue, but unfortunately that PR doesn't compile when you build for android.
        Last edited by TheJamsh; 01-27-2016, 06:56 AM.

        Comment


          #5
          minnow and TheJamsh, thank you for that information and your patience on this topic. We are currently passing this issue back to QA and will follow up with engineering once we can verify it.

          Comment


            #6
            Thanks Richard,

            Any idea on an ETA? We can't really launch/publish our game until this is resolved

            Comment


              #7
              TheJamsh, I have escalated the issue internally, but unfortunately I don't have an ETA yet. I have set my account to receive notifications from our issue-tracking software as the issue is updated, and I'll let you know if I find anything out.

              Comment


                #8
                GameDNAStudio has fixed this via Pull Request here

                https://github.com/mephistophele/Unr...d850ac3c0911e9

                Comment


                  #9
                  TheJamsh and minnow, a fix for this issue was checked into our 4.11 release last night. It will hopefully be included in our next update. Thanks for calling attention to it!

                  Comment


                    #10
                    Originally posted by Richard Hinckley View Post
                    TheJamsh and minnow, a fix for this issue was checked into our 4.11 release last night. It will hopefully be included in our next update. Thanks for calling attention to it!
                    Love you guys Cheers!

                    Comment


                      #11
                      Thank you Richard Hincley.

                      Comment


                        #12
                        Can confirm that this is fixed in Preview 6. Many thanks!

                        Comment

                        Working...
                        X