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

41 lines
1.2 KiB
Java

package com.safemobile.safedispatch;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import com.safemobile.lib.AppParams;
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();
}
}