React Native Open settings through Linking.openURL in IOS

一个人想着一个人 提交于 2021-01-20 18:12:42

问题


I want to open ios setting app from my app. the settings destination is [ settings => notification => myapp ]. to turn on & turn off push notification.

There are some documents about how to link to settings, but I don't know how to open deep link. (notification => myapp).

How can I do this?


回答1:


You can deep-link referencing the settings's index like so:

Linking.openURL('app-settings:')

Above method only for IOS




回答2:


Since React Native 0.60 to open App settings use:

Linking.openSettings()




回答3:


Use Linking.openURL. For example, below is how to check and open Health app on iOS

import { Linking } from 'react-native'

async goToSettings() {
  const healthAppUrl = 'x-apple-health://'
  const canOpenHealthApp = await Linking.canOpenURL(healthAppUrl)
  if (canOpenHealthApp) {
    Linking.openURL(healthAppUrl)
  } else {
    Linking.openURL('app-settings:')
  }
}



回答4:


To access specific settings screens, try this: Linking.openURL("App-Prefs:root=WIFI"); Linking to app-settings only opens the settings for the Reference: iOS Launching Settings -> Restrictions URL Scheme (note that prefs changed to App-Prefs in iOS 6)




回答5:


Try this one for Open Specific System URL - Linking.openURL('App-Prefs:{3}')




回答6:


try this

Linking.openURL('app-settings://notification/myapp')


来源:https://stackoverflow.com/questions/44582694/react-native-open-settings-through-linking-openurl-in-ios

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!