question

Tacs avatar image
Tacs asked ·

Android Notification Receiver not triggered

Ahoy!
So im trying to send notifications to my android app.
I have everything done, i have a class extending AppNotification:

public class MyNotificationReceiver extends AppNotificationReceiver {
    final public static String NOTIFICATION_ACTION = "notif";
    final public static String NOTIFICATION_EXTRA_KEY = "extra_params";

    public MyNotificationReceiver() { }

    @Override
    public void onReceive(Context context, AppNotification notification) {
        Helper.logMe("Notif: "+notification.toString());
        if (notification.appEvent.equals(NOTIFICATION_ACTION)) {
            Helper.logMe("Got it!");
            Intent intent = new Intent(context, Webby.class);
            intent.putExtra(NOTIFICATION_EXTRA_KEY, notification.payload);
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(intent);
        }
    }
}

I also have the manifest properly set:

<receiver android:name=".classes.MyNotificationReceiver"
            android:enabled="true"
            android:exported="true">
            <intent-filter>
                <action android:name="com.clover.sdk.app.intent.action.APP_NOTIFICATION" />
            </intent-filter>
        </receiver>

On my Webby activity i have this:

@Override
protected void onNewIntent(Intent intent) {
    Helper.logMe("Done: "+intent.getStringExtra(MyNotificationReceiver.NOTIFICATION_EXTRA_KEY));
}


Im not getting logs when sending POST requests using https://www.clover.com/api_docs/#!/no... (i get a 200 response code and an empty json string response body).
Is there some problem with the push server or im doing something wrong?
Thanks.
Cheers.

4 comments
10 |2000 characters needed characters left characters exceeded

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

You can get a good idea if the push client thinks it's connected by doing adb logcat|grep -i push. If it looks like it's connected, you could try forcing a push message from some other source like creating / modifying an order on another device (to see if it's a problem w/ your usage or it's not working in general).

0 Likes 0 · ·

Hi @jeff
Im not really sure what you are saying... I created items in inventory using webapp and they are synced on my device
I've tried to adb logcat on android studio terminal then i tried to find "push" but it doesnt exist there, so i guess thats a problem?
Cheers.

0 Likes 0 · ·
Hello, I have the same problem. A few months ago the notifications were working OK, but now the notification is not triggered in the app. I created the app based on the notification example and also I tried with the notification itself now but it's not working.

This is the request:
https://api.clover.com:443/v3/apps/47NBMS8CP1H96/m...

And the Body:

{ "data": "0V8C221GZEA46", "event": "baykus_order"}

I don't know where else to check because everything seems to be ok.

Thanks.
0 Likes 0 · ·
Facing the same issue
0 Likes 0 · ·

0 Answers

· Write an Answer

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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