Cannot send an Asset to an Android Wear device

前端 未结 1 1939
终归单人心
终归单人心 2021-01-03 10:08

I\'m trying to send an Asset to my Sony SmartWatch3. I followed the Google\'s documentation (https://developer.android.com/training/wearables/data-layer/assets.html) but it

相关标签:
1条回答
  • 2021-01-03 10:41

    It's tricky, but in order to get invoked the content of the data has to change. Try adding the timestamp to the DataMap. E.g.

    PutDataMapRequest request = PutDataMapRequest.create("/image");
    Asset asset = createAssetFromBitmap(bitmap);
    request.putAsset("profileImage", asset);
    DataMap dataMap = request.getDataMap(); 
    dataMap.putLong("timestamp", System.currentTimeMillis());
    PutDataRequest dataRequest = request.asPutDataRequest();      
    Wearable.DataApi.putDataItem(mGoogleApiClient, dataRequest);
    
    0 讨论(0)
提交回复
热议问题