{ "href": "https://sandbox.dev.clover.com/v3/merchants/T0JQJVBQJTH1Y/devices/a553522c-b14e-457e-b183-acb4536886d5", "id": "a553522c-b14e-457e-b183-acb4536886d5", "model": "unknown_Android SDK built for x86", "merchant": { "id": "T0JQJVBQJTH1Y" }, "serial": "EMULATOR28X0X20X0", "secureId": "6f045596f5bf65e3", "buildType": "USERDEBUG", "deviceTypeName": "OTHER" },
POST /v3/apps/{ {appId}}/devices/a553522c-b14e-457e-b183-acb4536886d5/notificationsBody:
{ "event": "test_notification", "data": "Up to 4k of data" }
There is not an alternative for sending push messages to Clover devices. The message is queued for delivery and generally received by the device within 5-20 seconds, depending on the device state. If the device is offline, the notification will be retried until it expires, but delivery is a best effort rather than guaranteed, even if the device is online within the timeToLive window.
While this is not ideal, it may be sufficient for your purposes, but you will have to experiment with your use case.
As far as I know, getting a http status code of 200 and an empty map back means that your message was accepted for delivery.
If there are other notification services that fit your needs better you are free to use them in your app.
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 .
This looks good to me, are you registering your NotificationReceiver? You can do this either using the AndroidManifest.xml, or programmatically.
Here's a github link to an example on registering your NotificationReceiver in the AndroidManifest.xml.
To do it programmatically, just construct your NotificationReceiver object at some point in your app when are you ready to receive notifications. The AppNotificationReceiver class automatically registers your receiver for you when you construct it.
<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>'
3 People are following this question.
Authentication for API calls from Clover native app
OAuth 2.0 API Token Request - Receiving HTML Response Instead of Token
Generate a production token with control access
Installed Merchants Details are not displaying in Clover developer dashboard
Using my developer account app id how to i get other merchant information by rest api