hi guys im using background geolocation plugin, im sending latitude &longitude to my server (php) i get the data like this
this is my background geolocation config
backgroundGeolocation.configure(callbackFn, failureFn, {
desiredAccuracy: 10,
stationaryRadius: 20,
distanceFilter: 30,
url: 'http://192.168.1.120/test.Php',
httpHeaders: { 'X-FOO': 'bar' },
maxLocations: 1000,
// Android only section
locationProvider: backgroundGeolocation.provider.ANDROID_ACTIVITY_PROVIDER,
interval: 60000,
fastestInterval: 5000,
activitiesInterval: 10000,
notificationTitle: 'Background tracking',
notificationText: 'enabled',
notificationIconColor: '#FEDD1E',
notificationIconLarge: 'mappointer_large',
notificationIconSmall: 'mappointer_small'
});
how can i access parametres? the data im getting is like this
$data = file_get_contents('php://input');
file_put_contents("test.txt",$data)
get me:
[{"provider":"fused","time":1523431761125,"latitude":36.680000,"longitude":2.8007094,"accuracy":116.0999984741211,"locationProvider":1}]
i want to get alttitude and longitude how can i achieve this using php?
ok idk why after i posted the question i found the answer lol, i was usin provider as key thats why didnt work xD anyways i solved it ,
$array = json_decode($data, true);
$data=$array[0]['time']; // b
file_put_contents("tes2x.txt",$data);