简体   繁体   中英

Determine in code if app runs in Expo Go or not (in production build)

I would like to determine in react native code if the app is running in Expo Go or as a stand-alone iOS/Android app.

I can't use __DEV__ , because I would like to be able to determine this also for a production build.

You can use Expo's AppOwnership from Constants

import Constants from 'expo-constants'

const isRunningInExpoGo = Constants.appOwnership === 'expo'

source

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM