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.)