I have created an android app which runs fine in all phones. But in my Alcatel phone it doesn't as the phone goes to a deep sleep mode and the data network fails so the app doesn't get a data network and doesn't sync the data from the server .
My Design ...
SystemBootReceiver --> (DataSyncService)Service --> (MyBroadcastReceiver)BroadcastReceiver --> (MyDataService)Service .
So here on system boot I start DataSyncService where I set up the AlarmManager (repeated) and call the MyBroadcastRecever. After calling the BroadcastRecever I stop DataSyncService by calling stopself() .
Now the MyBroadcastRecever calls the MyDataService.
I came across WakeLocks which as said prevent the phone from going in deep sleep mode.
So I implemented it inside MyDataService onCreate() method
PowerManager pm = (PowerManager)
getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "My Tag");
mWakeLock.acquire();
And release() the wake lock before stopping the service.
I have also set the permission in android Manifest.
But this didn't work. So for a quick check I used WAKE LOCK app from the market .
But this also didn't wake the phone up. Again I came across WAKE MY ANDROID (app removed from store) app from market and installed it .. and a magic happened here.
It kept the phone alive.
As the description in this app says that they have also used a Wake Lock. So what am I missing then ?
Is there an implementation mistake or a design issue ?