transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
655 stars 277 forks source link

BackgroundGeolocation.on('http' , function) is not working #728

Closed kushal-ost closed 5 years ago

kushal-ost commented 5 years ago

Plugin version: 2.12.2 Platform: iOS or Android : Both OS version: Latest Device manufacturer / model: Any device of android / iOS Cordova version (cordova -v): 8.0.0 Cordova platform version (cordova platform ls): Andriud- 7.0.0 IONIC VERSION : IONIC v1

Expected Behavior

It should provide response when geofence is added.

Actual Behavior

Nothinig event is fired when geofence is added.

kushal-ost commented 5 years ago

I am using paid license key

christocracy commented 5 years ago

If you are a customer, you’re aware you’re posting issues to the public repo?

kushal-ost commented 5 years ago

yes.. Any problem ?

kushal-ost commented 5 years ago

Can you suggest why BackgroundGeolocation.on('http', callback ) is not working ?

christocracy commented 5 years ago

On vacation until July 23

kushal-ost commented 5 years ago

okay

christocracy commented 5 years ago

When I return, those issues posted to the private repo are going to be attended to first, before those posted here in the public repo.

kushal-ost commented 5 years ago

okay.. no issue

kushal-ost commented 5 years ago

Can you please tell me, is it possible with your plugin or not ? That if I add any geofence then can it trigger any event by the response from adding geofence ? If it is possible caan you suggest how ? It is Urgent.

Steffaan commented 5 years ago

@kushal-ost If you read the documentation, you could see that there are already events to listen to.

Use the geofenceschange event to get notified in case of changes in the monitored geofences. Use the geofence event to get notified in case someone crosses a geofence.

kushal-ost commented 5 years ago

Hi,

When I add a geofence then I don't get any notification of entering into geofence (If using licence key). With same code , when I am not using licence key, I get notification of adding geofence.

This is because http function does not work.

 bgGeo.on('http', function(response) {
            console.log('res: ', response);
        }, function(response) {
            var status = response.status;
            var responseText = response.responseText;
            console.log("- HTTP failure: ", status, responseText);
        })

I am not able to get console anything inside http function.

Please suggest.

christocracy commented 5 years ago

post logs from the plugin. See wiki “Debugging”.

I cannot help you without logs.

christocracy commented 5 years ago

Do not pollute the thread with long logs. Attach as file.

(Your last comment has been deleted)

kushal-ost commented 5 years ago

Please find the attached log, when I open the app. I do not get the log when I add the geofence. log.txt

christocracy commented 5 years ago

What are all these #getCurrentPosition requests in the logs from?

Verify your license is correctly installed by viewing wiki "License Validation Failure"

kushal-ost commented 5 years ago

Yes... Licence is correct.

kushal-ost commented 5 years ago

Current position is showing correct position.. but http is not working. Please help

christocracy commented 5 years ago

Paste your entire AndroidManifest.xml.

why are you executing so many current position requests??

kushal-ost commented 5 years ago

