Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
215 views
in Technique[技术] by (71.8m points)

android - Different text for the wear device and the mobile device

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.9k users

...