Easily request location access from users by using a OneSignal in-app message as a soft pre-prompt before showing the required native system-level location permission dialog. This improves opt-in rates and gives you more control over when and how to ask. Alternatively, you can directly trigger the system prompt using our Mobile SDK location methods.


Requirements

Before creating your in-app message:

  • Add location tracking permissions to your app (for both Android and iOS).
  • Enable location sharing with OneSignal in your app code.

Create your message

1

Create your message

In the OneSignal dashboard, go to: Messages > In-App > New In-App

2

Audience

  • If all users should see the prompt, select Show to all users.
  • Otherwise, target a specific Segment.
3

Message design

  • Clearly explain why location access benefits the user. E.g., “Enable location to receive relevant local updates.”
  • Be concise but specific to increase opt-in likelihood.

Image showing in-app blocks and ability to add click actions alongside preview


Add the Location Permission Prompt Click Action

1

Add a button or image

Add a button or image with a clear call to action (e.g., “Enable Location”).

2

Add a click action

In the options:

  • Click Add Click Action
  • Select Location Permission Prompt

When clicked, OneSignal will trigger the native, required system-level location prompt.

If location is already enabled, the message won’t show to avoid unnecessary prompts.

Both Android and iOS limit how frequently system-level prompts can appear. Using this soft pre-prompt helps avoid those limitations and allows for repeat attempts if needed.

Image showing in-app blocks and ability to add click actions


Trigger the in-app message

You can control when and how the prompt is shown.

Option 1: Time-based triggers

Show the message after a user has been in the app for a set amount of time (e.g., after 30 seconds).

Image showing session in-app trigger.

Option 2: Programmatic triggers

Control exactly when the prompt appears via the SDK:

1

Add the trigger code to the app.

Use our SDK’s addTrigger method to set a key like location_prompt and value like true. Then call this whenever you want inside your app.

2

Add the trigger to the message

Set the same trigger key (location_prompt) and value (true) in your in-app message settings.

Image showing programmatic In-app trigger.


Set the message frequency

To avoid spamming users:

  • Choose Multiple times
  • Set a number of times to show the message
  • Set a gap between each attempt

Example setting: show up to 5 times, with a 4-week gap between each attempt

This allows monthly reminders for up to 5 months, striking a balance between persistence and user experience.

Example scheduling configuration for repeat prompts.


Best Practices

  • Always explain the benefit of location access to users.
  • Use segmentation or triggers to avoid asking at a bad time.
  • Pre-prompts increase opt-in rates and avoid operating system limits.
  • Ensure location permissions are correctly configured in your app before triggering the in-app message.

You will start to see location points being tracked in your Users and Subscriptions pages.

Create Location-triggered messages.