app给应用B打电话startActivity
,应用B验证并返回应用A.如何实现这一点。
app A:
Intent intent;
PackageManager packageManager = GameLanuchActivity.this.getPackageManager();
intent = packageManager.getLaunchIntentForPackage("com.example");
if(null == intent) {
//todo not exit.
} else {
intent.setComponent(new ComponentName("com.example","com.example.XeaAuthActivity"));
GameLanuchActivity.this.startActivity(intent);
}
app B:
在某些逻辑后调用quit
,它返回到app B的HomeActivity,而不是app A.
private void quit() {
finish();
overridePendingTransition(R.anim.push_right_in, R.anim.push_right_out);
}
答案 0 :(得分:0)
尝试添加:
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
到app A。
答案 1 :(得分:0)
尝试:
finishAffinity();
但它仅适用于上面的API级别16 ..