Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions app/src/main/java/io/neurolab/main/NeuroLab.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ protected void onCreate(Bundle savedInstanceState) {
intentFilter = new IntentFilter();
// adding the possible USB intent actions.
intentFilter.addAction(ACTION_USB_PERMISSION);
registerReceiver(broadcastReceiver, intentFilter);

appUpdateManager = AppUpdateManagerFactory.create(getApplicationContext());
appUpdateInfoTask = appUpdateManager.getAppUpdateInfo();

Expand Down Expand Up @@ -220,6 +220,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) {
protected void onResume() {
super.onResume();

registerReceiver(broadcastReceiver, intentFilter);
SharedPreferences sharedPreferences =
PreferenceManager.getDefaultSharedPreferences(this);
developerMode = sharedPreferences.getBoolean(DEV_MODE_KEY, false);
Expand Down Expand Up @@ -270,7 +271,6 @@ public void onBackPressed() {
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
} else {
unregisterReceiver(broadcastReceiver);
if (mBackPressed + TIME_INTERVAL > System.currentTimeMillis()) {
super.onBackPressed();
return;
Expand Down Expand Up @@ -418,4 +418,11 @@ public void onClick(View v) {
}
}

@Override
protected void onPause() {
super.onPause();
unregisterReceiver(broadcastReceiver);
}


}