-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathlaunch().txt
50 lines (45 loc) · 1.52 KB
/
launch().txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import android.content.Intent;
import android.app.Activity;
import android.content.pm.PackageManager;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import java.util.List;
Activity act;
PackageManager pm;
ApplicationInfo packageInfo;
int i;
void setup() {
size(displayWidth, displayHeight); background(0, 0, 200);
textAlign(CENTER);
String str = "Click to launch Chrome.";
textSize(12);
float twf = width/textWidth(str);
textSize(8*twf);
text(str, width/2, height/2);
act = this.getActivity();
pm = act.getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo packageInfo : packages) {
if (pm.getLaunchIntentForPackage(packageInfo.packageName)!= null
&& !pm.getLaunchIntentForPackage(packageInfo.packageName).equals("")) {
println("Package Name :" + packageInfo.packageName);
println("Launch Intent For Package :" + pm.getLaunchIntentForPackage(packageInfo.packageName));
println("Application Label :" + pm.getApplicationLabel(packageInfo));
println("i : "+i);
/*
if (i==85) {
startActivity(pm.getLaunchIntentForPackage(packageInfo.packageName));
break;
}
*/
i++;
}
}
}
void draw() {
}
void mousePressed() {
// Change this string to one of the "Package Name" printed in the console // Be sure to have no spaces between quotes
String str = "com.android.chrome";
startActivity(pm.getLaunchIntentForPackage(str));
}