Different text for the wear device and the mobile device

前端 未结 3 1047
灰色年华
灰色年华 2020-12-12 01:11

Is it possible to have a notification that shows a different text (content title and content text) in the Android wear device and in the mobile device?

3条回答
  •  心在旅途
    2020-12-12 01:45

    Not at the moment. However, you can achieve this effect in the following way:

    1. post a notification on the phone with setLocalOnly(true)
    2. post a DataItem using a DataAPI that describes the notification and changed text
    3. when the wearable receives the DataItem, post the notification with different text, again setting setLocalOnly(true)
    4. on each notification alse call setDeleteIntent so you know, when there are dismissed
    5. when on of the notifications gets dismissed, delte the DataItem from point 2.
    6. when the DataItem gets deleted, you will receive a callback; delete the remaining notification

    There might be some corner cases here I don't see immediately, but the general approach should allow you to achieve what you want.

提交回复
热议问题