2

hey i want to make an Application which will start when the phone will start, which i am able to do so but my problem is to disable the "Home Button" & "Back Button" on start up an it should only be enable when i click an button on my activity which will be the home screen on start up, please help me out..

Chintan Khetiya
  • 15,962
  • 9
  • 47
  • 85
surya
  • 109
  • 1
  • 4
  • 13

1 Answers1

8

You have to make an intent-filter for BOOT_COMPLETED. You can get the tutorials from here and here

To disable HOME and BACK

Lets se... If your app is running and visible to user then you can do that by using the following code

@Override
public boolean onKeyDown(int keyCode, KeyEvent event)  {
    if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.ECLAIR
        && (keyCode == KeyEvent.KEYCODE_BACK    || keyCode == KeyEvent.KEYCODE_HOME)
    && event.getRepeatCount() == 0) 
    {
        onBackPressed();
    }
    return super.onKeyDown(keyCode, event);
}

@Override
public void onBackPressed() {
    // Do nothing
    return;
}

But if your app is not running then it is not possible for you to do that how ever you can make your custom launcher in that wey you can decide weather to show the screen or not

OR

You can disable the home key check here

Community
  • 1
  • 1
Girish Nair
  • 5,148
  • 5
  • 40
  • 61