Merge: Android service support: reliably run Nit code in the background
authorJean Privat <jean@pryen.org>
Mon, 14 Mar 2016 18:45:16 +0000 (14:45 -0400)
committerJean Privat <jean@pryen.org>
Mon, 14 Mar 2016 18:45:16 +0000 (14:45 -0400)
commit1dc2f83b95e3a6952f52f51fc643f61f4dbdf447
tree6928b7185f14d7e693d0a66da25d9c6c922c4cb4
parent96bf18979a61b35044a267d59c5fb8f8a5ed250c
parent3e31b308243d6e1fec771b1e4a61e63d3ed1b92d
Merge: Android service support: reliably run Nit code in the background

Add support to create Android services in Nit, working alongside activities implemented in Nit. The service can be launched on demande or at the device boot. Only one Nit service at a time can run per package. However the same service can be started more than once and you can do pretty much anything on the Nit side since it shares the same process as the activities.

Uses a broadcast receiver to launch service at boot. This receiver could be used to catch other broadcast, but it currently does not preserve the original intent.

Also updates most Android related modules to use `native_context` instead of `native_activity` so they can be called from services, when the Android API allows it. Some services had to be modified sightly, like the default `SharedPreferences` which is now named (instead of using the one attached to the activity). It should not break any clients as most use `data_store` which was already named.

Pull-Request: #1982
Reviewed-by: Jean Privat <jean@pryen.org>