I tried to create a offline bundle in react native for android app.I used the following steps :-
react-native init myProject
react-native run-android
created offline js bundle using the following command:-
reac-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest asset-path
Then build an apk with the following command and installed in a device and everything is fine.
.\gradlew assembleRelease
Now my question is can the app in device fetch the bundle from a specific server for example in this case i like to keep the index.android.bundle in a remote server and each time when user opens the app it should fetch from specific ip. So i need to provide the ip address some where before creating bundle.
After some google i found AppDelegate.m is the file for ios where we can mention the ip address.And for android it is mainactivity where you over ride the getJSBundle method but the information was not clear.Any links or steps to do this is helpful.
I accomplished this using following steps and hope will be helpful.
react-native bundle --platform android --dev false --entry-file index.android.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res/
In Case of Android:-
In Case of IOS:-
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.