mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-27 02:07:42 +00:00
0ff99258ac
Fixes #2239 Closes #27923 // FREEBIE
30 lines
1.3 KiB
Java
30 lines
1.3 KiB
Java
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;
|
|
|
|
import org.thoughtcrime.securesms.ConversationListActivity;
|
|
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));
|
|
builder.setContentIntent(PendingIntent.getActivity(context, 0, new Intent(context, ConversationListActivity.class), 0));
|
|
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);
|
|
}
|
|
}
|