用于扩展WearableListenerService的服务的Binder

时间:2014-12-25 15:04:36

标签: android wear-os

我正在使用Service extends WearableListenerService开发android穿戴项目。 当我尝试添加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?

1 个答案:

答案 0 :(得分:1)

你不必使用Bind。

您可以通过mGoogleApiClient进行交流。

Sending data from an Activity to WearableListenerService

此答案可帮助您解决问题。