Start a new topic

Is linked data with an entity automatically downloaded? if yes then how to access if after that ?

I have associated a file with my entity.



public ImageEntity() {

putFile("image");

}

@Key("_id")

private String id;

@Key

private String name;

@Key("_kmd")

private KinveyMetaData kinveyMetaData;

@Key("_acl")

private KinveyMetaData.AccessControlList accessControlList;

private Bitmap mBitmap;



Now after that i call

mKinveyClient.appData("events", ImageEntity.class); events.get(new KinveyListCallback() { @Override public void onSuccess(ImageEntity[] imageEntities) {

//what to do here confused!!! }



if anyone has a simple working example (not the offical ones,they are not basic) that i can learn from that would be appreciated.
1 Comment

Hey, so to start-- LinkedData is different than AppData. Check this out:



http://devcenter.kinvey.com/android/guides/files#linkingimagedata



LinkedData lets you associate a file with an entity, and provides methods to save an entity and upload a file in one method call, or to download an entity and a file in one method call. Note that behind the scenes, LinkedData is leveraging the code in AppData and the File API.



When you use LinkedData("events", ImageEntity.class).get(...), you can pass it a KinveyListCallback and a DownloadProgressListener.



When the request has executed successfully, the `onSuccess(ImageEntity[] imageEntities){...}` method will run. This is where you can render the event entities in a listview or whatever your application will do with the entities saved in the cloud.



The DownloadProgressListener can be used to get progress updates on the file downloads. Once the file downloads are complete, you can call `getFile("image")` on the `LinkedGenericJson` object to retrieve the file contents.





Also, look at the method `getThumbnail()` in the file to see how to retrive the file after it is downloaded: https://github.com/KinveyApps/StatusShare-Android/blob/master/status-share/src/com/kinvey/samples/statusshare/model/UpdateEntity.java



and look at the method `loadUpdates()` here to see how linkedData is used: https://github.com/KinveyApps/StatusShare-Android/blob/master/status-share/src/com/kinvey/samples/statusshare/fragments/ShareListFragment.java

Login or Signup to post a comment