Android: server side #50

Closed
YairHadari opened this Issue Jul 22, 2014 · 5 comments

Projects

None yet

3 participants

@YairHadari

Hi,

From JS I'm calling PHP file that are creating a text file with $_POST['location'] - only for tests.
The problem is that nothing is being passed to $_POST['location'] .
The JS is:
bgGeo.configure(callbackFn, failureFn, {
url: 'http://MyServer.com/WriteBackgroundToDB.php', // <-- only required for Android; ios allows javascript callbacks for your http
params: { // <-- Android ONLY: HTTP POST params sent to your server when persisting locations.
auth_token: 'user_secret_auth_token',
foo: 'bar'
},
headers: { // <-- Android ONLY: Optional HTTP headers sent to your configured #url when persisting locations
'X-Foo': 'BAR'
},
desiredAccuracy: 10,
stationaryRadius: 20,
distanceFilter: 30,
debug: true, // <-- enable this hear sounds for background-geolocation life-cycle.
notificationTitle: 'Background tracking', // <-- android only, customize the title of the notification
notificationText: 'ENABLED' // <-- android only, customize the text of the notification
});

The PHP code is:

Can someone assist please?

@georgetudor

it was answered in another issue I believe; instead or reading data from $_POST you need to obtain the data sent to your PHP script by:

$data = file_get_contents('php://input');

simple logging:

file_put_contents("/tmp/tracklog", file_get_contents('php://input'),"\n", FILE_APPEND);

@YairHadari

Thanks, problem was solved!!!

@YairHadari YairHadari closed this Aug 3, 2014
@christocracy
Owner

Thanks @georgetudor

On Sunday, August 3, 2014, YairHadari notifications@github.com wrote:

Closed #50
#50
.


Reply to this email directly or view it on GitHub
#50 (comment)
.

Snet from Gmail Mobile

@georgetudor

Thank you Chris for a great plugin :)

@christocracy
Owner

FYI Android has been completely refactored in Premium Version

  • No more in-plugin HTTP -- plugin now executes your Javascript callback, just like iOS
  • Significantly improved battery performance

http://transistorsoft.github.io/cordova-background-geolocation/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment