Android mobile Azure service (SDK) response returning empty array

80 views Asked by At

So I am using the azure mobile service on Android (using the mobile azure SDK). I am trying to query a table which is returning a JSON array containing JSON objects like so:

 [
  {
    "PhotoID": 10680
  },
  {
    "PhotoID": 10681
  },
  {
    "PhotoID": 10682
  }
]

and here's my simple

AsyncTask class

private class asyncTaskerPhotoIds extends AsyncTask<String, Void, Void> {
    @Override
    protected Void doInBackground(String... params) {
        String reportedCaseId = params[0];
        MobileServiceTable<Photo> mPhoto = mClient.getTable("UserReportedCasePhotos", Photo.class);

        try{
            final MobileServiceList<Photo> result =// mPhoto.getTable.execute().get();
                    mPhoto.where().field("PhotoID").eq(reportedCaseId).execute().get();
            runOnUiThread(new Runnable() {
                @Override
                public void run() {

                    //for (Photo item : result) {

                        Log.v("Photo Ids", String.valueOf(result));
                    //}
                }
            });

        }catch (Exception exception){
            exception.printStackTrace();
        }

        return null;
    }
}

and here's the model class (Photo)

public class Photo {
  int photoID;
   String id;

   public int getPhotoID() {
      return photoID;
   }

public void setPhotoID(int photoID) {
    this.photoID = photoID;
}

public String getId() {
    return id;
}

public void setId(String id) {
    this.id = id;
   }
  }

.. and on my onCreate I execute my asyncTask:

new asyncTaskerPhotoIds().execute("11133");  passing an id

However whenever I run the app, all I get is an empty array, like so on my log:

Photo Idsīš• [] 

What am I doing wrong? Any suggestions, help is highly appreciated.

Thanks in advance.

0

There are 0 answers