I have a broadcast receiver who's job is to open an Activity. (Specifically when i receive a certain SMS).
When my phone is on and I use it, it works great.
But when my phone is on sleep mode nothing happens.
Do I need to add a code in my broadcast receiver to WAKEUP the phone and release the SCREEN LOCK (if there is) and then open the Activity?
Or is there a better solution?
This is the relevant code in the broadcast receiver onReceive function:
//Create a new PendingIntent and add it to the AlarmManager
Intent intent = new Intent(context, Alarm.class);
intent.putExtra("coordinates", coordinates);
PendingIntent pendingIntent = PendingIntent.getActivity(context,
0, intent, PendingIntent.FLAG_ONE_SHOT);
AlarmManager am = (AlarmManager)context.getSystemService(Activity.ALARM_SERVICE);
am.set(AlarmManager.RTC_WAKEUP, System.currentTimeMillis() + 100, pendingIntent);