question

Heghine Hakobyan avatar image
Heghine Hakobyan asked

Whispersync Data Type

Hi, I'm implementing Wispersync in a game and while playing the game users are assigned an unique user id. Also, they set some unique username for themselves. I would like to know if I can keep this type of information (username or user id) through Wispersync? Thanks in advance, Heghine
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Hakobyan, Can you please clarify the use case a little? Since the id and alias are always available from the SDK, then why do you need to persist these information through Whispersync?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Heghine Hakobyan avatar image
Heghine Hakobyan answered
Hi Sujoy, Each time the game is installed on device, I assign a unique id to the user and keep that id in a database (on server side) as well as in preferences. I also keep the game progress in a database. When user launches the game, the request is send to server with user's id and the game progress is returned. However, when game is uninstalled from device, I lose user's id from preferences. When next time user installs the game, I'm not able to identify if the user already played the game or not. If I could keep user id through whispersync, I can send request to my server and get user's progress, hence I can offer the user to restore his/her progress in the game. I hope it is clear enough. Thanks again for response!
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Heghine, I understood the requirement. But I already mentioned in my last post that you will receive the unique players id from the sdk. AmazonGamesClient.getInstance().getProfilesClient() .getLocalPlayerProfile(new Object[]{}) .setCallback(new AGResponseCallback () { public static final String TAG = "MyActivity"; @Override public void onComplete(RequestPlayerProfileResponse result) { if (result.isError()) { Log.i(TAG, "GameCircleGetPlayerAlias ERROR: " + result.getError()); } else { Log.i(TAG, "GameCircleGetPlayerAlias OK"); String alias = result.getPlayer().getAlias(); Log.i(TAG, "alias: " + alias); Log.i(TAG, "playerid: " + result.getPlayer().getPlayerId()); } } }); Here is the API doc for getPlayerId. https://developer.amazon.com/public/binaries/content/assets/javadoc/gamecircle-api-reference/com/amazon/ags/api/profiles/player.html#getPlayerId%28%29 Why do you need to generate an unique id in the database and send back to your app client and persist in the device storage? Any way, you could certainly generate the id on your own and keep it in whispersync as a suitable data type supported.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Heghine Hakobyan avatar image
Heghine Hakobyan answered
Thanks for answer! Message was edited by: Heghine Hakobyan
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.