Before I upgraded to target SDK 34 (Android 14 Upsidedown cake) my app was able to launch an external app from my foreground service using this code:
Intent LaunchApp = getPackageManager().getLaunchIntentForPackage("an.app.package");
startActivity(LaunchApp);
It was that simple and it worked.
Now, Android 14 brings more restrictions. According to this documentation I have to opt-in or something like that but I don't really understand what I have to do. I don't understand where to get that Peding Intent and I don't how to use the method setPendingIntentBackgroundActivityStartMode(MODE_BACKGROUND_ACTIVITY_START_ALLOWED). Can anyone help me with a code snipet to launch an external app from a foreground service in Android 14?