没有应用可以处理此操作 Google Duo
No apps can handle this action Google Duo
我正在尝试通过单击某个按钮从我的应用程序中使用 Google Duo 开始 video/audio 通话。我可以在 WhatsApp 上成功启动 audio/video 呼叫,但不能在 Google Duo 上启动。
long id= 133;
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
// the _ids you save goes here at the end of /data/
intent.setDataAndType(Uri.parse("content://com.android.contacts/data/"+id),
"vnd.android.cursor.item/com.google.android.apps.tachyon.phone.audio");
intent.setPackage("com.google.android.apps.tachyon");
startActivity(intent);
我终于找到了解决问题的方法。
String data = "content://com.android.contacts/data/" + ID;
// Build the intent
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
// the _ids you save goes here at the end of /data/id
intent.setData(Uri.parse("content://com.android.contacts/data/" + ID));
//For audio call
intent.setComponent(new ComponentName(packageName, "com.google.android.apps.tachyon.ContactsAudioActionActivity"));
//use this for video call
//intent.setComponent(new ComponentName(packageName, "com.google.android.apps.tachyon.ContactsVideoActionActivity"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Verify it resolves
PackageManager packageManager = context.getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0);
boolean isIntentSafe = activities.size() > 0;
// Start an activity if it's safe
if (isIntentSafe) {
context.startActivity(intent);
Toast.makeText(context, "Opening Duo", Toast.LENGTH_SHORT).show();
}
我正在尝试通过单击某个按钮从我的应用程序中使用 Google Duo 开始 video/audio 通话。我可以在 WhatsApp 上成功启动 audio/video 呼叫,但不能在 Google Duo 上启动。
long id= 133;
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
// the _ids you save goes here at the end of /data/
intent.setDataAndType(Uri.parse("content://com.android.contacts/data/"+id),
"vnd.android.cursor.item/com.google.android.apps.tachyon.phone.audio");
intent.setPackage("com.google.android.apps.tachyon");
startActivity(intent);
我终于找到了解决问题的方法。
String data = "content://com.android.contacts/data/" + ID;
// Build the intent
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
// the _ids you save goes here at the end of /data/id
intent.setData(Uri.parse("content://com.android.contacts/data/" + ID));
//For audio call
intent.setComponent(new ComponentName(packageName, "com.google.android.apps.tachyon.ContactsAudioActionActivity"));
//use this for video call
//intent.setComponent(new ComponentName(packageName, "com.google.android.apps.tachyon.ContactsVideoActionActivity"));
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
// Verify it resolves
PackageManager packageManager = context.getPackageManager();
List<ResolveInfo> activities = packageManager.queryIntentActivities(intent, 0);
boolean isIntentSafe = activities.size() > 0;
// Start an activity if it's safe
if (isIntentSafe) {
context.startActivity(intent);
Toast.makeText(context, "Opening Duo", Toast.LENGTH_SHORT).show();
}