Android Wear Need to show notification on wear when the device is getting paired to wear -
please how can show notification on android wear paired device, weather notification google.
thanks
you can implement custom capability on phone. wearable listen capability wearablelistenerservice
: override oncapabilitychanged
. when phone connects wearable, capabilities provided reachable nodes (from watch) updated , oncapabilitychanged called.
see documentation advertise , retrieve capability.
advertise : (res/values/wear.xml) (mobile resources)
<?xml version="1.0" encoding="utf-8"?> <resources> <string-array name="android_wear_capabilities"> <item>my_phone_capability</item> </string-array> </resources>
listen changes on reachable capabilities : (wearablelistenerservice, service declared in manifest intent action bind_listener
)
@override public void oncapabilitychanged(capabilityinfo capabilityinfo) { string mphonenodeid = pickbestnodeid(capabilityinfo.getnodes()); // can check if it's capability want (my_phone_capability) if (mphonenodeid == null) { // phone disconnected } else { // phone connected, send notif } }
Comments
Post a Comment