FCM notification message are not received in android Oreo version?

前端 未结 9 1730
轻奢々
轻奢々 2021-02-18 13:31

I have send FCM notification from server to users. It works fine(until api 25) but in Oreo when the application have not in background(services are closed) (or) completely close

9条回答
  •  忘掉有多难
    2021-02-18 14:06

      notification = new NotificationCompat.Builder(this, ANDROID_CHANNEL_ID)
                        .setSmallIcon(R.drawable.ic_small_logo)
                        .setLargeIcon(picture)
                        .setContentTitle("Title")
                        .setContentText("Body")
                        .setContentIntent(pendingIntent)
                        .setAutoCancel(true)
                        .build();
    
    • ANDROID_CHANNEL_ID = "CHANNEL_ID"
    • PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
    • intent = new Intent(getApplicationContext(), HomeActivity.class); intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);

提交回复
热议问题