Android Question NotificationBuilder compatible with Android 4?

DickD

Active Member
Licensed User
I am using the code below to display a notification with long strings. It works fine on my android 6 phone but on Android 4.4 the notification bar is empty except for the icon. The sound, vibration and light all work OK. I am using B4A 6.50 and have included the additional jar statement in the manifest editor and have downloaded the separate xml file as stated in the instructions. Help!

#AdditionalJar: com.android.support:support-v4

B4X:
Sub Process_Globals
Dim nb as NotificationBuilder
Dim style as NotificationBixTextStyle
...
Sub Notify
 nb.Initialize
 style.Initialize
 nb.ShowTime = False
 nb.SmallIcon = "icon"
 nb.defaultLight = True
 nb.AutoCancel = True
 nb.AddAction("","View","","MyActivity")
 style.BigContentTitle = "Some long string here......"
 style.BigText = "Another long string...."
 nb.SetStyle(style)
 nb.Notify(3)
End Sub
 

cruzeiro991

Member
Licensed User
Longtime User
It depends. The NotificationBuilder class has apparently been supported since api 11 (Android 3), but the BigTextStyle has only been added in API 16 (Android 4.1).

Information on Android Developer

NotificationBuilder: https://developer.android.com/reference/android/app/Notification.Builder.html

BigTextStyle: https://developer.android.com/reference/android/app/Notification.BigTextStyle.html

OBS:
"Dim style as NotificationBixTextStyle" should not be "Dim style as NotificationBigTextStyle"? [x] to [g]?
 
Upvote 0
Top