简体   繁体   English

自定义锁屏实现技术

[英]Custom Lock Screen Implementation Techniques

So, I have been exploring many similar questions across website ( this , this and this and many more). 所以,我一直在网站上探索许多类似的问题( 这个这个这个以及更多)。 People wanting to implement their own custom lock screen (not talking about widgets). 人们想要实现自己的自定义锁定屏幕(不是谈论小部件)。 So far there have been two implementation techniques which users are using. 到目前为止,用户正在使用两种实现技术。

  1. Home Screen Replacement . 主屏幕更换 In this technique its suggested to create a home screen application, where after unlock logic the default screen shows up. 在这种技术中,它建议创建一个主屏幕应用程序,在解锁逻辑后,默认屏幕显示。 I believe that in this situation developer has to disable Home, Search, Menu and Back button when the lock screen is visible and to implement the Screen off-on logic. 我相信在这种情况下,开发人员必须在锁定屏幕可见时禁用“主页”,“搜索”,“菜单”和“返回”按钮,并实现屏幕关闭逻辑。

  2. An application . 一个申请 In this technique a normal app is made where after unlock logic the default screen shows up. 在这种技术中,制作了一个普通的应用程序,在解锁逻辑之后显示默认屏幕。 I believe that in this situation developer has to disable Home, Search, Menu and Back button when the lock screen is visible and to implement the Screen off-on logic. 我相信在这种情况下,开发人员必须在锁定屏幕可见时禁用“主页”,“搜索”,“菜单”和“返回”按钮,并实现屏幕关闭逻辑。

Now, I don't understand that what is the difference between two approaches? 现在,我不明白两种方法有什么区别? StackOverflow community seems to stress more on the home screen replacement technique. StackOverflow社区似乎更多地关注主屏幕替换技术。 I am very new to Android development so I might be missing some aspect about it. 我对Android开发很陌生,所以我可能会错过一些关于它的方面。 Please suggest that which approach should I use and why? 请建议我应该使用哪种方法,为什么? (also, which is easy?). (也很容易?)。

Thanks so much! 非常感谢!

I would use the first method, but only for usability reasons. 我会使用第一种方法,但仅出于可用性原因。 Because it gives the user a choice to easily revert back to the original homescreen/lockscreen if he chooses not to make the new one a default choice yet. 因为它让用户可以选择轻松恢复到原来的主屏幕/锁屏,如果他选择不使新的主屏幕/锁屏成为默认选择。

I'm afraid both strategies you described are quite difficult (depending on the api level range you want it to work on). 我担心你描述的两种策略都很困难(取决于你想要它的api级别范围)。 The difficulty is not in their difference, the difficulty is in overriding the buttons (as Google makes it more difficult by closing down security loopholes for the newer api levels). 困难不在于他们的区别,困难在于压倒按钮(因为谷歌通过关闭新的api级别的安全漏洞使其变得更加困难)。

PS: Please note that Jellybean has a new Daydream functionality. PS:请注意Jellybean有一个新的Daydream功能。 If customizing the lockscreen is all you need. 如果您需要自定义锁屏。 That may be the way to go since Jellybean is much more secure in that respect and more difficult to work with than the previous api levels otherwise. 这可能是要走的路,因为Jellybean在这方面更加安全,并且比以前的api水平更难以使用。

Also, consider using the HTC screenlock api for HTC devices. 另外,请考虑将HTC screenlock api用于HTC设备。 This way, your solution won't be too hacky at least for their newer devices. 这样,您的解决方案至少对于他们的新设备来说不会太苛刻。 And perhaps, do a version for rooted devices as well, since that too should be easy, for users who already have obtained root on their device. 也许,为root设备做一个版本,因为对于已经在设备上获得root权限的用户来说,这也应该很容易。 Don't discount the rooted market, users with root access do spend a disproportionate amount of money on applications in Google Play. 不要打折根源市场,具有root访问权限的用户确实在Google Play上的应用程序上花费了不成比例的金钱。 That much is obvious if you just take a look at some of the rough numbers of downloads for paid applications that say (for root only) that Google Play gives you. 如果您只是查看Google Play为您提供的付费应用程序(仅限root用户)的大量下载量,那么这一点很明显。

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

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