Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Different results when using package param to start app #151

Open
StepM1997 opened this issue Sep 28, 2020 · 7 comments
Open

Different results when using package param to start app #151

StepM1997 opened this issue Sep 28, 2020 · 7 comments

Comments

@StepM1997
Copy link

I have an old application which use package name to check app and start app. I found that some apps can be started with package and some are not. For example,

In App A, I check the app is installed in the device and start app is succeeded.
In App B, I also check the app is installed but cannot start app and receive android.content.ActiveityNotFoundException: No Activity found to handle Intent ( package name }.

Although I am able to use application and intentstart to start app, what is the reason of above problem?

@lampaa
Copy link
Owner

lampaa commented Sep 29, 2020

@StephenMok1997 Hmm, if you use package for start app, you need add to command name of activity or action because package its not a intent for start app, its only package name. And that to start app with package name, we need to add action with this package, exam:

var sApp = startApp.set({
	"action":"ACTION_MAIN",
	"package":"com.lampa.startapp"
});

But if we need only start app with package name, without action or activity, we need to use parameter application:

var sApp = startApp.set({
	"application":"com.application.name"
}).start();

@StepM1997
Copy link
Author

So any possible reason that some app can start and some app cannot?

@lampaa
Copy link
Owner

lampaa commented Sep 29, 2020

@StephenMok1997 error indicates that the main activity not found in the application (perhaps for <action android: name = "android.intent.action.MAIN" />)! Does the application open through the device interface?

@StepM1997
Copy link
Author

What do you mean by device interface?

@lampaa
Copy link
Owner

lampaa commented Oct 5, 2020

What do you mean by device interface?

Android Launcher

@StepM1997
Copy link
Author

@StephenMok1997 error indicates that the main activity not found in the application (perhaps for <action android: name = "android.intent.action.MAIN" />)! Does the application open through the device interface?

No

@lampaa
Copy link
Owner

lampaa commented Oct 5, 2020

@StephenMok1997 error indicates that the main activity not found in the application (perhaps for <action android: name = "android.intent.action.MAIN" />)! Does the application open through the device interface?

No

So you need to get the package name and the activity name of application for start application, example:

var sApp = startApp.set({
	"component": ["com.app.name","com.app.name.QrScannerActivity"]
}).start();

You can get package name and activity name by decompiling application and looking at its AndroidManifest.xml 👀🤷

@lampaa lampaa added the Android label Oct 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants