You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of LiveSync for Android works in the following way:
CLI uploads files to /data/local/tmp/<app id> on the device. NOTE: This directory is just a temp dir on the device. As CLI uses adb shell to push the files there, all files are owned by the root user.
Once application starts, Android runtime checks if there are any files inside /data/local/tmp/<app id> and in case yes, it copies them in the application sandbox. After that, the Android runtime tries to remove the files from /data/local/tmp/<app id> as they have already been copied in the sandbox.
Application starts with all LiveSynced files.
When a change is applied during LiveSync, CLI uploads the modified file to the same location ( /data/local/tmp/<app id>) and the same logic is applied.
However, the last part of step 2 (runtime trying to delete files from /data/local/tmp/<app id>) fails on all Samsung devices and also on all new API versions. The reason is that the runtime runs with a different user, not the root one, and it does not have permissions to delete the files CLI created with root user. CLI cannot use the same user as the runtime does, so the only possibility is to use root user for uploading files to the /data/local/tmp/<app id> location.
When the files in /data/local/tmp/<app id> are not deleted, the LiveSync continues working, but the files in the application may not be the one you've exepected, i.e. its behavior becomes unknown. For example, in case you stop the LiveSync, apply several changes in your application, build and deploy it on device (without using LiveSync), the .apk you've deployed will contain your changes. However, once the application starts, it will check the /data/local/tmp/<app id> location, the last synced files will still be there, as the runtime was unable to delete them, and they'll be taken in the Application sandbox. So once the application starts, you may see the old files of your app.
In order to resolve this issue, implement LiveSync through sockets. The idea is:
When LiveSync starts, CLI creates a temp file on device, inside /data/local/tmp/<app-id>-livesync-in-progress.
CLI starts Android runtime, so a connection between CLI and application can be established.
Android runtime opens a new connection, so CLI can start transferring files.
Android runtime checks if there's a file /data/local/tmp/<app-id>-livesync-in-progress and if it is created less than a minute ago. In case yes, runtime does not start the JS application, i.e. it does not run the v8 engine, as the LiveSync operation is in progress.
CLI transfers all files through socket.
CLI deletes the /data/local/tmp/<app-id>-liveSync-in-progress file from device.
CLI restarts the application.
Runtime starts and detectes there's no /data/local/tmp/<app-id>-livesync-in-progress file, so it loads the v8 engine and starts the application.
The text was updated successfully, but these errors were encountered:
The current implementation of LiveSync for Android works in the following way:
/data/local/tmp/<app id>
on the device. NOTE: This directory is just a temp dir on the device. As CLI usesadb shell
to push the files there, all files are owned by the root user./data/local/tmp/<app id>
and in case yes, it copies them in the application sandbox. After that, the Android runtime tries to remove the files from/data/local/tmp/<app id>
as they have already been copied in the sandbox.When a change is applied during LiveSync, CLI uploads the modified file to the same location (
/data/local/tmp/<app id>
) and the same logic is applied.However, the last part of step 2 (runtime trying to delete files from
/data/local/tmp/<app id>
) fails on all Samsung devices and also on all new API versions. The reason is that the runtime runs with a different user, not the root one, and it does not have permissions to delete the files CLI created with root user. CLI cannot use the same user as the runtime does, so the only possibility is to use root user for uploading files to the/data/local/tmp/<app id>
location.When the files in
/data/local/tmp/<app id>
are not deleted, the LiveSync continues working, but the files in the application may not be the one you've exepected, i.e. its behavior becomes unknown. For example, in case you stop the LiveSync, apply several changes in your application, build and deploy it on device (without using LiveSync), the.apk
you've deployed will contain your changes. However, once the application starts, it will check the/data/local/tmp/<app id>
location, the last synced files will still be there, as the runtime was unable to delete them, and they'll be taken in the Application sandbox. So once the application starts, you may see the old files of your app.In order to resolve this issue, implement LiveSync through sockets. The idea is:
/data/local/tmp/<app-id>-livesync-in-progress
./data/local/tmp/<app-id>-livesync-in-progress
and if it is created less than a minute ago. In case yes, runtime does not start the JS application, i.e. it does not run the v8 engine, as the LiveSync operation is in progress./data/local/tmp/<app-id>-liveSync-in-progress
file from device./data/local/tmp/<app-id>-livesync-in-progress
file, so it loads the v8 engine and starts the application.The text was updated successfully, but these errors were encountered: