What is the maximum number of characters that can be displayed in push notification in Android without the text being truncated?
The documentation for iPhone states that the notification payload has to be under 256 bytes in total, but I was unable to find something similar for Android.
The message size limit in Firebase Cloud Messaging (FCM) is 4 kbytes. https://firebase.google.com/docs/cloud-messaging/concept-options#notification-messages-with-optional-data-payload
https://firebase.google.com/docs/cloud-messaging/server#choose
The message size limit in GCM is 4 kbytes. (DEPRECATED) https://developer.android.com/google/gcm/server.html#params
The message size limit in C2DM is 1024 bytes. (DEPRECATED) https://developers.google.com/android/c2dm/#limitations
For regular remote notifications, the maximum size is 4KB (4096 bytes)
https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CreatingtheNotificationPayload.html
Since the introduction of iOS 8 has changed to 2 kbytes!
https://forums.aws.amazon.com/ann.jspa?annID=2626
With iOS 8, Apple introduced new features that enable some rich new use cases for mobile push notifications — interactive push notifications, third party widgets, and larger (2 KB) payloads. Today, we are pleased to announce support for the new mobile push capabilities announced with iOS 8. We are publishing a new iOS 8 Sample App that demonstrates how these new features can be implemented with SNS, and have also implemented support for larger 2KB payloads.
in iOS the size limit is 256 bytes
As kabuko said there are a lot of variables. But I did testing on a Galaxy S5 and a Nexus 5, with Android 4.4, and got similar results. If you are looking for ballpark figures I got
Title: 16 chars Text: 27 chars Ticker: 300+ chars (I stopped at 300 characters)
NotificationCompat.Builder builder = new NotificationCompat.Builder(application.getApplicationContext()); Notification n = builder .setContentTitle("XXXXXXXXXXWWWWWWWWWW") .setContentText("XXXXXXXXXXWWWWWWWWWWXXXXXXXXXX") .setTicker("XXXXXXXXXXWWWWWWWWWWXXXXXXXXXXWWWWWWWWWWXXXXXXXXXWWWWWWWWWW...") // cut short for brevity .setSmallIcon(R.drawable.ic_launcher) .build();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With