1

I am working on an android application ,if user install the application,that application has to open when user click hardware menu button .and default hardware menu options should hide (settings,search,createfolder,editpage...).when user uninstall that application then default menu options has to replace.is it possible to access the application please suggest me.thanks in Adavance.

  • I'm not sure. Do you want your aplpicant to be added automatically to the list of "last application" or if the user click on the menu hardware button? – Seraphim's May 28 '13 at 13:37
  • after installing the apps ,when user click hardware button that apps should open by hiding default menu options like (settings,search.......) – user2126175 May 28 '13 at 13:42

2 Answers2

0

So you want to override the standard menu hardware button behaviour. This is not a standard way and I suppose that Android will not let you change the button behaviour outside your app. Maybe if you code your own "home application" (i.e. the application that will be launched as launcher for other app).

In that case look at:

How can I create a custom home-screen replacement application for Android?

Community
  • 1
  • 1
Seraphim's
  • 12,559
  • 20
  • 88
  • 129
0

Android does not allow you to do that. The closest you can get to is by creating your own launcher. This will cause your app's activity to be called every time the user clicks the "Home" button, but keep in mind that whatever activity you decide to show, has to give the user the ability to launch other apps how the default Android launcher would.

Just add the following to the <intent-filter> element in your activity's element in the app's manifest:

<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />

So your manifest will look something like:

<?xml version="1.0" encoding="utf-8"?>

 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.son1c.launcher"
  android:versionCode="1"
  android:versionName="1.0">

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".MainActivity"
              android:label="@string/app_name">

        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
            <category android:name="android.intent.category.HOME" />
            <category android:name="android.intent.category.DEFAULT" />
        </intent-filter>

    </activity>
</application>
</manifest>

Again, I do not recommend this, since you will have to create an entirely new launcher.

AxiomaticNexus
  • 6,190
  • 3
  • 41
  • 61