5

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: task variable zzab variable

We have tried switching API keys already and all that.

Perniferous
  • 513
  • 6
  • 19
  • Did you seen this thread? https://stackoverflow.com/questions/37383759/nearby-messages-api-returns-status-code-2806-while-publish – Dmitry Zagorulkin Oct 28 '20 at 18:20
  • Yes @DmitryZagorulkin I have tried the solution from that thread (generating a new api key). Doesn't change the issue. – Perniferous Oct 28 '20 at 19:54

0 Answers0