want to open the setting of the device when i click on the home button in the device i tried this code but when the app start its open the device setting automatically
@Override
public void onAttachedToWindow() {
super.onAttachedToWindow();
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD);
startActivityForResult(new Intent(android.provider.Settings.ACTION_SETTINGS), 0);
}
how to make this code open the setting of the device when the home key button clicked only ?