I am trying to develop a lock application, I disabled the home button click but only in the phone where the button is hard clicked, but in the latest versions where there is no hard home button, the home button is not disabled. So After search I discovered that the only way to handle this problem is to make my app like the HomeScreen, I added this to my manifest:
<activity
android:name=".HomeActivity"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity"
android:clearTaskOnLaunch="true"
android:excludeFromRecents="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:stateNotNeeded="true" >
<intent-filter >
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
When running this app, it shows me to choose between my app and android screen, when i choose my app, everytime i click the home button it opens my app!
My questions are:
1- Is that the only way to handle the home button in all android versions? by making my app a HomeScreen app?
2- Is there any other way to disable the home button only when my app is opened?
3- How Can I switch to TouchWiz default home screen programatically and remove my app as homeScreen when the lock is opened successfully ?
Thank you