Uploaded image for project: 'Titanium SDK/CLI'
  1. Titanium SDK/CLI
  2. TIMOB-20291

Android: Push Notification Payload Null

    Details

    • Type: Bug
    • Status: Open
    • Priority: High
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Android
    • Environment:

      Titanium SDK 5.1.2.GA and 5.2.0v20151125112632
      Android 5

      Description

      Issue Description

      While sending push notifications from aws dashboard or my api, android doesnt detect any payload received. And if the application is in background the application crashes with the following stacktrace:

      [ERROR] :  APSCloudPush: Payload is null!
      [ERROR] :  TiApplication: (main) [727118,839001] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to start receiver com.appcelerator.aps.GCMReceiver: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference; Titanium 5.2.0,2015/11/25 11:26,1edba8d
      [ERROR] :  TiApplication: java.lang.RuntimeException: Unable to start receiver com.appcelerator.aps.GCMReceiver: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
      [ERROR] :  TiApplication: 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:2776)
      [ERROR] :  TiApplication: 	at android.app.ActivityThread.-wrap14(ActivityThread.java)
      [ERROR] :  TiApplication: 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1440)
      [ERROR] :  TiApplication: 	at android.os.Handler.dispatchMessage(Handler.java:102)
      [ERROR] :  TiApplication: 	at android.os.Looper.loop(Looper.java:148)
      [ERROR] :  TiApplication: 	at android.app.ActivityThread.main(ActivityThread.java:5466)
      [ERROR] :  TiApplication: 	at java.lang.reflect.Method.invoke(Native Method)
      [ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
      [ERROR] :  TiApplication: 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
      [ERROR] :  TiApplication: Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
      [ERROR] :  TiApplication: 	at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116)
      [ERROR] :  TiApplication: 	at org.json.JSONTokener.nextValue(JSONTokener.java:94)
      [ERROR] :  TiApplication: 	at org.json.JSONObject.<init>(JSONObject.java:156)
      [ERROR] :  TiApplication: 	at org.json.JSONObject.<init>(JSONObject.java:173)
      [ERROR] :  TiApplication: 	at com.appcelerator.aps.APSCloudPush.showTrayNotification(APSCloudPush.java:347)
      [ERROR] :  TiApplication: 	at com.appcelerator.aps.APSCloudPush.receivePayload(APSCloudPush.java:253)
      [ERROR] :  TiApplication: 	at com.appcelerator.aps.GCMReceiver.onReceive(GCMReceiver.java:30)
      [ERROR] :  TiApplication: 	at android.app.ActivityThread.handleReceiver(ActivityThread.java:2769)
      [ERROR] :  TiApplication: 	... 8 more
      

      Information

      we tried the following structure for sending notifications:

      Suggested By Appcelerator but not working

       
      "data":{
          "payload":{
              "android": {
                  "alert": "This is a message from my own server"
              }
          }
      }
      

      AWS DEFAULT BUT NOT WORKING:

      {
      "default": "Welcome",
      "GCM": "{ \"data\": { \"message\": \"Welcome\" } }"
      }
      

      WORKING ONE

      But when we tried this, if app is in foreground it shows the message, but in background it crashes again :

      {
      "default": "Welcome",
      "GCM": "{ \"data\": { \"payload\": \"Welcome\" } }"
      }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                msamah Ashraf Abu (Inactive)
                Reporter:
                swapn1l Swapnil Singh
              • Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Backbone Issue Sync

                  • Titanium SDK/CLI <> Titanium Mobile
                    Synced with:
                    TIMOB-20901
                    Sync status:
                    ERROR
                    Last received:
                    Last sent:

                    Git Source Code