【问题标题】:How to put the correct intent parameters?如何放置正确的意图参数?
【发布时间】:2020-03-22 00:20:54
【问题描述】:

我尝试制作一个可以查看 3d 模型的 SceneView 意图。

   Intent sceneViewerIntent = new Intent(Intent.ACTION_VIEW);
    sceneViewerIntent.setData(Uri.parse("https://raw.githubusercontent.com/KhronosGroup/glTF-Sample-Models/master/2.0/Avocado/glTF/Avocado.gltf"));
    sceneViewerIntent.setPackage("com.google.android.googlequicksearchbox");
    sceneViewerIntent.putExtra("mode","3d_only");
    mContext.startActivity(sceneViewerIntent);

当此意图打开时,它为用户提供了在您自己的环境中查看模型的选项,但我想将其关闭,根据https://developers.google.com/ar/develop/java/scene-viewer#3d-or-ar,您应该能够传递一个名为“模式”的参数可以具有值“3d_only”,这应该会阻止用户在 AR 中查看模型。

我试图通过sceneViewerIntent.putExtra("mode","3d_only"); 传递这个值,但它不起作用。我传递的信息是否正确?

【问题讨论】:

    标签: java android-intent arcore sceneform


    【解决方案1】:

    您不会在任何地方发送任何信息。 “3d_only”应该是一些变量,否则你不会发送任何东西。此外,您必须通过执行 String string = getIntent().getStringExtra("mode"); 来检索另一端的代码;

    【讨论】:

    • 但是由于意图是一个动作视图并且它使用一个包,我无法访问代码的另一端,对吧?
    • 添加你的其余代码,这样我就可以看看它,看看你的“模式”到底是什么。
    • 这是所有代码。 'mode' 来自developers.google.com/ar/develop/java/… 在支持的意图参数下,他们列出了可以具有值'3d_only'、'ar_only'、'ar_preferred'和'3d_preferred'的意图参数'mode'
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-25
    • 2021-12-08
    • 2011-04-17
    • 1970-01-01
    • 1970-01-01
    • 2016-01-11
    • 1970-01-01
    相关资源
    最近更新 更多