about handle the home key

by » Tue, 10 Aug 2010 04:29:02 GMT

Sponsored Links
 I'm working on a slide-unlock program and I want it take the place of
Android KeyguardLock.

there is one last thing todo.it's the home key.

I google it and found we cannnot handle it as the other keys with
"onkeydown","dispatchkeyevent" method.

so I add this
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
to activity.

It does works on AVD!
I think Android receive "home" intent when home key is pressed ,then
it try to find someone to handle the intent.it found two can handle
this.And one of the two happens to my program and my program is on.so
it send the intent to my program .So,the home key is disabled when my
program is running.

But,it does not work on a samsung true phone!!
what can I do,is there any other way to make it??

Simon Lee


about handle the home key

by dan raaka » Thu, 12 Aug 2010 00:22:31 GMT

 can you post
$ adb shell getprop | grep finger
on the device you are trying ..



Sponsored Links

about handle the home key

by Mathias Lin » Thu, 12 Aug 2010 00:53:19 GMT

 I do the same on a Samsung Galaxy S with 2.1update1 and 2.2 without a
problem. The approach you described is correct.
My intent filter looks similar:

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

When you press the home button first, you should get a dialog where to
choose the home application to use, which is where the user can
optionally tick a checkbox to set the selected app as the default home
screen, so that the dialog won't show again.
So, this dialog only comes up on the emulator but never appeared on
your real phone?


about handle the home key

by 鏉庡疄 » Fri, 13 Aug 2010 09:19:34 GMT

 thank you for help,but you may mistake me.
what I really want to do is to disable the home key,when my activity
is running .
and the code in the  xml is my attempt.
when home is pressed,then android probably sent an intent "home".
in my activity,android find it has "HOME" category,so it does
nothing,so the home key is "disabled" .
As i wrote,it works in AVD but not in a SAMSUMG phone.

I wonder if there is other way to kick the goal.

2010/8/12 Mathias Lin <m...@mathiaslin.com>


about handle the home key

by Mathias Lin » Fri, 13 Aug 2010 23:48:02 GMT

 You cannot disable the home button via SDK. See
 http://www.mail-archive.com/android-developers @googlegroups.com/msg52244.html

> >

about handle the home key

by 鏉庡疄 » Sat, 14 Aug 2010 00:49:19 GMT

 hank for response.
but in fact ,some android apps like 'wave scure' and 'Toddler Lock'
already did this!
and I haven't tried "lock 2.0", it probably "disable" too.

so I think there must be some method and I'm seeking.

2010/8/13 Mathias Lin <m...@mathiaslin.com>:
>> >

about handle the home key

by Indicator Veritatis » Mon, 16 Aug 2010 09:24:52 GMT

 hey did it by cheating, e.g., not relying on a publicly documented
API in the SDK. Don't do this.

After all, not only is is really poor UI design, but when you stray
outside the publicly documented API, you are using unsupported
features which may change or disappear in the next release of Android.

And yes, it is really poor UI design. The user EXPECTS the home key to
work -- just as it does in the overwhelming majority of Android apps,
whether Google or third party.

On Aug 13, 9:49am, <lishi1...@gmail.com> wrote:
> >> >

about handle the home key

by 鏉庡疄 » Mon, 16 Aug 2010 11:19:11 GMT

 hank you for response.
yes,they cheated.

before 2.1,there is an easy way do disable "home" user the "packagemanager",
set the default home intent handler to the special activity.
so when home is pressed ,android does nothing.

but in later version of android ,it's not useful any more.

I think we will never know what users expect.
And there must be some users who want to replace the default keyguard.
so they want "home" key to be disabled.
it's just one example.
also the status bar can't be disabled too.I wonder why.
statusbarmanager is not open to developers.

anyhow,I still want to "cheat" to disabled the "home",any way?

thanks again!!

2010/8/16 Indicator Veritatis <mej1...@yahoo.com>:
>> >> >

about handle the home key

by Frank Weiss » Mon, 16 Aug 2010 12:51:51 GMT

 I assume you intend to have people download this app from the Android
Market. If so, what's to keep ANY Android app on Market from disabling
the Home key?


Other Threads

1. Google Blog Article: A Sneak Peek of Android 3.0, Honeycomb

Take a look at this article:



2. Revolutionary Alternative to Eclipse and Android SDK

For those people wishing to avoid the steep learning curve involved
with programming for Google Android smartphones and tablets, the
MobiForms Developer tool makes it possible for both novice and
experienced programmers alike to quickly create mobile business apps.
In one compact tool MobiForms replaces the need to download and learn
Eclipse, the Android SDK, Java and XML. Additionally, the same apps
can be run on other platforms like Windows Mobile.

The latest version of the revolutionary mobile development tool
MobiForms 5.03 now offers support for the Google Android camera and
GPS integration with commands to read longitude and latitude, or
actual location addresses. These features are ideal for adding photos
to inspection reports and location capture to field service or lone
worker apps.

The MobiForms Developer can be used standalone or with the MobiForms
Sync Server as part of the MobiForms Advanced Edition. The MobiForms
Sync Server enables bi-directional data replication, synchronisation
and offline buffering between just about any master back office
database server or ERP package (such as Oracle Apps, SAP, Navision,
Dynamics etc.), and any MobiForms mobile client running on Google
Android or a host of other mobile platforms such as Windows Mobile.
Supported back office database servers include Oracle, SQL Server,
Access, Sybase, IBM DB2, SQLite, HSQLDB and MySQL.

MobiForms offers all the tools in one "box" for the creation and
deployment of any type of mobile application - from surveys to field
service, from signature capture to bar coding.

Unlike most competing products, MobiForms offers a total solution for
a once off licence fee. The licence includes an unlimited number of
MobiForms mobile clients running on Tablet PC, Pocket PC, Windows CE,
Windows Mobile, Windows Smartphone, Symbian and now Google Android.

MobiForms for Google Android can be downloaded from the MobiForms web
site at: http://www.mobiforms.com.


3. Making a video of your app running

4. Open Source code into Eclipse

5. ADB & New Devices

6. Please help with Bitmap issue. I have screen shots!?!

7. Not Able to Browse Internet and Google Map on Emulator