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

support for getLaunchIntentForPackage #2

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ bin
build
*.zip
.apt_generated

/.project

/.settings/

/.settings
/build.properties
libs/
1 change: 1 addition & 0 deletions manifest
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
version: 1.0
apiversion: 2
architectures: armeabi armeabi-v7a x86
description: Packagemanager
author: Timan Rebel
license: The MIT License (MIT)
Expand Down
15 changes: 15 additions & 0 deletions src/nl/rebelic/packagemanager/PackagemanagerModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,20 @@ public boolean isIntentAvailable(IntentProxy intentProxy) {
private boolean isSystemPackage(PackageInfo pkgInfo) {
return ((pkgInfo.applicationInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0) ? true : false;
}

/**
* Returns a "good" intent to launch a front-door activity in a package. This is used, for example, to implement an "open" button when browsing through packages. The current implementation looks first for a main activity in the category CATEGORY_INFO, and next for a main activity in the category CATEGORY_LAUNCHER. Returns null if neither are found.
* @param packageName The name of the package to inspect.
* @return
*/
@Kroll.method
public IntentProxy getLaunchIntentForPackage(String packageName) {
Intent intent = TiApplication.getAppRootOrCurrentActivity().getPackageManager().getLaunchIntentForPackage(packageName);
if(intent != null) {
return new IntentProxy(intent);
}
return null;

}
}