How to receive a push notification when you are ne

2019-06-27 21:11发布

问题:

I'm new to Ionic, and I'd like to know if you can give me some guidance. I am using Ionic 1. I have seen tutorials, and they use Google or one signal. But they are always basic tutorials and I have many doubts. I hope to do this for both iOS and Android.

My application has some coordinates in the database, I get them with a web service. I would like that when I'm near a place I get a push notification. I am currently using the Google Maps plugin cordova-plugin-googlemaps and the geolocation plugin cordova-plugin-geolocation.

  • I would like you to give me advice or if you have had the experience of doing something like this.

  • I also want to know if doing this has any cost.

  • I am using Ionic 1 and the database is built in MySQL using PHP. I think the push notification is generated from the back-end?

  • When I tap on the notification, can it contain an iconor redirect to a specific place in my app?

In conclusion:

What is the best alternative? I was thinking of some plugin that detects in the background when my location changes and when this happens (does the cordova-plugin-geolocation do it?) verify if I'm close to a certain place and send a local notification. For example, and when I tap on this notification I can get the id of that place and redirect to a place in my app.

回答1:

I think you should try geofence

repo link

example links:

https://github.com/cowbell/ionic-geofence built with Ionic framework

https://github.com/tsubik/ionic2-geofence built with Ionic 2 framework