开发者

Check user location before they see Push Notification Message?

开发者 https://www.devze.com 2023-04-01 08:12 出处:网络
Would someone happen to know a small code sniplet to get and compare the users location before they see a push message inside the开发者_运维技巧 appDelegate class?If the app isn\'t running, then you c

Would someone happen to know a small code sniplet to get and compare the users location before they see a push message inside the开发者_运维技巧 appDelegate class?


If the app isn't running, then you can't 'get in the way' the message will be displayed to the user. And where I say running I mean in the foreground and with the screen on.

If the app is running, then you can embed arbitrary information (such as a relevant location) with the push notification payload. When this is delivered to your app's delegate, you can check for their location as you normally would, and if the user is where you'd like them to be you can pop up a message to them.

It seems like a lot of hard work for people that are actually using the app at the time that the notification is delivered though. What will you do about all the users who aren't running the app and get the push notification popup without the check?

0

精彩评论

暂无评论...
验证码 换一张
取 消