php editor Apple here introduces a very practical application operation method, that is, when the application is closed, the application can be reopened through the foreground service. This method allows the application to keep running in the background so that users can use it at any time. With simple steps, you can easily implement this function. Let’s take a look at the specific operation method!
So I use this code to open another app using my code (android studio, java):
Intent i = getFeatureManager().getMainMenu().getMainActivity().getPackageManager(). getLaunchIntentForPackage(getSettingByName("Launch Package").getSValue()); if (i == null) { return; } getFeatureManager().getMainMenu().getMainActivity().startActivity(i);
and i have foreground service, when my app is running in background and my app is closed, nothing happens, even if my app is closed, how can i make it work
The only thing I've found related to this is that it's not possible when I know it's coming from another app, I have an app that opens on its own and the app is always running in the foreground
To achieve this, we need to add the system_alert_window permission to androidmanifest.xml
As shown below:
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
and accept popups above other apps in android app settings
The above is the detailed content of Open application from foreground service when application is closed. For more information, please follow other related articles on the PHP Chinese website!