diff --git a/app/android/app/src/main/AndroidManifest.xml b/app/android/app/src/main/AndroidManifest.xml index b9449e88..baa30b3b 100644 --- a/app/android/app/src/main/AndroidManifest.xml +++ b/app/android/app/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - + @@ -14,6 +13,8 @@ + + @@ -65,6 +66,21 @@ + + + + + + + + = Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { + // Starting from `Build.VERSION_CODES.UPSIDE_DOWN_CAKE` we can + // no longer start and collapse an Intent. We need to use a + // PendingIntent instead. + // + // The request code can be used to identify the pending intent + // request if needed. We don't, hence the 0. + // + // The launch intent used for the tile doesn't need any data + // thus we mark it as immutable to ensure maximal reuse. + startActivityAndCollapse( + PendingIntent.getActivity(this, 0, launchIntent, + PendingIntent.FLAG_IMMUTABLE) + ) + } else { + // For any version below `Build.VERSION_CODES.UPSIDE_DOWN_CAKE` + // we can simply start the intent directly. + startActivityAndCollapse(launchIntent) + } + } + catch (e:Exception){ + Log.w(this.javaClass.toString(),"Exception $e") + } + } + + private fun getLaunchIntent(): Intent { + // Getting the launch intent from the package manager is the optimal + // way to get the proper intent to launch the app. + val cleanIntent = packageManager.getLaunchIntentForPackage(packageName) + + return if (cleanIntent != null) { + cleanIntent + } else { + // If we can't get the launch intent from the PM, then we default + // back to creating one by instantiating the app intent ourself. + val dirtyIntent = MainActivity.createDefaultIntent(this) + dirtyIntent.flags = Intent.FLAG_ACTIVITY_NEW_TASK + dirtyIntent + } + } + + private fun appIsAlreadyRunning(): Boolean { + val info = ActivityManager.RunningAppProcessInfo() + ActivityManager.getMyMemoryState(info) + return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { + info.importance != ActivityManager.RunningAppProcessInfo.IMPORTANCE_CACHED + } else { + info.importance != ActivityManager.RunningAppProcessInfo.IMPORTANCE_BACKGROUND + } + } +} \ No newline at end of file diff --git a/app/android/app/src/main/res/mipmap-hdpi/ic_launcher_quicktile_foreground.png b/app/android/app/src/main/res/mipmap-hdpi/ic_launcher_quicktile_foreground.png new file mode 100644 index 00000000..511a8610 Binary files /dev/null and b/app/android/app/src/main/res/mipmap-hdpi/ic_launcher_quicktile_foreground.png differ diff --git a/app/android/app/src/main/res/mipmap-mdpi/ic_launcher_quicktile_foreground.png b/app/android/app/src/main/res/mipmap-mdpi/ic_launcher_quicktile_foreground.png new file mode 100644 index 00000000..6e815943 Binary files /dev/null and b/app/android/app/src/main/res/mipmap-mdpi/ic_launcher_quicktile_foreground.png differ diff --git a/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_quicktile_foreground.png b/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_quicktile_foreground.png new file mode 100644 index 00000000..a8b331d2 Binary files /dev/null and b/app/android/app/src/main/res/mipmap-xhdpi/ic_launcher_quicktile_foreground.png differ diff --git a/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_quicktile_foreground.png b/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_quicktile_foreground.png new file mode 100644 index 00000000..dcfbcc31 Binary files /dev/null and b/app/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_quicktile_foreground.png differ diff --git a/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_quicktile_foreground.png b/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_quicktile_foreground.png new file mode 100644 index 00000000..be7d6d09 Binary files /dev/null and b/app/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_quicktile_foreground.png differ diff --git a/app/assets/img/logo-512-white.png b/app/assets/img/logo-512-white.png new file mode 100644 index 00000000..865f4565 Binary files /dev/null and b/app/assets/img/logo-512-white.png differ