I am Triggering an IntentService from WakefullBroadcastReceiver
Intent i = new Intent(context, MyService.class);
i.putExtras(bundle);
Log.i("StartService","Before Wakelock");
WakeLock lock = MyService.getLock(context);
Log.i("StartService","After Wakelock");
lock.acquire();
Log.i("StartService","After Aquire");
context.startService(i);
lock.release();
Log.i("StartService","After Release");
All the above logs are Getting displayed. But My service is not getting called.
IntentService
public class MyService extends IntentService {
private static final String NAME = MyService.class.getName() + ".Lock";
private static volatile WakeLock lockStatic = null;
synchronized public static PowerManager.WakeLock getLock(Context context) {
if (lockStatic == null) {
PowerManager mgr = (PowerManager) context
.getSystemService(Context.POWER_SERVICE);
lockStatic = mgr.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, NAME);
lockStatic.setReferenceCounted(true);
}
return (lockStatic);
}
public MyService(String name) {
super(name);
}
public MyService() {
super("MyService");
}
@Override
protected void onHandleIntent(Intent intent) {
try {
Log.i("IntentService", "In HandleIntent");
} finally {
}
}
}
Can anyone help me??