Search code examples
androidcordovaionic-frameworkcordova-pluginsphonegap-pushplugin

Why is my GCM notification truncated? (Cordova PushPlugin)


I'm sending a very simply GCM push notification over HTTP. On my android it displays the first 32 characters, following by 3 dots. Messages from other apps appear just fine, all wrapped nicely.

The app side is an Ionic application (Cordova) using PushPlugin as the client notification code.

example, the following code results in the message: this is not such a long message to be trun...

POST: https://android.googleapis.com/gcm/send    
{       
  "registration_ids":["secret"],
  "data": {
        "message" : "this is not such a long message to be truncated"
  }
}

Anyone knows this plugin and can help configuring it to display multiline notifications?


Solution

  • As ShibbyUK answered, use BigTextStyle:

    • There is a pull request for PushPlugin that does just this.

    • Or you could modify the plugin yourself, by making these changes:

      if (extras.getString("bigview") != null) {
          boolean bigview = Boolean.parseBoolean(extras.getString("bigview"));
          if (bigview) {
              mBuilder.setStyle(new NotificationCompat.BigTextStyle().bigText(message));
          }
      }