简体   繁体   English

对于Android 4.2:如何以编程方式为应用程序启用锁屏小部件

[英]For Android 4.2: How to enable lock screen widget for application programmatically

As there is an exciting feature in Android 4.2 to place app widget on Lock-Screen. 由于Android 4.2中有一项令人兴奋的功能,可以将应用程序小部件放置在锁屏上。 I have implemented it for my app, but I have to choose my widget to enable it on lock screen. 我已经为我的应用实现了它,但是我必须选择我的小部件以在锁定屏幕上启用它。

But I want to enable and disable widget from my app. 但是我想从我的应用程序启用和禁用小部件。 That is, if user click on check-box then automatically widget for that app should enable on lock-screen and is user un-check then automatically widget will disable from lock-screen. 也就是说,如果用户单击复选框,则该应用程序的小部件将自动在锁定屏幕上启用,而用户取消选中则自动将小部件从锁定屏幕禁用。

please help me. 请帮我。

For folks finding this via Google, there are some workarounds that may work for you or may not, depending on your specific Android configuration. 对于通过Google发现此问题的人来说,有一些变通办法可能对您有用或不起作用,这取决于您的特定Android配置。 (See also this question and this question .) (另请参阅此问题此问题 。)

As CommonsWare pointed out, beginning with Android 5.0, a media style notification can be dynamically added to the lock screen. 正如CommonsWare指出的那样,从Android 5.0开始,可以将媒体样式通知动态添加到锁定屏幕。

This is not possible. 这是不可能的。 The user is welcome to add your lockscreen widget if the user chooses to, from the lockscreen. 如果用户选择从锁屏添加锁屏小部件,则欢迎该用户添加。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM