safedispatch-mobile/safeDispatch/src/main/java/com/safemobile/safedispatch/NotificationActivity.java

41 lines
1.2 KiB
Java
Raw Normal View History

2022-03-24 09:18:49 +00:00
package com.safemobile.safedispatch;
2022-03-10 14:31:03 +00:00
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
2022-03-14 09:53:00 +00:00
import com.safemobile.lib.AppParams;
2022-03-10 14:31:03 +00:00
public class NotificationActivity extends Activity{
public static final String NOTIFICATION_MESSAGE_INTENT = "notification_message_clicked_intent";
public static final String NOTIFICATION_ALERT_INTENT = "notification_alert_clicked_intent";
public static final String NOTIFICATION_POLL_INTENT = "notification_poll_clicked_intent";
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// get notification type
int key = getIntent().getExtras().getInt("key");
// broadcast intent
Intent i = new Intent();
switch(key)
{
case AppParams.messageNotif: i.setAction(NOTIFICATION_MESSAGE_INTENT); break;
case AppParams.alertNotif: i.setAction(NOTIFICATION_ALERT_INTENT); break;
case AppParams.pollNotif: i.setAction(NOTIFICATION_POLL_INTENT); break;
}
getBaseContext().sendBroadcast(i);
/* Set activity result and send intent data */
setResult(RESULT_OK, getIntent());
/* Finish activity and return to parent activity */
finish();
}
}