How to Disable the Home Key in APK and Activity: Difference between revisions

From wizarPOS
No edit summary
(Replaced content with "{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/other-development/disable-home-key}}")
Tag: Replaced
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
== Disable Home Key in APK ==
{{Migrating|https://smartpossdk.gitbook.io/cloudpossdk/faq/other-development/disable-home-key}}
* Defines the following permission, the third-party app will get the event of home key or back key.
* Catches the event when the home key or back key is pressed.
=== Permission ===
  android.permission.CLOUDPOS_DISABLE_HOME_KEY
The app declares the permission in manifest.
 
== Disable Home Key in activity ==
Defines the following permission, then sets the activity window type is TYPE_KEYGUARD or TYPE_KEYGUARD_DIALOG, the third-party app will catch the event when the home key or back key is pressed.
For example:
<syntaxhighlight lang="java">
public void onAttachedToWindow() {                                     
super.onAttachedToWindow();                                         
try {                                                               
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
} catch (Throwable e) {                                             
e.printStackTrace();                                               
}                                                                    
}                                                                     
 
</syntaxhighlight >
=== Permission ===
  android.permission.CLOUDPOS_DISABLE_HOME_KEY_IN_ACTIVITY
The app declare the permission in manifest.

Latest revision as of 03:24, 8 April 2024

Please visit new link of same subject:

https://smartpossdk.gitbook.io/cloudpossdk/faq/other-development/disable-home-key

We're making a move! Our site's content is migrating to a new URL, to provide you with an enhanced browsing experience. Please update your bookmarks accordingly. Thank you for your continuous support!