当您使用地图在特定地点附近时如何接收推送通知? [英] How to receive a push notification when you are near a specific place using a map?
问题描述
我是 Ionic 的新手,我想知道您是否可以给我一些指导.我正在使用 Ionic 1.我看过教程,他们使用 Google 或一个信号.但它们始终是基本教程,我有很多疑问.我希望在 iOS 和 Android 上都这样做.
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.
我的应用程序在数据库中有一些坐标,我通过 Web 服务获取它们.我希望当我在某个地方附近时收到推送通知.我目前正在使用 Google 地图插件 cordova-plugin-googlemaps
和地理位置插件 cordova-plugin-geolocation
.
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.
我使用的是 Ionic 1,并且数据库是使用 PHP 在 MySQL 中构建的.我认为推送通知是从后端生成的?
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?
总结:
什么是最好的选择?我正在考虑一些插件,它可以在我的位置更改以及发生这种情况时在后台检测(cordova-plugin-geolocation 是否做到了?)验证我是否靠近某个地方并发送本地通知.例如,当我点击此通知时,我可以获得该地点的 id 并重定向到我的应用程序中的某个地点.
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.
推荐答案
我觉得你应该试试 geofence
示例链接:
https://github.com/cowbell/ionic-geofence 使用 Ionic 框架构建
https://github.com/cowbell/ionic-geofence built with Ionic framework
https://github.com/tsubik/ionic2-geofence 使用 Ionic 2 构建框架
https://github.com/tsubik/ionic2-geofence built with Ionic 2 framework
这篇关于当您使用地图在特定地点附近时如何接收推送通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!