Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
213 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 Reply

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...