我试图使可以查看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,您应该能够传递一个名为“ mode”的参数,该参数可以具有值“ 3d_only”,应防止用户能够在AR中查看模型。

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

最佳答案

您不会在任何地方发送任何信息。 “ 3d_only”应该是一些变量,否则您将不会发送任何内容。同样,您还必须通过执行String string = getIntent()。getStringExtra(“ mode”);来检索另一端的代码。

关于java - 如何放置正确的意图参数?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/60794695/

10-09 00:38