赞
踩
先判断是否安装
- /**
- * 应用是否安装
- */
- public static boolean isAppInstalled(String packageName) {
- return new File("/data/data/" + packageName).exists();
- }
第一种方法:
以包名方法进入:
- Intent LaunchIntent = getPackageManager().getLaunchIntentForPackage("com.ok.o");
- startActivity(LaunchIntent);
第二种:
自定义action
这种方法没有测试
- Intent intent = new Intent();
- intent.setAction("com.joyodream.jiji.main");
- startActivity(intent);
-
- <intent-filter>
- <action android:name="com.ok.o" /><category android:name="android.intent.category.DEFAULT" /></intent-filter>
第三种通过scheme
- Intent intent = new Intent();
- intent.setData(Uri.parse("com.ok.o://......"));
- startActivity(intent);
- //com.ok.o相当于网址的http
-
- //下面的是另一个App的main入口下定义协议
- <intent-filter>
- <action android:name="android.intent.action.VIEW" />
- <category android:name="android.intent.category.DEFAULT" />
- <data android:scheme="com.ok.o" />
- </intent-filter>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。