All I want is to block home button when my app is running
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.LAUNCHER" >
</category>
</intent-filter>
I have written the above code in manifest when i start my app for the first time and i press home button it ask me to set my app or default mobile app to be set as default for home.. Once i select the default something other than my app and check the always checkbox.. The next time I start my app this dialog box never appears..
public void onAttachedToWindow() {
window.setType(LayoutParams.TYPE_KEYGUARD|LayoutParams.FLAG_FULLSCREEN|LayoutParams.FLAG_LAYOUT_IN_SCREEN|LayoutParams.FLAG_KEEP_SCREEN_ON);
super.onAttachedToWindow();
}
Do not work in Android 4.0 and above