Android get first Installation Time returns error -


hi getting strange error in app when asking first installation time using packageinfo! devices error rare , not often. why happening , there workaround?

        packagemanager manager = this.getpackagemanager();         info = manager.getpackageinfo(this.getpackagename(), 0);         vpname = info.packagename;         vname = info.versionname;         vvers = info.versioncode;         installdate = info.firstinstalltime; 

gives

java.lang.nosuchfielderror: android.content.pm.packageinfo.firstinstalltime 

minsdkversion="7"

a list of devices returns error:

  • optimus 1 (thunderg)
  • lg-p920 (p920)
  • defy (umts_jordan)
  • infuse (sgh-i997)

that's because "firstinstalltime" introduced on api 9 (gingerbread) , above:

http://developer.android.com/reference/android/content/pm/packageinfo.html#firstinstalltime

in order avoid such errors, advised run lint check (using "v" button near run button, example). lint has plenty of errors , warnings better code. can make check problems on each save operation.

of course, has bugs , missing checks too, matter.


Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -