Display tick text of status notification when screen is locked on Android

I have a notification that appears in the status bar. If the user is on the main screen, the text of the ticker is displayed, which is accompanied by a notification. If the user is on the lock screen, a notification icon is displayed, but the text of the ticker is not displayed. How can I make a text display of a tick, even if the user is on the lock screen?

EDIT . The text of the screen lock code works correctly in the emulator (2.3.3, 4.0.3 and 4.1.2), but it does not work on the two test devices that I have (Galaxy S3 works 4.0.4 and Galaxy Tab works cellular).

EDIT 2 : it is strange that I tested text messages on S3 and the text of the ticker was successfully displayed. However, this may be due to the fact that it was an application for your own messages, and Samsung disabled it using third-party applications?

NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.launch_icon) .setTicker("My ticker text") .setContentTitle(title) .setContentText(message) .setContentIntent(contentIntent); 
+4
source share
1 answer

Late reply / comment, but the ticker is displayed during the screen lock on my device (Galaxy s2 works 4.4). Using NotificationCompat.Builder

0
source

Source: https://habr.com/ru/post/1495019/


All Articles