mauron85 / react-native-background-geolocation-example

Example app of react-native-mauron85-background-geolocation component.
120 stars 45 forks source link

I need to send data to mysql database through php backend #10

Open danushikay opened 5 years ago

danushikay commented 5 years ago

I need to send data to mysql database through php backend, configured as follows but no luck BackgroundGeolocation.configure({ desiredAccuracy: BackgroundGeolocation.HIGH_ACCURACY, stationaryRadius: 50, distanceFilter: 50, notificationTitle: 'Background tracking', notificationText: 'enabled', debug: true, startOnBoot: true, stopOnTerminate: true, locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER, interval: 10000, fastestInterval: 5000, activitiesInterval: 10000, stopOnStillActivity: false, url: 'http://example.com/the_Application/location_data', httpHeaders: { 'Accept': 'application/json', 'Content-Type': 'application/json' }, // customize post properties postTemplate: { latitude: '2.0909090', longitude: '2.0909090', token: 'DI-1-12122018_102321_1544610201',

     battery : '0.8090'

    // you can also add your own properties
  }
});

Any suggestions welcome.

mauron85 commented 5 years ago

Start by removing ''Content-Type': 'application/json' header! Plugin does send correct content-type automatically as there is no other option to send location as in json format.

mauron85 commented 5 years ago

~And don't remove issue template next time, or your issue will be ignored.~

EDIT: Sorry there is no issue template in this repo. I didn't realized this is example repo.

danushikay commented 5 years ago

thanks But still same , please see attached screen shot capture

mauron85 commented 5 years ago

I don't understand. What I see on screenshot is some kind of websocket connection. And this plugin is only sending locations via http.

danushikay commented 5 years ago

That is my problem too, Don't have any web socket connection coded. only mentioned http url code. Already tested api using postman. Still no clue. :(

danushikay commented 5 years ago

Here is the log

12-14 11:34:32.378 5836-5836/com.rnnavigationtoanothernavigation D/com.marianhello.bgloc.BackgroundGeolocationFacade: Received MSG_ON_LOCATION
12-14 11:34:32.384 2663-6214/com.google.android.gms.persistent W/ctxmgr: [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10013):UserLocationProducer, vrsn=12874000, 0, 3pPkg = null ,  3pMdlId = null ,  pid = 2663). Was: 3 for 1, account#-517948760#
12-14 11:34:32.394 5836-6242/com.rnnavigationtoanothernavigation D/com.marianhello.bgloc.PostLocationTask: Posting json to 
url: https://backmoo.com/Mobile_Application/location_data headers: {Accept=application/json, Content-Type=application/json}
12-14 11:34:32.399 2663-6214/com.google.android.gms.persistent W/ctxmgr: [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10013):UserLocationProducer, vrsn=12874000, 0, 3pPkg = null ,  3pMdlId = null ,  pid = 2663). Was: 3 for 1, account#-517948760#
12-14 11:34:32.405 2663-6214/com.google.android.gms.persistent W/ctxmgr: [AclManager]No 2 for (accnt=account#-517948760#, com.google.android.gms(10013):UserVelocityProducer, vrsn=12874000, 0, 3pPkg = null ,  3pMdlId = null ,  pid = 2663). Was: 3 for 48, account#-517948760#
12-14 11:34:32.414 5836-5836/com.rnnavigationtoanothernavigation W/unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTDeviceEventEmitter.emit(["location",{"speed":0,"longitude":-122.084,"latitude":37.4219983,"id":1710,"time":1544767471000,"mockLocationsEnabled":false,"isFromMockProvider":false,"locationProvider":1,"accuracy":20,"provider":"fused"}])
12-14 11:34:32.415 5836-5836/com.rnnavigationtoanothernavigation D/com.marianhello.bgloc.BackgroundGeolocationFacade: Received MSG_ON_LOCATION
12-14 11:34:32.421 2705-6251/com.google.android.googlequicksearchbox:search E/GmsContextObserver: Received context data while not listening
12-14 11:34:32.428 2705-6251/com.google.android.googlequicksearchbox:search I/chatty: uid=10032(com.google.android.googlequicksearchbox) NonUserFacing16 identical 1 line
12-14 11:34:32.438 2705-6251/com.google.android.googlequicksearchbox:search E/GmsContextObserver: Received context data while not listening