Question

Anybody knows whether I can put control event in NotificationExtension in SmartWatch?

For example: if the notification is appear, I can swipe it down to delete it.

I have tried to add onSwipe:

public void onSwipe(int direction) {
             switch (direction) {
        case Control.Intents.SWIPE_DIRECTION_UP:
            break;
        case Control.Intents.SWIPE_DIRECTION_LEFT:
            break;
        case Control.Intents.SWIPE_DIRECTION_DOWN:
            //something todo, forexample:
            Toast.makeText(this, "Action 1", Toast.LENGTH_LONG).show();
            break;
        case Control.Intents.SWIPE_DIRECTION_RIGHT:
            break;
        default:
            break;
    }
} 

In that sample code, I didn't receive the toast. I don't know where can I implement the control for the notification, so I thought with onSwipe I can handle the control in NotificationExtension. Anybody knows correct solution?Thank You

Was it helpful?

Solution

That is not possible in a NotificationExtension. You'll need to use a ControlExtension if you want to be able to handle swipe events.

If you want to use the functionality of both Control and Notification extensions in your app we have posted a tutorial in our blog on Sony Developer World:

http://developer.sonymobile.com/2013/12/26/using-both-the-control-notification-apis-for-customised-uis-in-your-smartwatch-2-extension-code/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top