android - getRunningTasks LOLLIPOP integration -


getrunningtasks deprecated in lollipop. have use usagestatsmanager in order package name of foreground app. have tested on android 6.0 , works.

the problem not want set project run android 5.0(the users on kitkat). compile project lollipop , run functions need depending on android version(i make sure not run code usagestatsmanager on lower api lever). in manifest set minsdkversion 10. have tested on android 4.1.1 application works see in logcat:

01-06 19:57:17.570: e/dalvikvm(31534): not find class 'android.app.usage.usagestatsmanager', referenced method  01-06 19:57:17.570: w/dalvikvm(31534): vfy: unable resolve check-cast 39 (landroid/app/usage/usagestatsmanager;) in  01-06 19:57:17.570: d/dalvikvm(31534): vfy: replacing opcode 0x1f @ 0x0009 01-06 19:57:17.585: d/dalvikvm(31534): dexopt: unable opt direct call 0x00a5 @ 0x23 in l 

should worried these errors/warnings? app works not sure if work on devices(with api level less 21).

another possible solution use reflection , exceptions api level less 21. not sure if worth effort if app doing must do(my concern logcat ).

should worried these errors/warnings?

no, long not trying execute lines contain missing items. there lots of these messages android apps, come standard "progressive enhancement/graceful degradation" programming. dalvik/art try resolve symbols when class loaded, emitting messages when symbols cannot found. but, long aren't using missing symbols, life good.

the app works not sure if work on devices(with api level less 21).

if supporting android 1.x, approach not work, dalvik throw real exception instead of logging missing symbols. if supporting android 1.x in 2016, saint, insane, or possibly both.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -