First-Load-Offline for Detached App

#1

I’m trying to archive the First-Load-Offline in the detached app.
Any one have any idea?
Have anyone tried with the shell-app-manifest.json and shell-app.bundle?
I have spent few our to debug the iOS project and found out some interests about the First-Load and i tried to redirect the code to use the cached js file by adjust the EXShell.plist but not succeed.

1 Like
#2

Hi-

I’m sorry but I don’t totally understand your question.
If you have a detached app you can do all kinds of crazy things.

Do you mean you want the app to be able to be loaded offline with source that is bundled with the app?

Charlie

#3

Yes @ccheever. I want to make my detached app load the bundle file locally

#4

I have the same question. I already detached the app but I need it for offline use. The documentation never mentioned that all of our assets will be loaded via expo server even if the image is loaded locally which is really bad. Most of my users are in southeast asia, and expo server is very slow on our end.

#5

Hi- yeah. You should detach for now. We’ll work on this but it will take some time.

#6

Any news on this, this is a big hold up for me

1 Like
#7

this should work for code but still working on it for image assets etc.

#8

Hi @ccheever, I’ve already read all the topics about offline load in the forum and I think your reply is the latest progress right? As you mentioned:

this should work for code

I think it ‘work’ for the standalone app build by exp right? I just build an android standalone app apk file and install it on the genymotion simulator. After turn off the network and open the app, I can see it works correctly but cannot load image assets, just like you described.

Since there is no doc clarify this behavior, could you explain several questions?

  1. The standalone app build by exp(without detach or eject) will bundle the js code to the install package, and it will still fetch latest js code published to expo. So it should works in offline with local js and can hot update when network is fine?
  2. If 1 is correct, what will happened if the network is slow and user take a long time to fetch new js code from your cdn? Will the app automatically reload when download finished or it will keep silent and use the latest code in next open?
  3. If 1 is correct and stable, I think it can solve most of my problem with offline open. I can upload the remain media assets to some local CDN which my users can download fast and cache it in the file system right?
Packaging detached app with latest js bundle
#9
  1. Yes, the APK/IPA contain an embedded copy of the JS bundle and project manifest. So even on the first launch after installing you don’t need a network connection.
  2. On Android, standalone apps search for updates only in the background. They launch right away using the most recently downloaded JS bundle and project manifest. The app will not automatically reload (since this would be a disruptive user experience) and will use the downloaded JS the next time the app is launched from a terminated state.
  3. Yes, you could try that approach and it would probably work for many scenarios.

See this for more info: https://docs.expo.io/versions/latest/guides/how-expo-works.html#publishingdeploying-an-expo-app-in-production

Updates are handled differently on iOS and Android. On Android, updates are downloaded in the background. This means that the first time a user opens your app after an update they will get the old version while the new version is downloaded in the background. The second time they open the app they’ll get the new version. On iOS, updates are downloaded synchronously, so users will get the new version the first time they open your app after an update.

#10

Hi,
we also trying to embedd a version of the js bundle in the Android project.
It seems the manifest/js bundle are not added to the android project and moreover if we launch the app with release configuration and without internet connection, we get this error

FATAL EXCEPTION: OkHttp Dispatcher
Process: …, PID: 11378
java.lang.RuntimeException: Could not load app.

We are using Expo sdk 22 and we detached the project

Is there a setting we didn’t properly valorized? I’m really struggling in finding a solution