OneSignal Help & Documentation

Welcome to the OneSignal New IA developer hub. You'll find comprehensive guides and documentation to help you start working with OneSignal New IA as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    Discussions

Location-Triggered Notifications

Setting up notifications that trigger based on user location.

Support for location triggered notifications can be achieved in the following ways.

📘

Radar and Plot Projects Integration

We have also partnered with Radar and Plot Projects if you want to integrate with their service.

Target By Country

Country is automatically tracked based on the IP Address. Use the country Data Filter in Segments or API Filters.


Target By Latitude and Longitude

If your Mobile App collects location data, OneSignal will automatically update the latitude and longitude for the device based on the location permission granted by user.

You can ask for location tracking permission through our Location Opt-In Prompt or use our promptLocation SDK Method.

Once location is set, messages can be sent based on a radius around the location point using the location Data Filter in Segments or API Filters.

Starting with android 8, background updates are limited to "a few times every hour", in our tests, this appears to be 4 times per hour.

On our end, we might change how often we update this information from time to time for optimization reasons but currently we check the user's location around every 5 minutes.

Web Push Latitude and Longitude Tracking

OneSignal does not automatically collect location points on web push. You can setup your site to prompt users for Location Tracking and add Data Tags to set it within OneSignal. Here is a great Medium Post about this.

If getting and setting the location points with OneSignal sendTags method, assign "longitude" and "latitude" tags. For example, you could set "long"="37.160" and "lat"="-117.773".

Then you can send a message to users in a segment based on these tags.

For example, define a segment with tags "long" > 37, "long" < 38, "lat" > -118, "lat" < -117 to create a square target region containing users with location tags in that range.

You can do this manually via the New Messages Page, automatically via the Server REST API, or automatically via the Automated Messages Page.


Target By City or Provided Location

OneSignal does not provide a way to track city or area codes. However, if your app/site collects this data, you can send it to OneSignal in the form of Data Tags.

Generally your app/site can collect this data in the following ways:

  • User inputs a city or location into a field on your site/app.
  • Prompt User for Location Tracking on Web and use Google Maps Reverse Geocoding API. Here is a great Medium Post about this.

We have also partnered with Radar and Plot Projects if you want to integrate with their service.


Target based on a Geofence Trigger

iOS

  1. Follow this guide to set up Geofencing on iOS

  2. When a Geofence is triggered, use the OneSignal postNotification method to send a notification to the device.

Android

  1. Follow this guide to set up Geofencing on Android.

  2. When a Geofence is triggered, use the OneSignal postNotification method to send a notification to the device.

Updated 3 months ago


What's Next

Add Data Tags

Location-Triggered Notifications


Setting up notifications that trigger based on user location.

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.