H
H
hyc122021-02-18 17:30:25
Android
hyc12, 2021-02-18 17:30:25

How to launch an application from a service if another one is currently running?

It is necessary to implement remote control of the device. Created a service that runs the application. Everything works if it is my activity that is running, but when I go to the desktop or another application, the service sends a start message to the log, but nothing happens.
Application launch:

private void startAct() {
        Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.android.settings");
        if (launchIntent != null) {
            Log.d(this.toString(), "open settings");
            startActivity(launchIntent);
        }
    }

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question