1

In the current state of the project I'm currently working on, I have a classic Android Studio project with a classic app on it.

For some good reasons (it's an embedded app), I would like to include an auto-update feature in the app, which doesn't require to exit it (I must stay inside the app or another app and never show the underlying Android system).

I have two solutions to do this :

  • Create another "updater" app which updates the app using the package manager command. It requires a rooted device to work, but it would suit my needs : when an update is available, the main app closes itself and opens the updater app which updates the main app and starts it back
  • Have the actual code of the application stored to the external storage and turn the APK into a bootstraper which downloads and runs the app

The later solution is the better one since it doesn't require a rooted device.

This is why I would like to write an elegant system to achieve this ; the development of the app should not be crippled by this (e.g. I don't have to upload the new classes at each build, I don't need to do extra voodoo work to add activities or permissions to the manifest...).

I thought of using the build variants of Android Studio :

  • Debug variant : build the app like usual, don't use the bootstraper
  • Release variant : don't include all the classes in the APK, build an external JAR which contains them and use the boostraper in launcher intent

I saw how to load external classes from the external storage, but I couldn't find anything on how to externalize the whole app code, including activities. I have the feeling that we just can't.

Would such a system be possible to develop ?

natinusala
  • 596
  • 5
  • 21
  • 1
    Why you need to do this? – Haris Qurashi May 16 '17 at 11:49
  • Because I need to be able to update the app without exiting it, it's an embedded app for visually impaired people (for a custom device) and if we exit the app to return to Android they'll be "lost"' – natinusala May 16 '17 at 11:54
  • Standard procedure to update your app is to navigate user to playstore link and user will click on update/install button. I strongly advice try not to override default feature or load your classes/jar from external system etc. – Haris Qurashi May 16 '17 at 12:00
  • There will be no Play Store as it's in an embedded app in a special device, that's why I need another update route – natinusala May 16 '17 at 12:02

0 Answers0