简体   繁体   中英

Cordova / Phonegap geofence app solution

I want to build a geofence app with cordova for android. The app gets the geofences from a server which are dynamically created by other users (in another app). These geofences last about 2-3 hours. When the user enters a geofence, he should get informed with a notification.

So far I have found two different ways / plugins which I can use to get the job done:

  1. Track geolocation with BackgroundGeoLocation and send current position to server. The server saves the location and checks if the user enters an active geofence. Then it sends a push notification back to the user.

  2. Use the Geofence plugin. But I don't know how to push new geofences from server to the app. The PushPlugin is not able to push silent informations when app is in background.

So, the first solution consumes more network traffic than the second one, but lets the server do the geofence work. The second one communicates with the server just when it's needed, but there seems to be no plugin which does background silent data pushing. I have to write my own plugin then (unexperienced in java).

Which way would you recommend, or do you have other ideas to solve that problem easier ?

You can use the pushnotification plugin, but will need to edit the GCMIntentService file for the plugin. You will also be able to determine when the silent action should be triggered based on the message information received and the current state of the app.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM