Wear os 4.0 (One UI 5.0) doesn't receive messages from GoogleApiClient

55 views Asked by At

I've created a couple of apps that can communicate with the watch using GoogleApiClient. It worked perfectly fine, but one day ago, every app I used this interface stopped receiving messages from the mobile device and could only send messages. The mobile received the messages but it seems that onMessageReceived() method on the wear never triggered as before. Why? Is it a software update? how can I solve this? (Data layer API doesn't work for my API level. only GoogleApiClient). Why is it one-way communication suddenly? (NOTE: I did not change any code)

Wear os:

class WearService : WearableListenerService() {
    lateinit var googleApiClient: GoogleApiClient

    override fun onCreate() {
        super.onCreate()
        println("WearService onCreate")

        initializeGoogleApiClient()
    }

    override fun onMessageReceived(messageEvent: MessageEvent) {
        super.onMessageReceived(messageEvent)

        if (messageEvent.path == PATH) {
            val message = String(messageEvent.data)
            println("WearService message: $message")

            postToActivity(message)
        }
    }
}

Mobile:


class MainActivity : AppCompatActivity() {
    lateinit var startServiceMaterialButton: MaterialButton
    lateinit var receiver: BroadcastReceiver
    lateinit var watchStateTextView: TextView
    lateinit var serviceStateTextView: TextView
    var countdownTimer: CountDownTimer? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        startService()
        initializeReceiver()

        sendAlive() # Send every 1 second
    }

Update: Now it's working and i don't even know why. I didn't change a thing. This OS is weird

0

There are 0 answers