2

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

eng
  • 83
  • 1
  • 9

1 Answers1

2

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/

mldeveloper
  • 2,253
  • 1
  • 13
  • 14
  • Hi Marlin, is it possible to use both notification and control extension in one application in SmartWatch 1?I saw in the documentation on API compatibility notes for original SmartWatch that it is not recommended to use both because it will not be possible to specify what happens when a user taps the application icon. In that solution(from your links that you gave), the example was in SmartWatch2. I wonder if it is also working in SmartWatch 1. – eng Oct 31 '13 at 07:12