Using broadcast receiver android to close app
问题 Hi am trying to use broadcast receiver to trigger some action Activity A will broadcast action "ACTION_EXIT" and come to Main Activity. Whenever Main Activity receive the broadcast "ACTION_EXIT" it will close the app. My code on Activity A (to send broadcast) Intent broadcastIntent = new Intent(Beacon_MainActivity.this, MainActivity.class); broadcastIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); broadcastIntent.setAction("com.package.ACTION_EXIT"); sendBroadcast(broadcastIntent); finish();