App(a):判断是否为App(b)是否存在,不存在选择下载 存在后台状态直接唤醒 否则直接打开
App(a)部分代码
if (checkPackage("com.xxx.android")) {
if (ToolsUtils.isBackgroundRunning(this, "com.xxx.android")) {
Intent intent = new Intent();
intent.setPackage("com.xxx.android");
intent.setAction("com.xxx.android.open");
sendBroadcast(intent);
} else {
PackageManager packageManager = getPackageManager();
Intent intent = new Intent();
intent = packageManager
.getLaunchIntentForPackage("com.xxx.android");
startActivity(intent);
}
} else {
Toast.makeText(this, "点击下载app", Toast.LENGTH_SHORT).show();
}
App(b)部分代码 通过广播唤醒app
AndroidManifest.xml
原文:http://www.cnblogs.com/sumx/p/7060127.html