Google Nearby Messages Publish Returns 2806 Forbidden (Android - React Native)

你。 提交于 2020-12-26 06:53:06

问题


We are currently utilizing a React Native wrapper over Google Nearby Messages (repo code here). On Android everything was working until about a week ago when suddenly everytime anything is published it returns a 2806 Forbidden error with almost no context. Everything is working on the iOS side. We have been trying to solve this here: https://github.com/mrousavy/react-native-google-nearby-messages/issues/25 but we are turning to stackoverflow as we are hoping somebody has seen this and solved it on Android.

Here is the Kotlin code for publishing:

@ReactMethod
    fun publish(message: String, promise: Promise) {
        if (_messagesClient != null) {
            if (_publishedMessage != null) {
                promise.reject(Exception("There is an active published message! Call unpublish first!"))
            } else {
                _publishedMessage = Message(message.toByteArray())
                _messagesClient!!.publish(_publishedMessage!!, _publishOptions!!).addOnCompleteListener { task ->
                    Log.d(name, "GNM_BLE: Published! Successful: ${task.isSuccessful}")
                    if (task.isSuccessful) {
                        promise.resolve(null)
                    } else {
                        _publishedMessage = null
                        val e = task.exception
                        if (e != null) promise.reject(mapApiException(e))
                        else promise.reject(Exception("The task was not successful, but no Exception was thrown."))
                    }
                }
            }
        } else {
            promise.reject(Exception("The Messages Client was null. Did the GoogleNearbyMessagesModule native constructor fail to execute?"))
        }
    }

Here are the variables inspected when adding a breakpoint to the Log line:

We have tried switching API keys already and all that.

来源:https://stackoverflow.com/questions/64431212/google-nearby-messages-publish-returns-2806-forbidden-android-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!