question

quaidt avatar image
quaidt asked

[ Unity ] Whispersync is returning right data, but emits no events

GameCircle Unity plugin 2.4 version, Kindle Fire HDX 7, We have Whispersync AGSSyncableDeveloperString working correctly on Save / Load data in our Unity based game. However, we are unable to see any event being emitted in logcat, I mean all the following events in GameCircleManager.cs are not emitted: public void onNewCloudData( string empty ){ AGSClient.Log("----------GameCircleManager : Whispersync.onNewCloudData()----------"); AGSWhispersyncClient.OnNewCloudData(); } public void onDataUploadedToCloud (string empty){ AGSClient.Log("----------GameCircleManager : Whispersync.onDataUploadedToCloud()----------"); AGSWhispersyncClient.OnDataUploadedToCloud (); } public void onThrottled (string empty){ AGSClient.Log("----------GameCircleManager : Whispersync.onThrottled()----------"); AGSWhispersyncClient.OnThrottled (); } public void onDiskWriteComplete (string empty){ AGSClient.Log("----------GameCircleManager : Whispersync.onDiskWriteComplete()----------"); AGSWhispersyncClient.OnDiskWriteComplete (); } public void onFirstSynchronize (string empty){ AGSClient.Log("----------GameCircleManager : Whispersync.onFirstSynchronize()----------"); AGSWhispersyncClient.OnFirstSynchronize (); } public void onAlreadySynchronized (string empty){ AGSClient.Log("----------GameCircleManager : Whispersync.onAlreadySynchronized()----------"); AGSWhispersyncClient.OnAlreadySynchronized (); } public void onSyncFailed(string failReason){ AGSClient.Log("----------GameCircleManager : Whispersync.onSyncFailed()----------"); AGSWhispersyncClient.OnSyncFailed (failReason); }
10 |5000

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

quaidt avatar image
quaidt answered
[b]Unity 4.3, GameCircle plugin 2.4, Kindle HDX 7[/b] We got the following in logcat ---------------------------------------------------------------------- D/GC_Whispersync( 8903): posting event: NEW_DATA_FROM_CLOUD W/dalvikvm( 8903): [b]No implementation found for native Lcom/amazon/ags/jni/whispersync/WhispersyncJni;.onNewCloudData:()V[/b] V/GC_Whispersync( 8903): [b]GameCircle JNI library not loaded, cannot call WhispersyncJni[/b] D/GC_Whispersync( 8903): Download from cloud completed - New game data D/GC_Whispersync( 8903): posting event: FIRST_SYNC ---------------------------------------------------------------------- So what we did was we copied the folder Apps-SDK\Android\GameCircle\GameCircleSDK\jni with libAmazonGameJni.so to Unity\Assets\Plugins\Android Now, we no longer see the following lines ---------------------------------------------------------------------- W/dalvikvm( 8903): [b]No implementation found for native Lcom/amazon/ags/jni/whispersync/WhispersyncJni;.onNewCloudData:()V[/b] V/GC_Whispersync( 8903): [b]GameCircle JNI library not loaded, cannot call WhispersyncJni[/b] ---------------------------------------------------------------------- but, still we didn't get any whispersync callbacks. ---------------------------------------------------------------------- By the way, we noticed the following message, which is being around since we started using whispersync. [b]E/Whispersync( 8903): Whispersync client has not been initialized. Please call AmazonGames.initialize() E/WS_WhispersyncClientProxyImpl( 8903): Whispersync client is null. Cannot set event listener. Please call initialize for AmazonGames.[/b] ---------------------------------------------------------------------- We have called [b]AGSClient.Init (true, true, true);[/b] at the beginning of our game, this is all we need to initiate whispersync right? I just want to make sure. Thanks. Message was edited by: quaidt
10 |5000

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

Bipin@Amazon avatar image
Bipin@Amazon answered
Have you checked in the game setting, is the whisper sync for your game is on. You can turn Whispersync on or off for the game in Game setting under GameCircle Settings.
10 |5000

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

quaidt avatar image
quaidt answered
Yes, Whispersync is always "ON" under GameCircle settings on my Kindle. Our Whispersync is always working correctly on loading the strings data, the problem now is, we are not getting any callbacks. We need these callbacks to initiate something.
10 |5000

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

Bipin@Amazon avatar image
Bipin@Amazon answered
ServiceReadyEvent is called when GameCircle initialization succeeds and clients are ready to use. From there you can register for AGSWhispersyncClient.OnDiskWriteCompleteEvent += HandleOnDiskWriteCompleteEvent; and initiate Synchronize and get dataMap from AGSWhispersyncClient.GetGameData() If you call AGSWhispersyncClient functionality before the service is ready you will get Whispersync client has not been initialized error You can add Debug.Log (" callback event ") in each callback to understand pattern callbacks OnNewCloudDataEvent OnAlreadySynchronizedEvent OnDataUploadedToCloudEvent OnDiskWriteCompleteEvent OnFirstSynchronizeEvent OnSyncFailedEvent OnThrottledEvent
10 |5000

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

quaidt avatar image
quaidt answered
Ok, we found out why.. AGSWhispersyncClient.Synchronize() must be called before any loading, if not, then we simply don't get any callbacks. ( Though whispersync can still grab the correct data from cloud ).
10 |5000

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

ffpang88 avatar image
ffpang88 answered
I don't know how relevant this is anymore, but I was having the same issues, but I figured out what went wrong. Each of the *Client class has a static constructor that would get the static instance reference of the corresponding Java class, and because static constructors do not run in a deterministic order, the AGSWhispersyncClient's one ran before the AGSClient's. What this means is that, on the Java library's end, AmazonGamesClient's initialize method did not get called before the WhispersyncClientProxyImpl attempts to set the event listener. The fact that "Whispersync client is null. Cannot set event listener. Please call initialize for AmazonGames." gets outputted is the clear evidence. What I've done is move the initialization code into AGSClient's ServiceReady method, which ensures that AmazonGamesClient is properly initialized. May I be informed of the version of the Unity Plugin that would fix this issue?
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
I believe the flow I have mentioned in below thread, should solve this problem. https://forums.developer.amazon.com/forums/message.jspa?messageID=10879#10879
10 |5000

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

smashingideas avatar image
smashingideas answered
How do you turn on whispersync in Kindle fire? >.<
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
Settings->Applications->Amazon GameCircle->Whispersync for Games There is a switch there.
10 |5000

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

smashingideas avatar image
smashingideas answered
I don't see it there.... >.<
10 |5000

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