From bc5bdd1acb69d889479d2840a83a755bd8267be6 Mon Sep 17 00:00:00 2001 From: Frank Zhang <923487922@qq.com> Date: Mon, 16 Mar 2020 15:25:12 +0800 Subject: [PATCH] Use the Setting static Varibles to fix " app wasn't found in the installed app list " error. --- .../wearable/wear/wearnotifications/MainActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Notifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/MainActivity.java b/Notifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/MainActivity.java index ae3241142..808dc7ce7 100644 --- a/Notifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/MainActivity.java +++ b/Notifications/Application/src/main/java/com/example/android/wearable/wear/wearnotifications/MainActivity.java @@ -21,6 +21,7 @@ import android.graphics.BitmapFactory; import android.os.Build; import android.os.Bundle; +import android.provider.Settings; import android.util.Log; import android.view.View; import android.widget.AdapterView; @@ -858,9 +859,8 @@ private void generateMessagingStyleNotification() { private void openNotificationSettingsForApp() { // Links to this app's notification settings. Intent intent = new Intent(); - intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); - intent.putExtra("app_package", getPackageName()); - intent.putExtra("app_uid", getApplicationInfo().uid); + intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); + intent.putExtra(Settings.EXTRA_APP_PACKAGE, getPackageName()); startActivity(intent); } }