I recently added some shortcuts to my app. The app is working fine, and the Static Shortcuts are shown as expected:
However, when I do click on any of them, I'm getting the following error that prevents the app to be launched:
Application isn't installed
These are my XMLs:
AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="tk.supernova.tmtimer.tk.supernova.tmtimer" android:versionName="2.1.0.0" android:installLocation="auto" android:versionCode="320">
<uses-permission android:name="android.permission.READ_OWNER_DATA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_OWNER_DATA" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="com.android.vending.BILLING" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30" />
<application android:theme="@style/Launcher" android:icon="@drawable/icon" android:label="@string/app_name" android:requestLegacyExternalStorage="true">
<activity android:name="tk.supernova.tmtimer.MainActivity" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<meta-data android:name="android.app.shortcuts" android:resource="@xml/shortcuts" />
</activity>
</application>
</manifest>
shortcuts.xml
<?xml version="1.0" encoding="UTF-8" ?>
<shortcuts
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
tools:targetApi="25">
<shortcut
android:shortcutId="time1"
android:enabled="true"
android:icon="@drawable/timeline_clock_outline"
android:shortcutShortLabel="@string/Time1"
android:shortcutLongLabel="@string/Time1">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="tk.supernova.tmtimer.tk.supernova.tmtimer"
android:targetClass="tk.supernova.tmtimer.MainActivity">
<extra
android:name="customTime"
android:value="30;45;60" />
</intent>
<categories android:name="android.shortcut.conversation" />
</shortcut>
<shortcut
android:shortcutId="time2"
android:enabled="true"
android:icon="@drawable/timeline_clock_outline"
android:shortcutShortLabel="@string/Time2"
android:shortcutLongLabel="@string/Time2">
<intent
android:action="android.intent.action.VIEW"
android:targetPackage="tk.supernova.tmtimer.tk.supernova.tmtimer"
android:targetClass="tk.supernova.tmtimer.MainActivity">
<extra
android:name="customTime"
android:value="300;360;420" />
</intent>
<categories android:name="android.shortcut.conversation" />
</shortcut>
</shortcuts>
This is an intro to the MainActivity
class:
namespace tk.supernova.tmtimer
{
[Activity(Label = "@string/app_name", MainLauncher = true, WindowSoftInputMode = SoftInput.AdjustPan)]
public partial class MainActivity : AppCompatActivity
{
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
Platform.Init(this, savedInstanceState);
var context = Platform.AppContext;
var activity = Platform.CurrentActivity;
SetTheme(Resource.Style.MyBaseTheme_NoActionBar);
SetContentView(Resource.Layout.Main);
I know that my package name (tk.supernova.tmtimer.tk.supernova.tmtimer
) is different from the main namespace (tk.supernova.tmtimer.tk.supernova.tmtimer
). I also tried
to use {applicationId}
, but it didn't work. I have also checked several ideas in Stack, and none of them worked in my case. Furthermore, I cannot easily change the "wrong package name" because the app has been published in the Play Store for around 3 years.
Also, I am sure the package name is correct:
Any idea what am I doing wrong?
P.S.:
I'm testing in an emulator running Android 11.