question

simon123 avatar image
simon123 asked raghavslk commented

App Notifications not receving on genymotion emulator

I am unable to receive app notifications in emulator
I've used this tutorial to set up clover in genymotion https://jamescha.gitbooks.io/clover-code-lab/content/setup_genymotion.html

On App Side I have this code which is listening for notifications

public class OrderNotificationListener extends AppNotificationReceiver {
    public final static String TEST_NOTIFICATION_ACTION = "printOrder";


    @Override
    public void onReceive(Context context, AppNotification notification) {
        try {
            if (notification.appEvent.equalsIgnoreCase(TEST_NOTIFICATION_ACTION)) {
                Log.d("MyApp", "Intent received NOTIFICATION " + notification.payload);
                Intent intent = new Intent(context, PrintOrderService.class);
                intent.putExtra(PrintOrderService.K_ORDER_ID, notification.payload);
                context.startService(intent);
            }
        } catch (Exception e) {
            Log.d(OrderNotificationListener.class.getSimpleName(), e.getMessage());
        }
    }
}

Even registered in manifest

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


I am using this URL to send notifications , response is successful as it returns {}

https://apisandbox.dev.clover.com/v3/apps/{aId}/merchants/{mId}/notifications

No error log is generating so not sure what is the issue.

OrdersClover Android SDK
10 |2000

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

1 Answer

David Marginian avatar image
David Marginian Deactivated answered raghavslk commented

How are you installing the app? Have you followed the instructions here: https://docs.clover.com/docs/working-with-apks/. You also may want to take a look at https://github.com/clover/android-examples/tree/master/pushnotificationexample which I updated recently.

3 comments
10 |2000

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

simon123 avatar image simon123 commented ·

No I have not added signed apk to sandbox account , I was directly running from android studio. I'll try steps from mentioned link.

0 Likes 0 ·
simon123 avatar image simon123 commented ·

Thank you ! Notifications are working after uploading signed apk to dev account . I hope there is a better way.

0 Likes 0 ·
raghavslk avatar image raghavslk simon123 commented ·

Once it is installed for the first time uploading to dev account, subsequent updates can be done directly within Android studio and emulator picks updates immediately.

0 Likes 0 ·

Welcome to the
Clover Developer Community