This should’ve been an easy task, but I’m not been able to do it.
I’m following Rob Percivals tutorial on Android where he’s building “Uber Clone” app.
This tutorial is old and he’s using Parse, so I’m implementing the same things in Backendless instead.
So, What I need to do is after “rider” logs in, he’s redirected to “YourLocation” maps activity.
Here’s the image of how my app looks like.
http://support.backendless.com/public/attachments/56113d539c9a89b6ea0b26a73856e903.jpg</img>
I’m getting user’s location in onLocationChanged method.
When user clicks on “Request Uber” button, the request is saved in “Requests” table in backendless, along with riders name.
What I’m trying to accomplish is I want to also save the requester/riders location in a table.
Have a look at how my backendless table looks like.
http://support.backendless.com/public/attachments/201fb1b4bc58d375ee0a58279490765a.jpg</img>
For saving this request, I’m not using a class but instead, I’m using a hashmap.
The sample code is below:
final HashMap requests = new HashMap<String, Object>();
requests.put("requesterUsername", currentUsername);
GeoPoint userLocation = new GeoPoint(myLastLocation.getLatitude(), myLastLocation.getLongitude());
requests.put("requesterLocation", userLocation);
Backendless.Persistence.of("Requests").save(requests, new AsyncCallback<Map>() {
@Override
public void handleResponse(Map response) {
Log.i("userSaved", response.toString());
//Change TextView text
infoTextView.setText("Finding Uber driver...");
requestUberButton.setText("Cancel Uber");
requestActive = true;
}
@Override
public void handleFault(BackendlessFault fault) {
Log.i("userSaveFault", fault.toString());
}
});
This method didn’t work for me.
Also by following official documentation for Backendless 4.0,
https://backendless.com/docs/android/doc.html#geo_adding_a_geo_point
I tried this as well and used this method
public GeoPoint Backendless.Geo.savePoint( GeoPoint geoPoint,
AsyncCallback<GeoPoint> responder )
But what I don't understand is how shall I tell the above query to store it in "Requests" table?
I also tried
public GeoPoint Backendless.Geo.savePoint( GeoPoint geoPoint,requests
AsyncCallback<GeoPoint> responder )
Because I’m already storing some data in requests table, but it’s returning an error.
I was assuming “meta” was something similar like table.
So, how can I store geopoint data in my table?