Inquiry about applying Android notification channel

Asked 2 years ago, Updated 2 years ago, 78 views

Hi, how are you?

I am inquiring by applying the notification channel.

When the app is not running, you cannot receive a pop-up message from the server, and there is no sound or vibration. Therefore, you want to apply the notification channel

NotificationCompat.Builder builder = new NotificationCompat.Builder(this, chanelId);

Cannot apply two factors to NotificationCompat.Builder in part <

This or getApplicationContext() does not cause an error, but you cannot receive a pop-up message from the server when the app is not running the same way, and there is no notification sound or vibration.

I think I need to write the ChaneId in NotificationCompat.Builder, but if I write it, there will be an error. The error content is actual and formal argument list different in length.

I ask for your help me <

android notification

2022-09-22 17:55

1 Answers

NotificationCompat.Builder(Context context)

This constructor is not used in api 26 and later

NotificationCompat.Builder(Context context, String channelId)

From api 26 and later, you must set the NotificationChannel ID.

Looking at the compilation error, it seems that you set the parameters incorrectly, but if you attach the relevant code, it will be easy to answer.


2022-09-22 17:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.