Chris6743166
Posts: 1
Joined: Tue Mar 18, 2014 11:50 am

Push notifications from WordPress plugin - Push message blank

My app receives push notifications from a WordPress plugin (Push Notifications for Posts - http://codecanyon.net/item/push-notif...).

However, the push notification message is blank. Just the name of the app appears.

How do I get the title from the push payload to display in notification?

The plugin developer kindly provided this hint:

[quote:]You can find the post's title in the data field of the notification payload, which in our case is something like:

code"data":{"id":"125", "title":"New Post Title"}/code

Here is an example:
In the class that extends BroadcastReceiver, implement the onReceive(Context context, Intent intent) method.
Here, to get the post's title call:
codeBundle extras = intent.getExtras();/code

codeid = extras.getString("id"); // "125" in our example/code

codetitle = extras.getString("title"); // "New Post Title" in our example/code

To show the alert box then call something like:

codeNotificationCompat.Builder builder = new NotificationCompat.Builder(context)/code

code .setSmallIcon(smallIconId)/code

code.setContentTitle(context.getString(context.getApplicationInfo().labelRes))/code

code .setAutoCancel(true)/code

Code: Select all

   code.setSound(RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION))/code 

code .setContentText(title)/code

code .setContentIntent(contentIntent);/code

code notificationManager.notify(id, builder.build());/code[/quote]

Chris6743166
Posts: 1
Joined: Tue Mar 18, 2014 11:50 am

Push notifications from WordPress plugin - Push message blank

I should add: Sending to Android.

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

Push notifications from WordPress plugin - Push message blank

Hello,

We'll search for a solution and someone will back with updates.

Alena Prykhodko
Posts: 0
Joined: Tue Apr 09, 2013 7:36 am

Push notifications from WordPress plugin - Push message blank

Hello,

Please specify where do you put the above code?

Also show us a screenshot of what you see on your phone when the push notification is sent.

Chris6743166
Posts: 1
Joined: Tue Mar 18, 2014 11:50 am

Push notifications from WordPress plugin - Push message blank

Hi Alena,

I'm afraid I don't know where the above code goes. Appery is great because it enables non-coders like myself to build relatively complex apps. I was rather hoping that there was a simple way of retrieving data from the push payload.

Screenshot of push notification as it currently appears attached.

Image

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Push notifications from WordPress plugin - Push message blank

Hello!

Why don't you use Appery.io Push notification service to work with push notifications?
http://docs.appery.io/tutorials/getti... - tutorial for receiving and sending push notifications from server
http://docs.appery.io/documentation/b... - our API for sending push notifications from devices

Chris6743166
Posts: 1
Joined: Tue Mar 18, 2014 11:50 am

Push notifications from WordPress plugin - Push message blank

Hi Maryna,

I did consider the Appery push notification service option, however, with my limited coding skills, it's far easier to install a WordPress plugin that sends push notifications than to start trying to write (or hiring someone to write) backend WordPress code to send push notifications via Appery server every time the school adds a post to their WP site.

Is there no simple way to process the payload that's coming from the website? As you can see, the push notifications work, it's just that they're missing the post title which should appear as the push message.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Push notifications from WordPress plugin - Push message blank

Hi Chris,

Unfortunately third-party plug-ins are outside the scope of our support. You should double check how this plug-in works. Probably you have some incorrect settings there.

Chris6743166
Posts: 1
Joined: Tue Mar 18, 2014 11:50 am

Push notifications from WordPress plugin - Push message blank

Hi Katya,

I'll ask the plugin developer if they can help. Can you tell me exactly how the payload should be formatted for the push notifications to work? Then I'll pass that information on.

Thanks for your help.

Return to “Issues”