Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android - so many problems with the expansion library

i need to use the new google-play (or market) expansion library , and i have hard time with it . i wonder if anyone else is using it and notice the same problems i can see , so i would be very happy if you could help be to fix them:

1.sometimes i don't get important events (errors, for example) back to the downloader activity .

2.it doesn't work at all on some devices , like xoom . i think i've fixed it: Download expansion files on tablet

3.even for identical devices , one can download the file and the other can always get a connection error. for some devices , it will never never be able to download (even non-rooted devices which have the google-play app) .

4.after the download is complete , the file can be corrupted , so i need to use CRC check and re-download everything again .

5.notification sometimes opens multiple instances of the downloader activity upon pressing it. also , i don't get why they let the notification stay in case the activity is still shown .

6.when an error occurs and later handled , it doesn't wait for the user to tell it to resume . i'm not sure in which cases it occur , but it's really weird and unpredictable.

7.upon leaving the downloader activity , i get an exception of a leaking service .

8.upon obfuscating of the app , it crashes because of SQL operations done via the library . how and why is that? EDIT: this is because google decided to make some reflections operations on the SQL part (in the file "DownloadsDB.java") . in order to fix it , i've tried to set proguard to ignore the entire library (it's open source anyway) , but it didn't work , so what i did is to give the classes it wants by myself , so i've replaced "DownloadsDB.class.getDeclaredClasses()" with "new Class[] {MetadataColumns.class, DownloadColumns.class};" .

i just don't get why couldn't google just publish a simple API to send an intent to the market to download the file and check if it's ok , or provide a much less complex library . because of the complexity , it's very hard to find and fix their bugs .

my question is: has anyone else tried this library , and has someone else been successfull in using it without any problems? if so, please publish the solution...


EDIT: it seems google has updated its library (to version 2) .

they claim the next changes:

  • List item
  • Patch file now gets downloaded.
  • Honeycomb devices now supported with ICS-like notifications
  • CRC check (from sample) now supports compressed Zip files
  • Use of reflection removed to allow easy obfuscation
  • Service leak fixed
  • Unprintable character removed from ZipResourceFile
  • Minor formatting changes
  • Additional comments and edits to this file

i've tested it now , and it seems that they are almost there .

the only bug i've found is that if i update the expansion file (and the APK&filesize&CRC) , the download starts but it didn't remove the older expansion file.

also , the notification shows the current time instead of , well , anything else that could be related to the download.

for now , since i have only one expansion , i do the next check each time i get the STATE_COMPLETED state from the service . i hope it doesn't have any other problems :

private void deleteOldExpansionFile()
{
  int fileVersion = 0;
  final int versionCode = App.getAppVersionCode(DownloaderActivity.this);
  fileVersion = versionCode;
  final String fileName = Helpers.getExpansionAPKFileName(this, true, fileVersion); //get the expansion file name based on the build version of the app.
  final File newFile = new File(Helpers.generateSaveFileName(this, fileName));
  final File[] listFiles = newFile.getParentFile().listFiles();
  for (final File file:listFiles)
  {
    final String name = file.getName();
    if (name.startsWith(fileName))
      continue;
    file.delete();
  }
}
like image 544
android developer Avatar asked Mar 26 '12 14:03

android developer


1 Answers

. hello ! For the CRC Check Fail, I have experienced the issue too. The thing that resolved it for me was to make the archive of my expansion file with 7zip, in zip format with no compression at all (store).

like this: http://floy.fr/perso/floy/expfiles/crc.PNG

Now the CRC is working like a charm for me !

I agree with you .. this library is very painful to use ..

like image 87
Floy Avatar answered Nov 15 '22 17:11

Floy