开发者

How to refresh existing Statusbar notification messages when locale is changed

开发者 https://www.devze.com 2023-01-14 16:15 出处:网络
Please let me know how to resolve this problem. Statusbar notification messages are shown in X language even after locale language is changed fromX to Y.Please help me what needs to be done to refres

Please let me know how to resolve this problem.

Statusbar notification messages are shown in X language even after locale language is changed from X to Y.Please help me what needs to be done to refresh it. Eg: Even after changing locale lang from En to Ja , statusbar notification messages are shown in En only i.e The application which is sending statusbar notification is run fi开发者_开发百科rsttime in En language .

Thanks Venugopal


In theory, this should work:

Step #1: Register a BroadcastReceiver in your manifest, watching for ACTION_LOCALE_CHANGED.

Step #2: When your BroadcastReceiver is called with onReceive(), cancel() and re-raise your Notification, if your Notification is on-screen.

The catch is that you will need to know whether your Notification is on-screen or not. That is not very straight-forward. You can try the technique outlined in this StackOverflow answer, though I have not tried that technique personally. I have filed an issue requesting an isActive() method for NotificationManager, or the equivalent, to help fill this gap.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号