For a Google Glass App, how do you make you app gracefully exit on a downswipe to the main glass menu?
Trying this code in MainActivity:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (getIntent().getBooleanExtra("EXIT", false)) { finish(); return; } } @Override public boolean onKeyDown(int keycode, KeyEvent event) { if (keycode == KeyEvent.KEYCODE_BACK){ Intent intent = new Intent(MainActivity.this, MainActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.putExtra("EXIT", true); startActivity(intent); } return false; }
This doesn't seem to "exit" a Google Glass app. This may work for Android apps but this causes a Glass app to enter a weird state where a blank screen is shown permanently. I want to "exit" and see the main Google glass interface or exit the app and put the glass into it's default sleep mode.