flutter-geolocator icon indicating copy to clipboard operation
flutter-geolocator copied to clipboard

Open iOS location settings page

Open dark-chocolate opened this issue 8 years ago • 14 comments

🚀 Feature Requests

I would like to see a way to open iOS Location settings page.

Describe the feature

It would be nice to take the user to the Location Services settings page so that he/she can turn on location services from the app. Any kind of intent which we have in Android.

Platforms affected (mark all that apply)

iOS

dark-chocolate avatar Nov 30 '18 07:11 dark-chocolate

Not Just iOS it will be nice if we can open both iOS and Andriod Location Settings using just one package

caztial avatar Jan 15 '19 08:01 caztial

@dark-chocolate @caztial, Use PermissionHandler().openAppSettings() from the package permission_handler.

cetorres avatar Feb 05 '19 21:02 cetorres

@cetorres That will open your app settings page, not the phone Location settings page.

dark-chocolate avatar Feb 07 '19 14:02 dark-chocolate

I believe Apple provides no public API to open the Settings app on a particular page. They are now rejecting apps that use the private 'prefs:' API. See: https://github.com/mauron85/cordova-plugin-background-geolocation/issues/394

TLDR: This feature cannot be implemented.

mleonhard avatar Mar 09 '19 08:03 mleonhard

@mleonhard I've seen couple of apps on the app store which does the same, they take you to the location page, where you can turn on the location services. I'm not sure what they did behind the scene.

dark-chocolate avatar Mar 09 '19 08:03 dark-chocolate

yes just install Uber and see

caztial avatar Mar 11 '19 08:03 caztial

@mleonhard I've seen couple of apps on the app store which does the same, they take you to the location page, where you can turn on the location services. I'm not sure what they did behind the scene.

Those must be old apps that have not been updated since Apple changed tightened their policy.

yes just install Uber and see

I just checked. I went to Settings / Privacy / Location Services, tapped the Location Services switch, and tapped the Turn Off button on the popup. Then I opened the Uber app, which showed a screen with a box "Enter pickup point" and a button "Turn on location services". Tapping the button opens the Uber app settings page with the Location option greyed out. Uber app 3.342.10000 on iOS 12.1.4.

I found no allowed way for an app to open the iOS Settings app to the Location Settings page.

TLDR again: This feature cannot be implemented.

mleonhard avatar Mar 14 '19 09:03 mleonhard

@StijnWoerkom May I know why this issue was closed?

dark-chocolate avatar Oct 11 '19 11:10 dark-chocolate

@dark-chocolate As @mleonhard stated, there is no allowed way for an app to open the iOS Settings app to the Location Setting page. I looked into this and came to the same conclusion. Unless you have found a way that it is possible to implement this feature, it will stay remaining closed.

StijnWoerkom avatar Oct 11 '19 12:10 StijnWoerkom

I guess these guys have managed. Check out this for reference: https://pub.dev/packages/app_settings It would be great if we can get this feature with this good plugin. 👍

techiesanket avatar Oct 23 '20 11:10 techiesanket

I guess these guys have managed. Check out this for reference: https://pub.dev/packages/app_settings It would be great if we can get this feature with this good plugin. 👍

Hi @techiesanket,

I mean no offense here but have you actually tried the plugin? Analyzing the iOS code it looks like it does exactly the same as we do at the moment. There are also issues confirming the behavior.

And indeed if I try it myself I am only able to open the Settings page on iOS:

import 'package:app_settings/app_settings.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
        title: 'Flutter Demo',
        home: Scaffold(
          floatingActionButton: FloatingActionButton(
            child: Icon(Icons.settings),
            onPressed: () => AppSettings.openLocationSettings(),
          ),
        ));
  }
}

mvanbeusekom avatar Oct 23 '20 15:10 mvanbeusekom

I was facing the same issue. The reason behind the problem is that setting.bundle is not being added while project cration for ios. For that what you need to do is to add the setting bundle as below.

  1. Open ios folder in xcode
  2. Open Runner entry in the project view, it should contain a bunch of folders, one of which is Runner again Right-click the inner Runner entry
  3. Select New file...
  4. Select Settings Bundle and confirm the selection (then press create with default settings)
  5. Open Root.plist file and remove all Preference Items so that the array is empty
  6. Once you reinstall the app, an entry in settings should appear. Once you request some permission (e.g. location) and deny/approve it, it should be automatically added there.

https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/UserDefaults/Preferences/Preferences.html

royalraju96 avatar Mar 21 '22 06:03 royalraju96

https://stackoverflow.com/questions/70657051/app-settings-not-present-in-system-settings-in-ios/70657052#70657052

royalraju96 avatar Mar 21 '22 06:03 royalraju96

🚀 Feature Requests

I would like to see a way to open iOS Location settings page.

Describe the feature

It would be nice to take the user to the Location Services settings page so that he/she can turn on location services from the app. Any kind of intent which we have in Android.

Platforms affected (mark all that apply)

iOS

I was facing the same issue. The reason behind the problem is that setting.bundle is not being added while project cration for ios. For that what you need to do is to add the setting bundle as below.

Open ios folder in xcode Open Runner entry in the project view, it should contain a bunch of folders, one of which is Runner again Right-click the inner Runner entry Select New file... Select Settings Bundle and confirm the selection (then press create with default settings) Open Root.plist file and remove all Preference Items so that the array is empty Once you reinstall the app, an entry in settings should appear. Once you request some permission (e.g. location) and deny/approve it, it should be automatically added there. https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/UserDefaults/Preferences/Preferences.html

royalraju96 avatar Mar 21 '22 06:03 royalraju96