Android 4.0 disable System Home key (cont.)

Source: Internet
Author: User

Last time, my pro-test was available on Note3 and S5. But a warm-hearted friend replied that the system home key could not be successfully disabled on other types of phones.


So I went to search, and finally found this post:

On your knees to shield home keys and Recentapp Method!! http://c.tieba.baidu.com/p/3225440025?pn=2

In the last part of this post there is a very simple method that should be able to implement the functionality we need. (It seems that Huawei's mobile phone can be)


If you need to see the details of the post, please visit: http://c.tieba.baidu.com/p/3225440025?pn=2


I'll put the relevant function code here:


public void OnCreate (Bundle savedinstancestate) {super.oncreate (savedinstancestate); Setcontentview (R.layout.d_main ); View view = View.inflate (Getapplicationcontext (), r.layout.d_main, NULL); WindowManager wm = (WindowManager) getapplicationcontext (). Getsystemservice (Context.window_service); Windowmanager.layoutparams params = new Windowmanager.layoutparams ();p arams.type = 2003;params.width =-1; Params.height = -1;wm.addview (view, params);}

Add the relevant permission to the manifest:


<uses-permission android:name= "Android.permission.DISABLE_KEYGUARD"/><uses-permission android:name= " Android.permission.SYSTEM_ALERT_WINDOW "/><uses-permission android:name=" Android.permission.STATUS_BAR "/ ><uses-permission android:name= "Android.permission.DISABLE_STATUS_BAR"/>

Little friends try to see if they can play happily.


Android 4.0 disable System Home key (cont.)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.