- Intent intent = new Intent();
- intent.setPackage(toAppPackageName);
- intent.putExtra(Constants.KEY_UID_FROM_APP_NAME, curAppPackageName);
- intent.putExtra(Constants.KEY_UID_OP_CODE, Constants.VALUE_UID_OP_CODE_SCAN);
- intent.setAction("android.intent.action.iqiyi.sso");
- // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- Context context = getApplicationContext();
- if (IntentTools.isIntentActionAvailable(context, intent)) {
- startActivityForResult(intent, REQUEST_CODE_FOR_SCAN_ACCOUNT);
- } else {
- // 未安装APP,跳过
- finishOneScan();
- }
- <span style="color:#ff0000;"><strong>isIntentActionAvailable(context, intent) ??</strong></span>
- public static boolean isIntentActionAvailable(Context context, Intent intent) {
- PackageManager packageManager = context.getPackageManager();
- List<ResolveInfo> list = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);
- return list != null && list.size() > 0;
- }