Friday, February 12, 2016

Way to check Android Serivce is running or not

Use below code to check whether service is running or not
private boolean isMyServiceRunning(Class serviceClass) { 
  ActivityManager actManager = (ActivityManager) 
  for (RunningServiceInfo service : actManager
    .getRunningServices(Integer.MAX_VALUE)) {
   if (serviceClass.getName().equals(service.service.getClassName())) {
    return true;
  return false;

Tuesday, February 2, 2016

Android ART vs DalvikVM

ART was introduced in KitKat (4.4):
– Available only through developer options
– Declared to be a “preview” release, use-at-your-own-risk
– Very little documentation, if any

In Lollipop, ART becomes the RunTime of choice
– Supersedes (all but buries) Dalvik
– Breaks compatibility with older DEX, as well as itself (in preview version)
– And still – very little documentation, if any

Dalvik Disadvantages
Introducing: ART
• ART was designed to address the shortcomings of Dalvik:
– Virtual machine maintenance is expensive
• Interpreter/JIT simply aren’t efficient as native code
• Doing JIT all over again on every execution is wasteful
• Maintenance threads require significantly more CPU cycles
• CPU cycles translate to slower performance – and shorter battery life
– Dalvik garbage collection frequently causes hangs/pauses
– Virtual machine architecture is 32-bit only
• Android is following iOS into the 64-bit space