Как открыть деятельность, отличную от активности запуска в Android, когда мы нажимаем на уведомлениеAndroid

Форум для тех, кто программирует под Android
Ответить
Anonymous
 Как открыть деятельность, отличную от активности запуска в Android, когда мы нажимаем на уведомление

Сообщение Anonymous »

Я использую уведомления FCM в своем приложении и хочу открыть действие, называемое ManagesalesMainActivity, которое не является деятельностью пусковой установки и хочу пройти строку, используя ожидающие намерения. Строка через экраны Splash, но я не могу доставить строку в Splashcreen. Vibrator v = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE);
long[] pattern = {100, 300, 300, 300};
v.vibrate(pattern, -1);

NotificationCompat.Builder builder = new
NotificationCompat.Builder(this,"CHANNEL_ID");

Intent resultIntent = new Intent(this, ManageSalesMainActivity.class);
resultIntent.putExtra("order_status",message_status);

PendingIntent pendingIntent = PendingIntent.getActivity(this, 1,
resultIntent, PendingIntent.FLAG_IMMUTABLE);

builder.setContentTitle(Objects.requireNonNull(remoteMessage.getNotification())
.getTitle());
builder.setContentText(remoteMessage.getNotification().getBody());
builder.setContentIntent(pendingIntent);
builder.setStyle(new
NotificationCompat.BigTextStyle().bigText(remoteMessage.getNotification()
.getBody()));

builder.setAutoCancel(true);
builder.setSmallIcon(R.drawable.go_local_logo_without_bg);
builder.setVibrate(pattern);
builder.setPriority(Notification.PRIORITY_MAX);

mNotificationManager=NotificationManager)getApplicationContext()
.getSystemService(Context.NOTIFICATION_SERVICE);

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {

// string gannelid = "your_channel_id";
string channelid = "channel_id";
NotificationChannel channel = new NotificationChannel(
channelId,
"Channel human readable title",
NotificationManager.IMPORTANCE_HIGH);
channel.enableLights(true);
channel.enableVibration(true);
channel.setVibrationPattern(pattern);
channel.canBypassDnd();

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
channel.canBubble();
}

mNotificationManager.createNotificationChannel(channel);
builder.setChannelId(channelId);
}

mNotificationManager.notify(1000, builder.build());


Подробнее здесь: https://stackoverflow.com/questions/795 ... e-click-on
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Android»