React Native Open settings through Linking.openURL in IOS

前端 未结 6 2186
失恋的感觉
失恋的感觉 2021-02-05 20:32

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 so

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-02-05 20:52

    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:')
      }
    }
    

提交回复
热议问题