首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >没有任何应用程序能够处理Google二重奏。

没有任何应用程序能够处理Google二重奏。
EN

Stack Overflow用户
提问于 2018-06-17 13:36:21
回答 1查看 599关注 0票数 2

我正试图从我的应用程序中使用Google启动视频/音频通话,点击某个按钮。我可以在WhatsApp上成功地启动音频/视频呼叫,但不能在Google上启动。

代码语言:javascript
复制
  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);
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-24 11:45:22

我终于找到了解决问题的办法。

代码语言:javascript
复制
 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();
    }
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50897179

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档