Add an ‘Enable Location Services’ button

What this button does

The Enable Location Services button gives your app users a simple way to reach the device’s location permission — a built-in content type you drop straight into your layout. Tap it, and the app opens the device’s own location settings, where a user can turn location on, or flip it back on after declining.

Here’s why that matters: the phone’s own location permission is essentially a one-time ask. Once a user declines it, your app can’t pop that system prompt again — the only way back is for them to flip the switch in their phone’s own Settings. An Enable Location Services button hands them a shortcut straight to that screen, so they never have to go hunting for it.

Pair this button with any feature in your app that depends on GPS, for instance:

  • Map screens with markers
  • Geofilters (filter content by the user’s city / nearby radius)
  • Nearby listings, directory distance, or check-in features

Before you start

  • You need WordPress admin access to Mobile App Manager.
  • mam-main must be active (the content class ships with MAM Main).
  • Decide where the button should appear — the main navigation tab bar or the left menu — and which user role(s) should see it. App content is configured per role.
  • Decide what should fire the location prompt for your users. The Enable Location Services button opens the device location settings; it is a manual entry point, not the automatic permission rationale screen.

Add the button

Your app’s buttons all come together in one place: Mobile App Manager → App Setup, where each button is a single content element you place in either the main tab bar or the left menu, one role at a time.

  1. Open Mobile App Manager → App Setup.
  2. Choose the role whose app layout you want to edit (for example, the default mam-all role).
  3. Choose the placement section — main navigation or left menu — depending on where you want the button.
  4. Add a new button and set its content type to Enable Location Services.
  5. This content type requires no per-button content settings — the App Setup form shows “No settings required”, and that’s by design: the button’s only job is opening the device’s location settings.
  6. Give it whatever label/title and icon you’d give any other button — for example, “Enable Location” with a map-pin icon — using the same design controls you already know.
  7. Save the App Setup layout.

Make sure GPS is actually enabled for the app

Adding the button only builds the in-app shortcut — for location features to actually work, your app build itself needs to declare and request location access. That comes down to two settings, both living outside the button itself:

  1. Turn on GPS for the app. In the app’s general settings, make sure the Use GPS option (tsl-setting-use_gps) is turned on. Flipping this is what sets use_gps to yes in the publish payload — skip it, and the build ships without location capability at all.
  2. Write the iOS permission string. iOS won’t let you publish without a plain-English reason for using location — that’s the GPS / location usage message (ios_app_gps_message), set in the Publish Your App step. Apple’s reviewers reject anything vague here, so spell out why your app needs location (for example: “Used to show listings near you and filter results by your city”).

Test it

  1. Build or preview the app for the role you set up — the WPMAM Previewer App can render your App Setup layout without a full build.
  2. On a device with location off (or with permission previously denied), tap the Enable Location Services button.
  3. Confirm the device’s location settings open.
  4. Turn location on, return to the app, and check that your GPS-dependent screens (map, geofilters, nearby listings) now work as expected.

How it fits together

Piece Where it lives Role
Enable Location Services button App Setup → main tab bar or left menu, per role In-app shortcut that opens the device location settings
Use GPS (tsl-setting-use_gps) App general settings Declares the app uses location; sets use_gps: yes in the publish payload
GPS usage message (ios_app_gps_message) Publish Your App step The iOS permission-rationale string Apple shows

The button doesn’t hold on to any configuration of its own, and it doesn’t add anything to the per-button mobile payload beyond identifying itself as the open_location_preferences action. On the device, its entire job is routing the user to the OS location settings.


  • Add a Map button to your app
  • Enable Geofilters so users can filter content by city
  • Publish your app (where the GPS usage message is set)

Verification

This article was drafted against:

  • mam-main/includes/content-classes/local-app-enable-location-services-content-class.php (content class definition: content_type = 'Enable Location Services', class = open_location_services, vc_type = open_location_preferences, no per-button settings)
  • mam-main/includes/content-classes/README.md (content-class model and App Setup button placement)
  • mam-main/includes/app-settings/mam-app-settings.php (use_gps from tsl-setting-use_gps; gps_message from ios_app_gps_message)
  • mam-main/includes/app-settings/local-app-app-setup-class.php (main vs. left-menu placement, per-role content)

Re-verify if the content-type label changes, if the class begins exposing per-button settings, or if the GPS enablement / permission-string settings are renamed or relocated in the admin UI.

Was this article helpful?
Contents

    Need Support?

    Can't find the answer you're looking for? Don't worry we're here to help!