简体   繁体   中英

How to put the correct intent parameters?

I tried to make a SceneView intent where a 3d-model can be viewed.

   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);

When this intent opens, it gives the user an option to view the model in your own environment, but I want to turn this off and according to https://developers.google.com/ar/develop/java/scene-viewer#3d-or-ar you should be able to pass on a parameter called 'mode' which can have the value '3d_only' which should prevent the user from being able to view the model in AR.

I tried to pass on this value by means of sceneViewerIntent.putExtra("mode","3d_only"); but it doesn't work. Am I passing on the information correctly?

You're not sending any information anywhere. "3d_only" should be some variable, otherwise you're not sending anything. Also, you have to retrieve your code on the other end by doing String string = getIntent().getStringExtra("mode");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM