Unity and Remote API



  • Avatar

    Yes, this is the device token returned by registerDevice. In my experience calls to createMessage using the "devices" field are not entirely reliable. PushWoosh has advised me to use the Tags feature (i.e. the "conditions" field) instead but I have not found that entirely reliable either.

  • Avatar

    The Unity does not use the registerDevice call, it is just part of the InitPushwoosh where I create the connectio to the PushWooshProxy for the android plugin or i do regiterforremotenotifiations on the iOS portion.

    It does not return anything but if i do a GetPushwooshToken I get back the token which is a looooooong string returned from the plugin.

    Is this the correct entry for DeviceID in the createMessage Remote API call or should i be using something else?

    I would really love if Pushwoosh could comment on what deviceid is supposed to be in the createMessage in more detail so i can verify that I am sending the right info but the servers are just not working right.

    It is hard to debug an issue if I cann't make sure I am even doing it right. It is possible to use the Unity Plugin to register my players and also send them directed pushes using the remote API right?

  • Avatar
    Dmitry Dyudeev

    In the "devices" section of the createMessage method you should specify either push tokens or HWIDs. So, you are correct, you are using the right entry.

    However, I'd like to stress out that we recommend using Tags instead: as John has already mentioned, push tokens are not a reliable way to target your users, since they tend to expire from time to time.

  • Avatar

    So now this is the issue we are having. I tried using createMessage but the messages never seem to show up despite the 200 result ok reponses and the control panel showing no issues.

    I am now trying to do it by tags as suggested above but that is not working as well. I created a new tag with the name of ID and am trying to set that tag in my app after i register for push notifications. The registration "seems" to go fine, I get a good result back from pushwoosh (response 200) and a token. When I call SetTags I get back a 210 (device not found) response. This is if I do it using the Remote API or in Unity itself using the SetTags method.

    The code I use is pretty much the example cs just with a call to SetTags in it.

    I do:

    1. InitPushWoosh() in the Start()
    2. In the onRegisteredForPushNotifications() i call setStringTag("ID", "100001240172758");

    and below is the result

    Snippets from the Logcat.

    V/GCMRegistrar( 3577): Saving regId on app version 1
    I/GCMIntentService( 3577): Device registered: regId = APA91bG-g5OjMP_mAsiN5SA1nIJWkPJXWKJtnOE-vJxHMxZbKHRuUa332SXQ-C_9hsCDe76NxAFSmhUJQIgsIgjpd2oyx2kNfWd6YcbrWKOwTTMQuyuI-_okWvyEcs6TXsAvmNlTwi00VQ76txNsKrtF1dSVp_yWdyaXlxgxeYXL0a_Tmi8kGFA
    W/DeviceRegistrar( 3577): Try To Registered for pushes
    W/PushWoosh: NetworkUtils( 3577): PushWooshResult: {"status_code":200,"status_message":"OK","response":null}
    W/PushWoosh DeviceFeature2_5( 3577): Send AppOpen success
    W/PushWoosh: NetworkUtils( 3577): PushWooshResult: {"status_code":200,"status_message":"OK","response":null}
    V/GCMRegistrar( 3577): Setting registered on server status as: true
    I/System.out( 3577): Using broadcast registration: true
    W/PushEventsTransmitter( 3577): No android.permission.BROADCAST_STICKY. Reverting to simple broadcast
    W/DeviceRegistrar( 3577): Registered for pushes: APA91bG-g5OjMP_mAsiN5SA1nIJWkPJXWKJtnOE-vJxHMxZbKHRuUa332SXQ-C_9hsCDe76NxAFSmhUJQIgsIgjpd2oyx2kNfWd6YcbrWKOwTTMQuyuI-_okWvyEcs6TXsAvmNlTwi00VQ76txNsKrtF1dSVp_yWdyaXlxgxeYXL0a_Tmi8kGFA
    W/PushWoosh DeviceFeature2_5( 3577): Try To sent Tags
    W/PushWoosh: NetworkUtils( 3577): PushWooshResult: {"status_code":210,"status_message":"Device not found","response":null}
    E/PushWoosh DeviceFeature2_5( 3577): ERROR: sent Tags null. Response = com.arellomobile.android.push.utils.NetworkUtils$NetworkResult@4264c850
    E/PushWoosh DeviceFeature2_5( 3577): java.lang.Exception
    E/PushWoosh DeviceFeature2_5( 3577):    at com.arellomobile.android.push.DeviceFeature2_5.sendTags(DeviceFeature2_5.java:250)
    E/PushWoosh DeviceFeature2_5( 3577):    at com.arellomobile.android.push.PushManager.sendTagsFromBG(PushManager.java:194)
    E/PushWoosh DeviceFeature2_5( 3577):    at com.arellomobile.android.push.tags.SendPushTagsAbstractAsyncTask.doInBackground(SendPushTagsAbstractAsyncTask.java:45)
    E/PushWoosh DeviceFeature2_5( 3577):    at com.arellomobile.android.push.tags.SendPushTagsAbstractAsyncTask.doInBackground(SendPushTagsAbstractAsyncTask.java:1)
    E/PushWoosh DeviceFeature2_5( 3577):    at android.os.AsyncTask$2.call(AsyncTask.java:288)
    E/PushWoosh DeviceFeature2_5( 3577):    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    E/PushWoosh DeviceFeature2_5( 3577):    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    E/PushWoosh DeviceFeature2_5( 3577):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    E/PushWoosh DeviceFeature2_5( 3577):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    E/PushWoosh DeviceFeature2_5( 3577):    at java.lang.Thread.run(Thread.java:841)
  • Avatar
    Max Konev

    Do you still experience this behavior? Recently we have had some delays during "registerDevice" processing that's why you received "device not found" error. This should be resolved now. Let me know if everything is ok?

Please sign in to leave a comment.