Pergunta

I'm running Android on a system-on-a-chip board (ODROID-U2). So, there are scenarios when I don't have any keyboard or screen connected to the board. Anyway, there is a small service app running which I want to update if a new release is available (developed by me).

So there are two options. a) download a new APK from an URL or b) plug an USB stick into the device and install the new update if found.

I already read this article but some question remain. Maybe you can give me a starting point.

  1. How would you implement a periodical loop that checks if an update is available online.
  2. How can the downloaded APK file be installed automatically without showing it in the file explorer? This article opens the explorer instead.
  3. Using an USB stick instead of Web-download needs to listen on android.intent.action.UMS_CONNECTED intent and then looking for a new APK file on the stick, right?
Foi útil?

Solução

1. How would you implement a periodical loop that checks if an update is available online.

You have to run a service(in the background of the app) which checks whether new version is available. You could use Alarm Manager to run service periodically.

2. How can the downloaded APK file be installed automatically without showing it in the file explorer? This article opens the explorer instead.

AFAIK, Only Google Play can do that. No other app has permissions to do that. Unless user explicitly says "Yes install it" by clicking install button.

3. Using an USB stick instead of Web-download needs to listen on android.intent.action.UMS_CONNECTED intent and then looking for a new APK file on the stick, right?

Yes, Even then I am not sure if the app updates automatically. Because it has the same problem (#2).

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top