Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android: server side #50

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

Android: server side #50

YairHadari opened this issue Jul 22, 2014 · 5 comments

Comments

@YairHadari
Copy link

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
Copy link

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
Copy link
Author

Thanks, problem was solved!!!

@christocracy
Copy link
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
Copy link

Thank you Chris for a great plugin :)

@christocracy
Copy link
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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants