1

i am trying to Enable Buletooth for the Application, but in iOS platform there is no possible way to enable bluetooth from the Unity App. so i am trying to open iPhone Settings and then enable bluetooth manually, is there a way to open iPhone Settings from the Unity App

I tried the following code with no Luck

Application.OpenURL("app-settings:root=General&path=Bluetooth");

enter image description here
Thanks in advance

Qusai Azzam
  • 465
  • 4
  • 19

1 Answers1

1

You might have to create a function in your Xcode project for that and call it from Unity.

I don't think Apple lets you navigate the user to their specific pages anymore, but you can prompt the user to launch the Settings app and enable bluetooth from there.

Apple gives you a string constant to open the settings app. I would recommend sticking to that because it is liable to change.

UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!)

Referenced from: Opening the Settings app from another app

Hobbes the Tige
  • 3,753
  • 2
  • 22
  • 21
  • Actually the above code is not acceptable from the Xcode 10, i tried this code but it directs me to my application settings and permission not the General Settings `[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];` – Qusai Azzam Feb 26 '19 at 16:09
  • That is the expected behaviour. You can only open your own app's settings. There are no urls to open any other settings pages directly from your app. Using prefs; urls or similar will result in your app being rejected for using private APIs – Paulw11 Feb 26 '19 at 19:39