Question

I am trying to build a kind of custom lockscreen.

In order to achieve that I need to disable the HOME button.

From this post I understand that I can achieve that by declaring my Activity as a Launcher.

Please how do I do that? (it is in the Manifest obviously) This is the Manifest. The Activity that "acts" as a lockscreen is LockScreen

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.appengine.paranoid_android.lost"
android:versionCode="2"
android:versionName="1.1" >

<application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
        android:name=".InfoSetup"
        android:clearTaskOnLaunch="true"
        android:label="@string/activity_name"
        android:launchMode="singleTask" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
    <activity
        android:name=".LockScreen"
        android:clearTaskOnLaunch="true"
        android:label="@string/activity_name"
        android:launchMode="singleInstance"
        android:theme="@android:style/Theme.NoTitleBar" >
        <service
            android:name=".InfoService"
            android:label="@string/service_name" />

        <receiver android:name="com.appengine.paranoid_android.lost.BootCompleteReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.PACKAGE_ADDED" />
                <action android:name="android.intent.action.PACKAGE_CHANGED" />
                <action android:name="android.intent.action.PACKAGE_REMOVED" />

                <data android:scheme="package" />
            </intent-filter>
        </receiver>
    </activity>
</application>

<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />
<!-- <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/> -->
<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="17" >
</uses-sdk>

Was it helpful?

Solution

Move the intent filter to your activity

<activity
    android:name=".LockScreen"
    android:clearTaskOnLaunch="true"
    android:label="@string/activity_name"
    android:launchMode="singleInstance"
    android:theme="@android:style/Theme.NoTitleBar" >

    <intent-filter>
        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
</activity>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top