Wednesday, 15 May 2013

android - Using the display intent on a page of a wearable notification -



android - Using the display intent on a page of a wearable notification -

i create wearable compatible notification sec page should embedd custom activity (on wearable).

here relevant part of manifest wearable app:

class="lang-xml prettyprint-override"><activity android:name=".test" android:label="aaa" android:allowembedded="true" android:taskaffinity="" android:theme="@android:style/theme.devicedefault.light"> <intent-filter> <action android:name="android.intent.action.main"/> <category android:name="android.intent.category.launcher"/> </intent-filter> </activity>

here related android code phone:

intent notificationintent = new intent(); notificationintent.setclassname(buildconfig.application_id, buildconfig.application_id + ".wear.main"); pendingintent notificationpendingintent = pendingintent.getactivity(this, 0, notificationintent, pendingintent.flag_update_current); bitmap bg = bitmapfactory.decoderesource(getresources(), r.drawable.bg_wearable); notification test = new notificationcompat.builder(this) .setautocancel(true) .setsmallicon(r.drawable.ic_launcher) .setcontenttitle("title") .setcontenttext("message") .extend(new notificationcompat.wearableextender() .setbackground(bg) .addpage(new notificationcompat.builder(this) .setcontenttitle("page 1") .extend(new notificationcompat.wearableextender() .setdisplayintent(notificationpendingintent) .setcustomsizepreset(notificationcompat.wearableextender.size_full_screen) ).build() ) ) .build(); notificationmanagercompat.from(this).notify(12345, test);

do have thought why don't work on phone, on wearable itself?

you can create , issue custom notifications embedded activities wearable itself.

from docs:

you can create , issue custom notifications on wearable, , scheme not sync these notifications handheld.

source

android android-activity android-notifications android-wear

No comments:

Post a Comment