Unity Android Push notification demo not working on Unity5

0 votes
Hi, I just downloaded the latest UnityPush App42_Push_Sample_Unity from Github. It works fine in Unity 4.6, but generates an error in Unity 5 (only when running on the Android device):

'This overload is deprecated. Use the one with Dictionary argument.

NullRefException: WWW class has already been disposed.

Exception --> com.shephertz.app42.paas.sdk.csharp.connection.RESTConnectorWWW+<execute>d__3.MoveNext()

...

 

Am I doing anything wrong or does the demo sample need an update for Unity 5 compatiblity?

Also, I noticed that when running the demo built with Unity 4.6 the second time, I get an error because the device is already registered for push notifications. Is there a method to check if the device is registered before trying to register it again?

 

Tks
asked Jun 8, 2015 in App42 Cloud API-BaaS by dujardin (10 points)

1 Answer

0 votes

Hello,

Kindly download the latest version (4.0) of App42 Unity SDK from here and import App42 Unity SDK library as an assets in your project to overcome on this issue. If you still face any issue, then please share the complete exception details and screen shots. It will help us to provide better support from our side. 

Thanks,

Himanshu Sharma

answered Jun 9, 2015 by hs00105 (2,005 points)
Ok tks, now it works. I see you also updated on Github, which is great.
One thing that worries me though --> as I ran the same test project with Unity 4 and Unity 5 on the same device, I end up with two different Device IDs in the AppHQ console (both with the same username).
What worries me is that if i send a push to all, I am guessing my device will receive it twice? Is there a way to fix that?

Tks
Are you using different bundle Identifier. Actually device IDs are generated by GCM (Google Cloud Messaging).
On AppHQ if device IDs are different than you are able to register same userName,because different devices can have same user Name but different device IDs.
I do see two different device IDs although as far as I can tell, I used the same bundle identifier (the default in the project, com.test.push). In fact, it has to be the same, because when I try to push to all from AppHQ, I receive the push notification twice in the test app. I'm not sure what caused the generation of two distinct device IDs...
Actually device IDs are generated by GCM. So if you install the same application after uninstall, GCM can generate different device ID.
That makes sense. How do you advise addressing the problem in that case? People unistalling reinstalling an app creates quite some garbage entries in the list of push listeners on AppHQ. Do you see a simple way to clean it up? I'm guessing it would be the responsibility of the client application to check if it ever receives push notifications several time and to delete device tokens appropriately.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...