Android Wearable.API 已弃用?那么我们需要用什么来构建api客户端。
我现在的代码是
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(Wearable.API)
.build();
mGoogleApiClient.connect();
//从此 Wearable.API 被弃用。
这里他们要求改成data client和message client。
那么谁能帮我举个例子具体怎么做? 感谢和问候,
更新: 以下是正确的方法吗?
.addApi(Wearable.getDataClient(MainActivity.this).getApi())
.addApi(Wearable.getMessageClient(MainActivity.this).getApi())
如果是这样,那么 onMessageReceive() 和 onDataChange() 接口(interface)的用途是什么。我的意思是我已经在实现它们。
最佳答案
请在此处查看有关从 GoogleApiClient 迁移到基于 GoogleApi 类的对象的 Google 文档。
https://developer.android.com/training/wearables/data-layer/migrate-to-googleapi
关于android - 我们需要用什么来代替 Android 中的 wear api?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50713223/