I want to show a notification only in the wearable app at some time specified by the user.
For testing, I have a BroadcastReceiver in the handheld app that starts a service and shows a notification at that time in both handheld and wearable. I also have a Message Api communication established between handheld and wearable modules. These two parts work fine.
So I don't know if I can send a message via the Message Api when the BroadcastReceiver gets triggered in order to show a notification in the wearable device only. Should I start the GoogleApiClient in the onReceive() method? Or is there any other way to do what I want?
This is my BroadcastReceiver, but I want to change its code:
public class AlarmReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Intent service = new Intent(context, AlarmService.class);
service.putExtra(AlarmService.INTENT_NOTIFY, true);
service.putExtra("alarmID", intent.getIntExtra("alarmID", 0));
context.startService(service);
}
}
Thanks!