Issue is that when I add any geofence then i am not able to get response in bgGeo.on('http', function(response) { .... } Although my server returns id in response when any geofence is added.

Please help me out in this.

christocracy commented 5 years ago

Please stop saying “please help” and answer the questions I ask.

This is the 3rd time I’ve asked: why are you executing getCurrentPosition so many times??

kushal-ost commented 5 years ago

I m using getCurrentposition to refresh latitude n latitude after fix interval of time. I m using setTimeInterval

kushal-ost commented 5 years ago

How to check whether the url in bgGeo.ready is working or not using this plugin ? i think I am not getting the response from this.

christocracy commented 5 years ago

I see nothing in your logs showing you’re monitoring any geofences.

kushal-ost commented 5 years ago

please check this log... This log comes when I open the app

new_log.txt

kushal-ost commented 5 years ago

Is there any method to test whether the url in bgGeo.ready() is providing any response or not ?

christocracy commented 5 years ago

Your logs do not show any geofence events so you should not expect HTTP events.

kushal-ost commented 5 years ago

Then how to correct this ?

christocracy commented 5 years ago

I don't know what your problem is.

kushal-ost commented 5 years ago

My issue is that : When i add any geofence then I should get response from the url which I am using in bgGeo.ready{ ..url:"http://www.childfinda.com/process/geofence.php",... } and the basis of this response I want to call any function.

From postman , I am able to get response of this url, but using this plugin I am not able to console response of bgGeo.on('http', function(response) { ... }

christocracy commented 5 years ago

Like I said:

Your logs do not show any geofence events so you should not expect HTTP events.

Do you see any geofence events occurring in your logs? I don't. Why should you expect to see an http event from a geofence event which has not fired?

kushal-ost commented 5 years ago

I already told you that log was of when my app just opened. When I add any geofence then I am getting an array of geofence.

christocracy commented 5 years ago

When I add any geofence then I am getting an array of geofence.

An array of geofences from what?

kushal-ost commented 5 years ago

Now you can see geofence: Please find the log Like I have "My place" as geofence geofence_log.txt

christocracy commented 5 years ago

You're not answering my questions

An array of geofences from what?

Like I have "My place" as geofence

Yes, fine. So you've added a geofence. I don't see that geofence event firing (ie: exit / enter)

kushal-ost commented 5 years ago

Array of geofence from my server..

I am creating geofence of the same area where I am present.. So it should fire event of enter/exit.. But it does not.

kushal-ost commented 5 years ago

I am using: bgGeo.on('geofence', function(geofence) { var location = geofence.location; var identifier = geofence.identifier; var action = geofence.action; console.log('A geofence has been crossed: ', identifier); console.log('ENTER or EXIT?: ', action); console.log('geofence: ', JSON.stringify(geofence)); });

But it do not console anything.

christocracy commented 5 years ago
kushal-ost commented 5 years ago
  1. What is mocking the location means ?
  2. I am using in real Android mobile.
  3. {"placeName":"My place","userId":63,"circleToken":"6PHSWI","placeGPSlat":28.6406407,"placeGPSlong":77.1133774,"placeGPSradius":1000,"transitionType":3}:
kushal-ost commented 5 years ago

BackgroundGeolocation.addGeofence({ identifier: place.placeName, radius: place.placeGPSradius, latitude: place.placeGPSlat, longitude: place.placeGPSlong, notifyOnEntry: $scope.geofence.notifyOnEntry, notifyOnExit: $scope.geofence.notifyOnExit, notifyOnDwell: false, loiteringDelay: 30000, // 30 seconds extras: { // Optional arbitrary meta-data place_id: place.place_id, circleToken: place.circleToken, userId: $localStorage.userMaster.id } }

christocracy commented 5 years ago
kushal-ost commented 5 years ago
  1. Yes wifi enabled.
  2. Yes it is high accuracy
  3. yes using cordova run andrioid
christocracy commented 5 years ago

Show me the config {} you're providing to #ready

kushal-ost commented 5 years ago
        bgGeo.ready({
        // Geolocation config
        desiredAccuracy: 0,
        distanceFilter: 10,
        stationaryRadius: 25,
        // Activity Recognition config
        activityRecognitionInterval: 10000,
        stopTimeout: 5,
        // Application config
        debug: true,  // <-- Debug sounds & notifications.
        reset:true,
        stopOnTerminate: false,
        startOnBoot: true,
        // HTTP / SQLite config
        method: "POST",
        autoSync: true,
        maxDaysToPersist: 3,
        url:"http://www.childfinda.com/process/geofence.php",
        params: {
            user_id: $localStorage.userMaster.id,
            },
        headers: {
            'Authorization': $localStorage.apiAccessToken,
            'Content-Type' : 'application/json'
            }
        }, function(state) {
        // This callback is executed when the plugin is ready to use.
        console.log("BackgroundGeolocation ready: ", state);
        if (!state.enabled) {
        bgGeo.start();
        }
        });
christocracy commented 5 years ago

You don't think you might want LOG_LEVEL_VERBOSE when having problems, as mentioned in Wiki Debugging?

Add logLevel: bgGeo.LOG_LEVEL_VERBOSE

Now fetch more logs.

kushal-ost commented 5 years ago

Please find the updated log

updated_log.txt

christocracy commented 5 years ago

Now that you've provided VERBOSE logs, I see a geofence event fired with 3 successful HTTP requests.

07-30 19:27:03.981 DEBUG [TSGeofenceManager a] 
╔═════════════════════════════════════════════
║ TSGeofenceManager found 3/3 within 1000 meters
╠═════════════════════════════════════════════
╟─ 🎾  My place
╟─ 🎾  school
╟─ 🎾  new place
╚═════════════════════════════════════════════
07-30 19:27:04.467 INFO [GeofenceService onHandleIntent] 
╔═════════════════════════════════════════════
║ Geofencing Event: ENTER
╠═════════════════════════════════════════════
╟─ new place
╟─ school
╟─ My place
╚═════════════════════════════════════════════
07-30 19:27:04.507 DEBUG [TSLocationManager a] 23.536
07-30 19:27:04.559 INFO [c persist] 
  ✅  INSERT: 44e81abb-368f-4065-a488-a79231546f75
07-30 19:27:04.601 DEBUG [HttpService flush] 
╔═════════════════════════════════════════════
║ HTTP Service
╠═════════════════════════════════════════════

07-30 19:27:04.620 INFO [c persist] 
  ✅  INSERT: 6a2da7eb-9eca-4788-85cc-b505b3d05019
07-30 19:27:04.699 DEBUG [c first] 
  ✅  Locked 1 records
07-30 19:27:04.713 INFO [HttpService a] 
  🔵  HTTP POST: 44e81abb-368f-4065-a488-a79231546f75
07-30 19:27:04.713 INFO [c persist] 
  ✅  INSERT: 8055db15-15bc-47b0-8ca1-2384077b6ca6
07-30 19:27:04.814 WARN [BackgroundGeolocation$i run] 
  ⚠️  HTTPService IS BUSY.  This probably should not run!
07-30 19:27:04.815 WARN [BackgroundGeolocation$i run] 
  ⚠️  HTTPService IS BUSY.  This probably should not run!
07-30 19:27:05.152 INFO [HttpService$a onResponse] 
  🔵  Response: 200
07-30 19:27:05.174 DEBUG [c destroy] 
  ✅  DESTROY: 44e81abb-368f-4065-a488-a79231546f75
07-30 19:27:05.242 DEBUG [c first] 
  ✅  Locked 1 records
07-30 19:27:05.262 INFO [HttpService a] 
  🔵  HTTP POST: 6a2da7eb-9eca-4788-85cc-b505b3d05019
07-30 19:27:05.548 INFO [HttpService$a onResponse] 
  🔵  Response: 200
07-30 19:27:05.652 DEBUG [c destroy] 
  ✅  DESTROY: 6a2da7eb-9eca-4788-85cc-b505b3d05019
07-30 19:27:05.910 DEBUG [c first] 
  ✅  Locked 1 records
07-30 19:27:06.042 INFO [HttpService a] 
  🔵  HTTP POST: 8055db15-15bc-47b0-8ca1-2384077b6ca6
07-30 19:27:06.522 INFO [HttpService$a onResponse] 
  🔵  Response: 200
07-30 19:27:06.725 DEBUG [c destroy] 
  ✅  DESTROY: 8055db15-15bc-47b0-8ca1-2384077b6ca6
07-30 19:27:21.296 INFO [a a] 
kushal-ost commented 5 years ago

My bgGeo.on('geofenceschange', function(event) { } is woking.. but bgGeo.on('geofence', function(geofence) { } is not working..

also bgGeo.on('http', function(response) { } is not working..

What may be the reason ?

Please find the attached log. My geofence is "My new school" newlog.txt

christocracy commented 5 years ago

What's the status on this issue?

kushal-ost commented 5 years ago

Hi, I have one issue in this plugin integrating with app. Please understand one scenario. Geofence is created by first device (PARENT) and if second device (CHILD) crosses that geofence then first device should get notified about entry/exit of CHILD.

What event should I use to track geofence is crossed or not?

christocracy commented 5 years ago

onGeofence