sceneview-android icon indicating copy to clipboard operation
sceneview-android copied to clipboard

Sample Project of Google Cloud Anchor not working with New version 2.0.2 but its working with 0.9.5 scenview

Open dhaval-android opened this issue 1 year ago • 3 comments

We are always getting session.canHostCloudAnchor(sceneView.cameraNode) as false if we are setting cloud anchor enable then also not working bellow is some config and implemenation code so plz guide us.

 configureSession { _, config ->
                config.planeFindingMode=Config.PlaneFindingMode.HORIZONTAL_AND_VERTICAL
                config.depthMode=Config.DepthMode.AUTOMATIC
                config.cloudAnchorMode = Config.CloudAnchorMode.ENABLED
 }
when (mode) {
            Mode.HOME -> {}
            Mode.HOST -> {
                val session = sceneView.session ?: return
                if (!session.canHostCloudAnchor(sceneView.cameraNode)) {
                    Toast.makeText(context, R.string.insufficient_visual_data, Toast.LENGTH_LONG)
                        .show()
                    return
                }
                val anchor = cursorNode.createAnchor() ?: return
                cloudAnchorNode = CloudAnchorNode(sceneView.engine, anchor).apply {
                    host(session) { cloudAnchorId, state ->
                        mode = if (state == CloudAnchorState.SUCCESS && cloudAnchorId != null) {
                            editText.setText(cloudAnchorId)
                            Mode.RESET
                        } else {
                            Toast.makeText(context, R.string.error_occurred, Toast.LENGTH_LONG)
                                .show()
                            Mode.HOST
                        }
                    }
                }
                sceneView.addChildNode(cloudAnchorNode!!)
                actionButton.apply {
                    setText(R.string.hosting)
                    isEnabled = true
                }
            }

            Mode.RESOLVE -> {
                val session = sceneView.session ?: return
                CloudAnchorNode.resolve(
                    sceneView.engine,
                    session,
                    editText.text.toString()
                ) { state, node ->
                    mode = if (!state.isError && node != null) {
                        cloudAnchorNode = node
                        sceneView.addChildNode(node)
                        Mode.RESET
                    } else {
                        Toast.makeText(context, R.string.error_occurred, Toast.LENGTH_LONG).show()
                        Mode.RESOLVE
                    }
                }

                actionButton.apply {
                    setText(R.string.resolving)
                    isEnabled = false
                }
            }

            Mode.RESET -> {
                cloudAnchorNode?.detachAnchor()
                mode = Mode.HOME
            }
        }

Here is the old and new code urls

Old Version which working https://github.com/wh173d3v11/ArCloudAnchorSample_MultipleAnchors_HostAndResolve

New Version where its not working https://github.com/SceneView/sceneview-android/tree/main/samples/ar-cloud-anchor

We implementing both implemention in project with one version its working or with other its not working so I think there is no configrational issue like API enable and manifest implementation

dhaval-android avatar Jan 02 '24 11:01 dhaval-android

Hi There, The issue remains open, SADLY!!! I am facing a similar issue with this new version 2.0.2 to run Google Cloud Anchor piece of code. Please make a fix as soon as possible. Regards

ravirajxplora avatar Jan 05 '24 11:01 ravirajxplora

Anyone found any working solution!!

mehulenstead avatar Jan 16 '24 09:01 mehulenstead

@ThomasGorisse Can you plz check for this version, At my end also Google Cloud anchor is not working for newer version.

dhaval-android avatar Jan 16 '24 09:01 dhaval-android

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Apr 16 '24 05:04 github-actions[bot]

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

github-actions[bot] avatar Apr 23 '24 05:04 github-actions[bot]