Nothing happens when sending push notifications

Hello,
I’m trying to setup cloud notifications in my poynt application.
Following the guidelines i made a node.js backend that should send notifications to my device.
The problem is, when i send push notifications i receive a 200 status code and an empty JSON response but still no notification arrives at my device.
Any suggestions?

Best regards,
Andrea.

Hi Andrea, Can you provide us the appId you are using to send the cloud messages?

Good morning,
Yeah sure, here it is --> urn:aid:4d02cdb2-dcae-451b-b314-07e0a8ace1a8

Hi Andrea,
The cloud messages was delivered to your device, there will be no UI notifications for the messages since it is forwarded to the respective package(in this case your app) and you need to handle it.
Just for your information if a 202 is received as a response the POST request is accepted by the server.

Regards,
Deepak

1 Like

Thanks a lot for the answer,
I managed to recevie the notifications but i’m having another issue now.
I can’t handle the received notification.

I put in the manifest this code:

    <receiver android:name=".MyBroadcastReceiver">
        <intent-filter>
            <action android:name="poynt.intent.action.CLOUD_MESSAGE_RECEIVED" />
            <category android:name="poynt.category.CLOUD_MESSAGE" />
        </intent-filter>
    </receiver>

and i created this class to handle the event:

package com.example.alex.livehelppoynt;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.widget.Toast;

import co.poynt.os.model.Intents;

public class MyBroadcastReceiver extends BroadcastReceiver {
public MyBroadcastReceiver() { }
@Override
public void onReceive(Context context, Intent intent) {

    Log.d("MyBroadcastReceiver", "Got cloud Message: " + intent.getStringExtra(Intents
            .INTENT_EXTRA_CLOUD_MESSAGE_BODY));

    Toast.makeText(context, "OK",
            Toast.LENGTH_LONG).show();
}

}

When i receive a notification, the method onReceive is never called.
Am i doing something wrong?

Thanks and have a good day,
Andrea

Could you please check if the recipient class name and package name in the payload are correct
“recipient”: {
“className”: className,
“packageName”: packageName
},

Thanks for the answer deepak,
I guess they are correct, here is my code from wich i send the notifications:

app.get(’/’, function (req, res) {

var poynt = require('poynt')({
  region: 'eu',
  applicationId: 'urn:aid:4d02cdb2-dcae-451b-b314-07e0a8ace1a8',
  filename: 'D:/inetpub/Nexi_test/urn_aid_4d02cdb2-dcae-451b-b314_publicprivatekey.pem'
});


// Sending push notification
poynt.sendCloudMessage({
  businessId           : '435ba9ad-57bf-445f-87fa-a0c21df9499d', 		
  storeId              : '1f7b06ed-2325-4aaf-b4fe-3b5c03e1bc9d',	
  deviceId             : 'urn:tid:4f92fb19-5be6-3d98-8ec0-aa7001aa8fa0',	
  recipientClassName   : 'MyBroadcastReceiver',
  recipientPackageName : 'com.example.alex.livehelppoynt',
  data				   : 'Hello from LiveHelp, I m a notification!',
  ttl                  : '500'
}, function (err, doc, http) {
  if (err) {
	res.send(err);
	console.log(err);
  }
  
   var my_response = JSON.stringify(doc);
   console.log(my_response);
   res.send("Sent!");
});

});

Best regards,
Andrea.

Sorry to bother but is there someone who can please help me?
i’m stuck because of this and i can’t seem to find a solution :disappointed:

Andrea.

Please use full classname including its package name like in the python sample.

Finally made it thanks a lot.
In my case i needed to add the full name both in the sender recipientClassName and in the receiver in androidManifest.xml.

Best Regards,
Andrea.