question

pranit avatar image
pranit asked Raymond Lee Deactivated edited

How to send PUSH Notification in Clover ?

I am using clover REST API for sending notification " https://apisandbox.dev.clover.com/v3/apps/aId/merc..."
So, I am using proper credentials like App Secrete Key as a AccessToken and AppId and MerchantId but I am getting the response like "{ }" empty braces. So, I am not able to understand that , notification is triggered or not. Please help me if any one knows any proper solution.
API TokenMerchantAuth
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

pranit avatar image
pranit answered Raymond Lee Deactivated edited
Thanks, I am using AppNotificationReceiver to receive a push notification send from the backend but not getting any Notification. I am not sure is it receiving or not. here is my receiver
public class NotificationReceiver extends AppNotificationReceiver {

public final static String TEST_NOTIFICATION_ACTION = "test_notification";
private Context mContext;

public NotificationReceiver() {

}

@Overridepublic void onReceive(Context context, AppNotification notification) {
this.mContext = context;
Toast.makeText(context, "Notification comes", Toast.LENGTH_SHORT).show();
String event = notification.appEvent;
Toast.makeText(context, "Notification comes"+event, Toast.LENGTH_SHORT).show();

NotificationCompat.Builder builder =
new NotificationCompat.Builder(mContext)
.setSmallIcon(R.drawable.add_icon)
.setContentTitle("Notifications Example")
.setContentText("This is a test notification");

Intent notificationIntent = new Intent(mContext, MenuSliderActivity.class);
PendingIntent contentIntent = PendingIntent.getActivity(mContext, 0, notificationIntent,
PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(contentIntent);

// Add as notificationNotificationManager manager = (NotificationManager) mContext.getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, builder.build());
if (notification.appEvent.equals(TEST_NOTIFICATION_ACTION)) {

}
}
Please suggest me what i am doing wrong .
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

pranit avatar image
pranit answered
Thanks I will look into this
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

pranit avatar image
pranit answered Raymond Lee Deactivated commented
Now, I have registered my receiver inside Manifest like this
<receiverandroid:name="com.develop.receivers.NotificationReceiver" android:enabled="true"android:exported="true" >
    <intent-filter><br>        <action android:name="com.clover.sdk.app.intent.action.APP_NOTIFICATION"><br>        </action><br>    </intent-filter><br></receiver><br>Also created object of it and call in a MainActivity like this<br>mNotificationReceiver = new NotificationReceiver();
mNotificationReceiver.register(mContext);
but still i am not getting the notification on the emulator.<br>the below url i am using<br>https://apisandbox.dev.clover.com/v3/apps/34ETTGZQBNJT6/merchants/7CJ857V5MHRK1/notifications?access_token=<access_token>'
10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community