我尝试按this guide添加DataUpdateListener
来监听DataType.TYPE_WEIGHT
事件,如下所示:
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0,
new Intent(this, FitnessStoreUpdatesReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT);
Fitness.HistoryApi.registerDataUpdateListener(googleApiClient,
new DataUpdateListenerRegistrationRequest.Builder()
.setDataType(DataType.TYPE_WEIGHT)
.setPendingIntent(pendingIntent)
.build());
我的FitnessStoreUpdatesReceiver
与指南中链接的 <div data-bind="dxList: { dataSource: dataSource,pullRefreshEnabled:true}">
<div data-options="dxTemplate : { name: 'item' } ">
<div data-bind="**text: UserName"**></div></div></div>//This text is dynamic
相同。但是,通过Google Fit Android应用添加重量事件不会触发我的听众。我在实施中遗漏了什么吗?