-
Notifications
You must be signed in to change notification settings - Fork 276
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
plugin does not call http url in ios #693
Comments
Are you using PHP on server? |
Also see Debugging Run your app in XCode and observe logs: A successful HTTP request looks like this:
|
But no any logs are occurred . |
.net server |
Yes, because you haven't configured You'll also want to use this.bgGeo.ready({
reset: true, // <-- use this during development.
debug: true,
logLevel: this.bgGeo.LOG_LEVEL_VERBOSE
.
.
.
}); See docs for |
If i want to get all stored location then how can i get ? |
See docs for HTTP & Persistence Methods |
2018-06-07 19:46:21.451140 Galio[598:184207] [TSBackgroundFetch addListener]: TSLocationManager above is my log.. |
when i go to background then app is started some notification but no any url fired |
Show me XCode logs of your app booting from scratch. It should look like this:
|
Also, show me your:
|
cordova-background-geolocation-lt 2.12.2 "BackgroundGeolocation" |
my logs. |
|
yes of course , i will update my code.. |
this.platform.ready().then(() => {
this.bgGeo = (<any>window).BackgroundGeolocation;
this.onDeviceReady.bind(this)
}); onDeviceReady() {
this.bgGeo.on('location', this.onLocation.bind(this));
this.bgGeo.on('motionchange', this.onMotionChange.bind(this));
this.bgGeo.on('activitychange', this.onActivityChange.bind(this));
this.bgGeo.on('geofence', this.onGeofence.bind(this));
this.bgGeo.on('http', this.onHttpSuccess.bind(this), this.onHttpFailure.bind(this));
// BackgroundGeoLocation is highly configurable.
this.bgGeo.ready({
// Geolocation config
desiredAccuracy: 0,
distanceFilter: 0,
stationaryRadius: 0,
interval: 3000,
// Activity Recognition config
activityRecognitionInterval: 3000,
stopTimeout: 5,
// Application config
debug: true, // <-- Debug sounds & notifications.
reset: true,
logLevel: this.bgGeo.LOG_LEVEL_VERBOSE,
stopOnTerminate: false,
startOnBoot: true,
// HTTP / SQLite config
url: "http://property.zoomi.in:86/api/User/UserTracking",
headers: { // <-- Optional HTTP headers
"Content-Type": "application/json"
},
params: { // <-- Optional HTTP params
"UserId": 4,
"LocationData": [
{
"Lat": 'xyz',
"Long": 'xyz',
"Date": 'xyz',
"BatteryPerc": 44
}
]
},
method: "POST",
autoSync: true,
maxDaysToPersist: 3,
}, function(state) {
// This callback is executed when the plugin is ready to use.
console.log("BackgroundGeolocation ready: ", state);
// this.bgGeo.start();
});
}
onLocation(location, taskId) {
console.log('- location: ', location);
this.bgGeo.getLocations(function(locations) {
console.log("locations: ", locations);
});
this.bgGeo.finish(taskId);
}
onMotionChange(isMoving, location, taskId) {
console.log('- motionchange: ', isMoving, location);
this.bgGeo.finish(taskId);
}
onActivityChange(activity) {
console.log('- activitychange: ', activity);
}
onGeofence(params, taskId) {
console.log('- geofence: ', params);
this.bgGeo.finish(taskId);
}
onHttpSuccess(response) {
console.log('- http success: ', response);
}
onHttpFailure(response) {
console.log('- http failure: ', response);
} |
please update me , i have to complete my tracking work within tomorrow |
Why have you commented-out this:
un-comment that. you need to tell the plugin to |
i am calling start function from button click and to stop from stop button click |
btw, multi-line code-blocks require 3-backticks -- not one. |
Do you hear the plugin's debug sounds? |
yes i heared the sound when plugin activate and also i heared the sound when plugin fires notification |
In Javascript console, show me the result of the following: > bg = window.BackgroundGeolocation;
> await bg.getState(); |
and this, also in Javascript console (will be a large amount of text): >await bg.getLog() |
here there are two snap, please look at that |
As you can see, Also, your |
please see my logs... ` ╔═══════════════════════════════════════════════════════════ 📍<+37.33793145,-122.08422750> +/- 5.00m (speed 33.36 mps / course 305.51) @ 6/7/18, 10:42:12 PM India Standard Time ╔═══════════════════════════════════════════════════════════
✅-[TSHttpService post:error:] UNLOCKED: 6AE0D743-366A-4B71-8B11-1C9BBADEE0EA ╔═══════════════════════════════════════════════════════════ 📍<+37.36324345,-122.12188572> +/- 5.00m (speed 34.09 mps / course 312.89) @ 6/7/18, 10:43:58 PM India Standard Time ╔═══════════════════════════════════════════════════════════ ╔═══════════════════════════════════════════════════════════
✅-[TSHttpService post:error:] UNLOCKED: 6AE0D743-366A-4B71-8B11-1C9BBADEE0EA ╔═══════════════════════════════════════════════════════════ 📍<+37.36457081,-122.12476867> +/- 5.00m (speed 33.08 mps / course 288.63) @ 6/7/18, 10:44:07 PM India Standard Time ╔═══════════════════════════════════════════════════════════ ╔═══════════════════════════════════════════════════════════
✅-[TSHttpService post:error:] UNLOCKED: 6AE0D743-366A-4B71-8B11-1C9BBADEE0EA ╔═══════════════════════════════════════════════════════════ 📍<+37.36465673,-122.12512859> +/- 5.00m (speed 33.13 mps / course 285.82) @ 6/7/18, 10:44:08 PM India Standard Time ╔═══════════════════════════════════════════════════════════ ╔═══════════════════════════════════════════════════════════
2018-06-07 22:44:08.776199+0530 Galio[41045:427145] - http failure: [object Object] ╔═══════════════════════════════════════════════════════════ |
This can be closed. Clearly the "url is now being called". Your server is saying "404". |
is this plugin work after app is terminated ?? |
why plugin update location at every seconds ? |
Yes, of course.
|
can i give distanceFilter = 200m and interval = 120000 then .. |
There's no such config option It's iOS is strictly distance-based. You can only think in terms of |
i put distanceFilter = 100m and i run project on my simulator and my pc is stay at one side, but location updates at every 5-6 seconds how is this possible with distanceFilter 100m? |
If you need to compose a custom template for your server, see HTTP Features However, if your server is expecting
This plugin posts |
ok i will change as per needed |
Show me |
It's assumed that you know that you must create your own var reference to
|
yes sir, i am using Freeway Drive |
please update me. |
With |
i want to give lat lng dynamically , so where can i get latlngs , date and battery status ??? and also that after app is terminated , onLocation mehtod will call ? |
How can I push url with my params like latitude, longitude, battery status and date to server?. my code is below in which I put static params and it pushed successfully but how can i send current location with my params..
|
Are you reading the docs? Check for location.sample === true on so-called “duplicates” You’re thinking is backwards on #params: you don’t put location data into params. Rather #params are attached to location-data that the plugin composes. |
Why plugin calls two times onLocation method ?? |
Why don’t you read the docs of the location event and find out for yourself?? |
Hello sir, |
When your server returns HTTP 200, the plugin deletes its copy of that record. The plugin desires an empty database. In the logs, you'll see:
Your original issue "plugin does not call http url in ios " is now closed. |
I am new in your plugin , i set code from https://gist.github.com/christocracy/2abf5587cc12b83e15aa12958de7a7d2#file-backgroundgeolocation-ionic2-js
but url not call with my params ...
or not any success or error consoles are occurred.
and also i want to track user even user terminate the app.
Your Environment
Plugin version: 2.12.2
Platform: iOS
OS version: 10.2.1
Device manufacturer / model: iPhone 5s
Cordova version (
cordova -v
): 8.0.0Cordova platform version (
cordova platform ls
): 4.5.4Plugin config
`this.bgGeo.ready({
// Geolocation config
desiredAccuracy: 0,
distanceFilter: 0,
stationaryRadius: 0,
interval: 3000,
// Activity Recognition config
activityRecognitionInterval: 3000,
stopTimeout: 5,
// Application config
debug: true, // <-- Debug sounds & notifications.
stopOnTerminate: false,
startOnBoot: true,
// HTTP / SQLite config
url: "http://property.zoomi.in:86/api/User/UserTracking",
headers: { // <-- Optional HTTP headers
"Content-Type": "application/json"
},
params: { // <-- Optional HTTP params
"UserId": 4,
"LocationData": [
{
"Lat": 'xyz',
"Long": 'xyz',
"Date": 'xyz',
"BatteryPerc": 44
}
]
},
method: "POST",
autoSync: true,
maxDaysToPersist: 3,
}, function(state) {
// This callback is executed when the plugin is ready to use.
console.log("BackgroundGeolocation ready: ", state);
this.bgGeo.start();
});`
Expected Behavior
Actual Behavior
Steps to Reproduce
Context
Debug logs
The text was updated successfully, but these errors were encountered: