SoFunction
Updated on 2025-04-06

The best way to create instances with new Notification in Android

Currently, Android does not recommend creating Notification instances using the following methods:

Notification notification = new Notification(.ic_launcher,"This is ticker text",());

It is best to use the following methods:

Notification notification = new (this)
.setContentTitle("This is title")
.setContentText("This is content")
.setSmallIcon(.ic_launcher)
.setTicker("This is ticker")
.setContentIntent(pi)
.build();

The above is the best way to create new Notification examples in Android introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!