Moved screen off handling to application

This commit is contained in:
M66B
2020-04-01 22:08:54 +02:00
parent 8de80b1755
commit 05e89a0dce
2 changed files with 14 additions and 11 deletions

View File

@@ -24,7 +24,10 @@ import android.app.Notification;
import android.app.NotificationChannel;
import android.app.NotificationChannelGroup;
import android.app.NotificationManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.webkit.CookieManager;
@@ -107,6 +110,8 @@ public class ApplicationEx extends Application {
WorkerWatchdog.init(this);
WorkerCleanup.queue(this);
registerReceiver(onScreenOff, new IntentFilter(Intent.ACTION_SCREEN_OFF));
long end = new Date().getTime();
Log.i("App created " + (end - start) + " ms");
}
@@ -412,4 +417,13 @@ public class ApplicationEx extends Application {
}
});
}
private BroadcastReceiver onScreenOff = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
Log.i("Received " + intent);
Log.logExtras(intent);
Helper.clearAuthentication(ApplicationEx.this);
}
};
}