Well, I am making android and iOS app and integrating the Uber Api for taxi request. I am using the Uber-API in sand-box mode
I want to impelement this
If in status ACCEPTED and ETA <=2 min:
show message Your Personal Driver will arrive in less than 2 minutes.
If status ACCEPTED and ETA == 0:
Show message Your Personal Driver has arrived.
Problem
I am using the sandbox mode, the ETA is not changing.
Here is the out put
{
driver = {
name = John;
"phone_number" = "(555)555-5555";
"picture_url" = "https://d1a3f4spazzrp4.cloudfront.net/uberex-sandbox/images/driver.jpg";
rating = "4.9";
};
eta = 7; // Note: this ETA, This always remains 7 not changing
location = {
bearing = "-122";
latitude = "47.36758";
longitude = "8.54552";
};
"request_id" = "40edd821-e87a-4401-866a-126e15e1dce1";
status = accepted;
"surge_multiplier" = 1;
vehicle = {
"license_plate" = "UBER-PLATE";
make = Toyota;
model = Prius;
"picture_url" = "https://d1a3f4spazzrp4.cloudfront.net/uberex-sandbox/images/prius.jpg";
};}
Uber App
In the uber app the arriving ETA is accurate
10min
then 9,8,7...1,0
is this a sandbox restriciton or an uber-api Bug.?
Related
I have created an app in both Android & IOS. I am on the last hurdle of the app. I was able to get Android user working with IOS user whereas the IOS had a tableview.
Now I am faced with a different problem. If the "rider" on the iOS app is requesting a ride and the Android driver is available - how can I finish this use case?
If the iOS user makes a request, this is the process:
func requestPressed(_ sender: Any) {
print("... requestPressed")
let dict = selectedPin!.addressDictionary
if dict?.count == 0 {
// this isn't shown to the user, just in your debug window
print("no addresses available, try again in a few seconds")
return
}
destAddress = selectedPin!.addressDictionary!["Street"] as? String ?? "None"
if destAddress == "None" {
print("no valid address available, try again in a few seconds")
return
}
if userLocation != nil {
print("my userLocation: \(userLocation!)")
if canRequestRyde { // if true ...
// get the destination area name, and the price
areaNameDestination = DriveHandler.Instance.getAreaName(latitude: destLat, longitude: destLong)
print("destination area \(areaNameDestination)")
requestFarePrice()
rRideHandler.Instance.requestRide(latitude: Double(userLocation!.latitude), longitude: Double(userLocation!.longitude), destLat: Double(destLat), destLong: Double(destLong), currentAddress: self.currentAddress, destAddress: destAddress, farePrice: farePrice)
// reset the driver message
driverMessage = ""
canRequestRide(delegateCalled: true, request: nil)
} else {
riderCancelled()
}
}
}
The Firebase entry would look like this:
What I need to do from this is for the online Android Driver to either accept/decline the request and follow the steps as if it was Android Rider vs Android Driver.
Below are the steps if Android requests a ride and press "Request" btn:
private void requestPickupHere(String uid) {
Log.e(TAG, "requestPickupHere");
DatabaseReference dbRequest = FirebaseDatabase.getInstance().getReference(Common
.request_tbl); // "RideRequests"
GeoFire mGeoFire = new GeoFire(dbRequest);
mGeoFire.setLocation(uid, new GeoLocation(Common.mLastLocation.getLatitude(),
Common.mLastLocation.getLongitude()));
// write to db
if (search_bar_destination != null) {
dbRequest.child(uid).child("destination").setValue(search_bar_destination);
} else if (tap_on_map_destination != null) {
dbRequest.child(uid).child("destination").setValue(tap_on_map_destination);
}
dbRequest.child(riderId).child("status").setValue("");
if (mUserMarker.isVisible()) {
mUserMarker.remove();
}
// Add a new marker
mUserMarker = mMap.addMarker(new MarkerOptions()
.title("Pickup Here")
.snippet("")
.position(new LatLng(Common.mLastLocation.getLatitude(), Common.mLastLocation.getLongitude()))
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED)));
mUserMarker.showInfoWindow();
btnRequest.setText("Getting your DRIVER ...");
location = getCompleteAddressString(Common.mLastLocation.getLatitude(), Common.mLastLocation.getLongitude());
Log.e(TAG, "riders location = " + location);
findDriver();
}
When the above code is run, it open an activity "Customer Call" located within the Driver Application, where the driver can either Accept / Deny the request.
How can I get the request to be sent from IOS Rider to the Android Driver in the same way it would work for Android to Android?
Using different platforms shouldn't be an issue, when a user requests a ride then you can add an attribute under the driver in the database for example:
DriverRides
DriverId
Name: peter
purpose: needs a ride
Then you can retrieve all the requests to be appear for that driver in a recyclerview. It shouldn't matter what phone the user is using, except if you want the android user to take requests and the ios user to send requests.
You are using the same database for both platforms, so when an ios user or android user store data it will go to the same place. For example if user x uses an iPhone and user y uses a Samsung, you would do the following in the database:
Users
UserId1
name: userx
age: 100
UserId2
name: usery
age: 120
I'm building an app that needs to track location of user and I use
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST;
Ti.Geolocation.distanceFilter = 0;
Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS
Ti.Geolocation.addEventListener('location', locationChange);
On iOS when device is in the move the event is not fired regularly and when it's fired I dont have heading and speed ( even tested it on while driving )
...
heading : -1,
speed : -1
...
but if I run another navigation app on background (like Plans) the event is fired constantly and I have heading and speed of device, as if i'm only getting the events because the other apps.
its the same problem on android the event is not fired correctly
testing with ti SDK 5.1.2 and 5.5.1
This has tripped me up in the past. Add
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST_FOR_NAVIGATION;
Also note that very small numbers in the distance filter may cause some problems.
I use this
if (OS_IOS) {
Ti.Geolocation.accuracy = Ti.Geolocation.ACCURACY_BEST_FOR_NAVIGATION;
Ti.Geolocation.distanceFilter = Alloy.CFG.minUpdateDistance;
Ti.Geolocation.preferredProvider = Ti.Geolocation.PROVIDER_GPS;
Ti.Geolocation.pauseLocationUpdateAutomatically = true;
Ti.Geolocation.activityType = Ti.Geolocation.ACTIVITYTYPE_OTHER_NAVIGATION;
} else { //Android
Ti.Geolocation.Android.manualMode = true;
var gpsProvider = Ti.Geolocation.Android.createLocationProvider({
name: Ti.Geolocation.PROVIDER_GPS,
minUpdateTime: Alloy.CFG.minAge / 1000,
minUpdateDistance: Alloy.CFG.minUpdateDistance
});
var gpsRule = Ti.Geolocation.Android.createLocationRule({
provider: Ti.Geolocation.PROVIDER_GPS,
accuracy: Alloy.CFG.accuracy,
maxAge: Alloy.CFG.maxAge,
minAge: Alloy.CFG.minAge,
});
Ti.Geolocation.Android.addLocationProvider(gpsProvider);
Ti.Geolocation.Android.addLocationRule(gpsRule);
Ti.Geolocation.Android.manualMode = true;
}
The Alloy.CFG settings are set in the config.json file.
{
"global": {
"minUpdateDistance": 10,
"os:android": {
"accuracy": 20,
"minAge": 10000,
"maxAge": 30000
},...
I'm integrating Google Play Game Services in my game. Now I want to retrieve a list of achievements without starting the achievements intent.
I want the list behind that intent so that I can populate my own UI elements with this information.
I'm not using the old GooglePlayServicesClient, I'm using the GoogleApiClient!
Thanks for your help ;)
The code to retrieve a list of achievements can be found in this answer.
Below is the code snippet - see the linked answer for a full description:
public void loadAchievements() {
boolean fullLoad = false; // set to 'true' to reload all achievements (ignoring cache)
float waitTime = 60.0f; // seconds to wait for achievements to load before timing out
// load achievements
PendingResult p = Games.Achievements.load( playHelper.getApiClient(), fullLoad );
Achievements.LoadAchievementsResult r = (Achievements.LoadAchievementsResult)p.await( waitTime, TimeUnit.SECONDS );
int status = r.getStatus().getStatusCode();
if ( status != GamesStatusCodes.STATUS_OK ) {
r.release();
return; // Error Occured
}
// cache the loaded achievements
AchievementBuffer buf = r.getAchievements();
int bufSize = buf.getCount();
for ( int i = 0; i < bufSize; i++ ) {
Achievement ach = buf.get( i );
// here you now have access to the achievement's data
String id = ach.getAchievementId(); // the achievement ID string
boolean unlocked = ach.getState == Achievement.STATE_UNLOCKED; // is unlocked
boolean incremental = ach.getType() == Achievement.TYPE_INCREMENTAL; // is incremental
if ( incremental )
int steps = ach.getCurrentSteps(); // current incremental steps
}
buf.close();
r.release();
}
This code should be run in an AsyncTask since it may take some time to complete while waiting for the achievements to load.
Ok, I have an app I've been writing in Flash builder that makes several HTTPService requests to a server to gather some data about the user. In one view it goes and downloads a string from a server, it then splits the string using delimiter ":" and then adds the components to an array to populate a Spinnerlist. In the simulator this works great, if I package the app for iOS and install it on my iPhone - it works great. But when I try to run it to my Android device, it doesn't work. It acts as though it is working, it loads the view with the SpinnerList on it but the list is empty. I can't seem to figure it out.
Some things I've tried: the XML settings i have enabled the internet access to the android device, in fact, earlier in the app when the user logs in the phone make a very similar server call which works fine on all devices.
This issue has me completely dumbfounded, and help would be greatly appreciated!!
here is the code that makes the request and separates the data.
HttpService Request:
<mx:HTTPService id="CommonHTTP" url="http://dispatch.americantaxi.com:8080/AT/servlet/OnlineOrderServices?command=retrieveCustomerCommonPlaces&customerId={data.ID}" resultFormat="text"/>
Sorting code:
protected function button5_clickHandler(event:MouseEvent):void
{
PickUpType = "Common";
data.PickUpType = PickUpType;
var CommonDataString:String = new String(CommonHTTP.lastResult);
trace("String " + CommonDataString)
var Arr1:Array = [];
Arr1 = CommonDataString.split("|");
trace("arr1 length " + Arr1.length);
var ArrCount:Number = new Number(Arr1.length);
var Arr2:Array = [];
for (var i:Number = 0; i < (ArrCount - 1); i++) {
var currentSelect:String = new String(Arr1[i]);
Arr2 = currentSelect.split(":");
var currentName:String = new String(Arr2[1]);
trace("Add: " + currentName);
CommonPlacesArray.addItem(currentName);
}
data.CommonPlacesArray = CommonPlacesArray;
navigator.pushView(CommonPlaces, data);
}
i'm making a soft to play online video, and i'm trying to add a traffic statistic feature tot the soft. I try to use TrafficStats and getUidRxBytes function. however, it doesnt count the videoview's net traffic.
Like the following code ,i can see the rx(return by getTotalRxBytes) increase a lot, but the myapprx(return by getUidRxBytes) doesnt change.
int uid = VideoViewPlayer.this.getApplicationInfo().uid;
long rx = TrafficStats.getTotalRxBytes();
long tx = TrafficStats.getTotalTxBytes();
long myapprx = TrafficStats.getUidRxBytes(uid);
long myapptx = TrafficStats.getUidTxBytes(uid);
String info = "uid:"+uid+" rx:"+rx+" tx:"+tx+" myrx:"+myapprx+" mytx:"+myapptx;
UPDATE
Thanks first, your comment gives me important clue. And I'm trying to find the uid responsable for steaming media. I use the following code.However i cannt find the process that comsume the traffic.
List<ActivityManager.RunningAppProcessInfo> appProcessList = am.getRunningAppProcesses();
ActivityManager.RunningAppProcessInfo info=null;
//List<ActivityManager.RunningServiceInfo> appProcessList = am.getRunningServices(100);
//ActivityManager.RunningServiceInfo info = null;
strinfo = "";
long max =0;
for(int i=0;i<appProcessList.size();++i)
{
info = appProcessList.get(i);
String key = info.processName+"_" +info.uid;
if(mNetTraffic.containsKey(key))
{
long myrx = TrafficStats.getUidRxBytes(info.uid);
long lastrx = mNetTraffic.get(key).longValue();
mNetTraffic.put(key, new Long(myrx));
if(myrx-lastrx>max && myrx - lastrx>0)
{
max = myrx-lastrx;
strinfo = key +":"+max;
}
}else
{
long myrx = TrafficStats.getUidRxBytes(info.uid);
mNetTraffic.put(key, new Long(myrx));
}
}
//trying to watch the key and max and find process and uid, sadly cant find it
Streaming media should be reported for a different UID, as it is actually streamed and played by an Android internal process and module (OpenCORE or StageFright, depending on Android version).
I had the same issue and managed to find out what UID the process has that streams media: the UID is 1013
http://forum.xda-developers.com/showthread.php?t=442557
http://android-dls.com/wiki/index.php?title=Android_UIDs_and_GIDs
Hope it helps :)