Search code examples
androidandroid-activityandroid-internet

Data update in offline app


I'm developing an Android App for the tourism sector. All data is available offline without any internet connection. The app includes a map where the data is also only available in an offline mode. So, I use Openstreetmap with osmdroid for this and all the needed map data is included in the app-file. The only activity that may connect to the internet is when launching the app, to check if there is new data available and eventually download the new data into the app folders.

I've added a block diagram of the views: enter image description here

My problem is, how can I make only the first activity, which is the launch activity (red-block in the image), connect to the internet and be sure that all the other activities in no case be able to connect to the internet. Because it's very important that my activity with the Openstreetmap may not connect to the internet to download new map tiles, when the user scrolls out of the region of the integrated maps. It is not intended to completely turn off the network connection for the whole Android device, so it's also turned off for other apps.

Thanks a lot in advance!


Solution

  • If you declare

       <uses-permission /> 
    

    for Internet in Manifest, then that is applicable for all the Activities. You can not limit what the external libraries do. So try to use trusted libs.