safedispatch-mobile/src/com/safemobile/dispatch_demo/NotificationActivity.java

42 lines
1.2 KiB
Java
Raw Normal View History

2022-03-10 14:31:03 +00:00
package com.safemobile.dispatch_demo;
import com.safemobile.lib.AppParams;
import com.safemobile.lib.SM;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
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();
}
}