I'm trying to make simple Login App using firebase as a backend, but I stuck on a problem that how to prevent user to go back on previous activities. So when I searched then I got the solution from here. But this time my app is running properly without any issue or crash but Logcat is saying to unregister the Broadcast Receiver.So I go through the Android official docs but I'm unable to do that. So please anyone help me out. The code has been given below.
Thanks in advance.
CODE FOR SENDING BROADCAST
Intent broadcastIntent = new Intent();
broadcastIntent.setAction("com.android.login.ACTION_LOGOUT");
sendBroadcast(broadcastIntent);
CODE FOR RECEIVING BROADCAST
IntentFilter intentFilter = new IntentFilter();
intentFilter.addAction("com.android.login.ACTION_LOGOUT");
registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.d("onReceive","Logout in progress");
//At this point you should start the login activity and finish this one
finish();
}
},intentFilter);