I have an alarm in my app but I have a problem - my alarm is like a dialog - it doesn't take the whole screen. my problem is that with my alarm activity, my app is opened as well, showing the last place the user was in my app.
the activity is called from a service:
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
if (intent != null) {
Intent alarmIntent = new Intent(getBaseContext(), AlarmScreen.class);
alarmIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
alarmIntent.putExtras(intent);
getApplication().startActivity(alarmIntent);
AlarmManagerHelper.setAlarms(this);
}
return super.onStartCommand(intent, flags, startId);
}
I don't want my app to open with the alarm activity, I want it to just open the alarm activity. how can I do this?
thanks! edit: I even tried using filter intent and making the AlarmActivity like the main activity (launcher) and it didn't work.
this is how I set up my AlarmActivity and AlarmService in menifest:
<activity
android:name="com.ezlist.tasks.AlarmScreen"
android:label=""
android:screenOrientation="portrait"
android:theme="@style/Theme.Transparent" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="com.fgdvir.ezlist.AlarmService"
android:enabled="true" />
Set the android:taskAffinity of your alarm activity to a unique value for your app.
e.g
android:taskAffinity="uk.co.packagename.alarmactivity"
It will then open in its own task and not be associated with the rest of your app. i.e it will not pull the rest of your app into the foreground when it opens.