I am developing a map rendering application for Android. The card data is quite large at around 1.1 GB. Since there are restrictions both in the market and in the phone for the .apk size, it is recommended to download it when the application starts.
This is the template I am using now:1. The main activity (used to display the map) checks if data is available if I do not start the download2. The download activity starts from the local service3. The service downloads zip files and unpacks mapdata4. The service sends download activity events and notifications
I start the service, as the whole process can take some time from 30 minutes to several hours depending on the phone and network.
But I have a problem with the fact that only one instance of the program works, I tried all combinations of the launchmode property without help.
As you understand, launching two instances will lead to failure of loading / unpacking.
This is really frustrating! Now I do some ugly read / write sdcard file locks, and it works most of the time to make sure that only one instance works.
I am targeting Android 1.6 and above.
To avoid problems with multiple instances, you should use a remote service instead of a local service. Thus, you can have only one instance of the service that will load the data necessary for the application.
1,1 - . Wi-Fi, , , , . , - , , , , ( ).
, , , , . , , , - . , - , , , / . , , .
, Android GC'd , , , , , , . , - , , . , .
SD-? , , , .
Source: https://habr.com/ru/post/1790698/More articles:org.jdom.input.JDOMParseException: content not allowed in trailing section - javaPHP function returns boolean - phpdoes anyone know about the push / commet server method in gwt - pushValidateInput (false), но теперь, как сохранить мой HTML-вход чистым? - c#Can someone tell me what dataviz is? - chartscan we make websphere portal CSA and spring MVC3 work together? - websphere-portalForcing the latest version of gcc with cmake - gccWorking with Python databases without ORM - pythonIncluding DB function calls in python MySQLdb executemany () - functionarithmetic overflow hardware interrupt? - mathAll Articles