guys last week I have tried myself with some android development and I'm currently stuck on the following error: I'm running a timer with a service in the background. When the time is up an activity shall open, even when the phone is locked. With the following code, while not locked everything is fine. But when opening from a locked screen it will always open up twice.. :/
I have added this in the onCreate to make it open from the lock screen.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//allow window to be popped up while in lock screen
Window window = this.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD);
window.addFlags(WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
setContentView(R.layout.activity_entry);
And I am opening the activity from the service via an intent.
callEntryActivityIntent = new Intent(this, EntryActivity.class);
callEntryActivityIntent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
pendingIntent = PendingIntent.getActivity(this, 0, callEntryActivityIntent, 0);
and when timer is finished -> startActivity(callEntryActivityIntent);
maybe someone has an idea. I'm really really new to android development, started this two weeks ago.