2013-07-10 19:26:23 -07:00
|
|
|
package org.thoughtcrime.securesms.service;
|
|
|
|
|
|
|
|
import android.app.Notification;
|
|
|
|
import android.app.NotificationManager;
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
import android.content.BroadcastReceiver;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.support.v4.app.NotificationCompat;
|
|
|
|
|
2014-12-15 12:25:55 -08:00
|
|
|
import org.thoughtcrime.securesms.ConversationListActivity;
|
2013-07-10 19:26:23 -07:00
|
|
|
import org.thoughtcrime.securesms.R;
|
|
|
|
|
|
|
|
public class RegistrationNotifier extends BroadcastReceiver {
|
|
|
|
@Override
|
|
|
|
public void onReceive(Context context, Intent intent) {
|
|
|
|
NotificationCompat.Builder builder = new NotificationCompat.Builder(context);
|
|
|
|
builder.setSmallIcon(R.drawable.icon_notification);
|
|
|
|
builder.setContentTitle(intent.getStringExtra(RegistrationService.NOTIFICATION_TITLE));
|
|
|
|
builder.setContentText(intent.getStringExtra(RegistrationService.NOTIFICATION_TEXT));
|
2014-12-15 12:25:55 -08:00
|
|
|
builder.setContentIntent(PendingIntent.getActivity(context, 0, new Intent(context, ConversationListActivity.class), 0));
|
2013-07-10 19:26:23 -07:00
|
|
|
builder.setWhen(System.currentTimeMillis());
|
|
|
|
builder.setDefaults(Notification.DEFAULT_VIBRATE);
|
|
|
|
builder.setAutoCancel(true);
|
|
|
|
|
|
|
|
Notification notification = builder.build();
|
|
|
|
((NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE)).notify(31337, notification);
|
|
|
|
}
|
|
|
|
}
|