WearableListenerService

WearableListenerService

我正在开发Service扩展WearableListenerService的Android Wear项目。
当我尝试添加Service Binder时,出现此错误

private final IBinder mBinder = new LocalBinder();

 public class LocalBinder extends Binder {
    DataLayerListenerService getService() {
        return DataLayerListenerService.this;
    }
 }

@Override
public IBinder onBind(Intent intent) {
     return mBinder;
}


 Error:(196, 20) error: onBind(Intent) in DataLayerListenerService cannot override onBind(Intent) in WearableListenerService
overridden method is final


是否可以通过某种方式绑定WearableListenerService?如何在不使用广播的情况下将数据从WearableListenerService传递到Activity?

最佳答案

您不必使用绑定。

您可以通过mGoogleApiClient进行交流。

Sending data from an Activity to WearableListenerService

这个答案可以帮助您解决问题。

10-05 21:14