From 5467941d455afd7c8fc41c303562a0095a82acec Mon Sep 17 00:00:00 2001 From: Eric House Date: Mon, 17 Dec 2018 08:26:39 -0800 Subject: [PATCH] start stuff when package replaced And: Don't start the foreground service with its user-visible notification, as that's too obtrusive and the ACL_CONNECTED stuff seems to work well enough. Launching timers on a new install is mostly for my own dev use, but won't hurt user experience either. --- .../android/app/src/main/AndroidManifest.xml | 1 + .../eehouse/android/xw4/OnBootReceiver.java | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/xwords4/android/app/src/main/AndroidManifest.xml b/xwords4/android/app/src/main/AndroidManifest.xml index d50e00959..1538192f8 100644 --- a/xwords4/android/app/src/main/AndroidManifest.xml +++ b/xwords4/android/app/src/main/AndroidManifest.xml @@ -115,6 +115,7 @@ + diff --git a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OnBootReceiver.java b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OnBootReceiver.java index 75525e924..c57636ce8 100644 --- a/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OnBootReceiver.java +++ b/xwords4/android/app/src/main/java/org/eehouse/android/xw4/OnBootReceiver.java @@ -30,12 +30,18 @@ public class OnBootReceiver extends BroadcastReceiver { @Override public void onReceive( Context context, Intent intent ) { - if ( null != intent - && null != intent.getAction() - && intent.getAction().equals( Intent.ACTION_BOOT_COMPLETED ) ) { - Log.d( TAG, "got ACTION_BOOT_COMPLETED" ); - startTimers( context ); - BTService.onAppToBackground( context ); + if ( null != intent ) { + String action = intent.getAction(); + Log.d( TAG, "got %s", action ); + switch( action ) { + case Intent.ACTION_BOOT_COMPLETED: + case Intent.ACTION_MY_PACKAGE_REPLACED: + startTimers( context ); + // Let's not put up the foreground service notification on + // boot. Too likely to annoy. + // BTService.onAppToBackground( context ); + break; + } } }