Question

Since we´re going to use phones for public use I want an app to be launched when the phone booted. Than by filling in a code the correct activity should be started without the user being able to get into the ´phone´ software (OS). Is it possible to overwrite all the phonebuttons, so the user won´t go to the homescreen eg, if yes, which methods are called? Thanks

Was it helpful?

Solution

The Android API documentation can also show you many things.

http://developer.android.com/reference/android/app/Activity.html

You will want to make sure you cover for every part of the activity life-cycle as well as override any methods that will cause behavior you don't want (ie. button presses).

It would also be smart to look through the intents thrown by the Android OS.

http://developer.android.com/reference/android/content/Intent.html

This way you can catch any unexpected events. Knowing the platform you are working with can also help. Some Manufacturers have phones that provide specific API's (can be download from manufacturers websites) as well as hardware buttons. You should also account for this if you are trying to make a locked system.

OTHER TIPS

You can override the back button default behaviour by adding these lines in your activities:

@Override
public void onBackPressed() {
    // do nothing
}

(The default behaviour is to call finish() on the current activity: if you do the above, you remove this finish() call).

Overriding the home button is a little bit more complicated: look at these questions:

Can I override the 'Home' button in my application?

Android Overriding home key

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top