gpt4 book ai didi

java - 没有应用可以处理此操作 Google Duo

转载 作者:行者123 更新时间:2023-11-30 10:14:24 26 4
gpt4 key购买 nike

我正在尝试通过单击某个按钮从我的应用程序中使用 Google Duo 开始视频/音频通话。我可以在 WhatsApp 上成功启动音频/视频通话,但不能在 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();
}

关于java - 没有应用可以处理此操作 Google Duo,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50897179/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com