I'm wondering if it is possible to send notification from handheld (android phone) to wear device to open Activity on wear device? What I want to do is as following.
So far, I checked the following documents, but it's different from what I want to do.
Any ideas?
An app notification is a message or alert sent by an application to the device user. They include push notifications and in-app notifications.
You should make sure your device battery has power and your device is connected properly to the app. Your app must be running in the background for notifications to properly work. If the problem persists you may unpair your device from the phone and pair it again.
Allows easier control over all the flags, as well as help constructing the typical notification layouts. On platform versions that don't offer expanded notifications, methods that depend on expanded notifications have no effect. For example, action buttons won't appear on platforms prior to Android 4.1.
The pattern to use for this is:
WearableListenerService
and listen for onDataChanged
events.DataItem
, create a notification (with the data sent in the DataItem
) and send it locally (i.e. on the wearable). Use setContentIntent()
on the notification to specify a pending intent that will launch your wearable activity.DataItem
can be removed. Otherwise, you will not receive any update events.I've created a sample project that shows all of this in action.
Check out this question if the onDataChanged
method is not getting called.
I think in most cases it would be better to include your app activity inside the notification. For example, instead of the "Open" button in your notification, you could use setDisplayIntent(notificationPendingIntent) to display an activity as part of the notification as described here: http://developer.android.com/training/wearables/apps/layouts.html
This gives you a best of both worlds situation between having an app and a notification.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With