Bug? Can't show notification large icon with B4A 8.3 in Android 4.4 device


Licensed User
Longtime User
I update this notification code @Erel for ~8.1 android . As I test , it works right for 8.1 and 6 device , but works incorrect in Android 4.4.2 (Samsung S3 SPH-L710). The small icon (status bar) is ok but large icon show a blank.

The example code is very simple , create a new project and paste the code to Starter service :

Other , B4A 8.3 and updated with B4A SDK manager , use android-27\android.jar

#Region  Service Attributes
    #StartAtBoot: False
    #ExcludeFromLibrary: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim Notification1 As Notification
End Sub

Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
End Sub

Sub Service_TaskRemoved
    'This event will be raised when the user removes the app from the recent apps list.
End Sub

'Return true to allow the OS default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub Service_Start (StartingIntent As Intent)
    If Not(Notification1.IsInitialized ) Then
    Notification1=CreateNotification("Example","Tap here to set","icon",Main,False,False)
    End If
    Service.StartForeground(1, Notification1)
End Sub

Sub Service_Destroy
End Sub

Private Sub CreateNotification(Title As String, Content As String, Icon As String, TargetActivity As Object, _
    Sound As Boolean, Vibrate As Boolean) As Notification
    Dim p As Phone
    If p.SdkVersion >= 21 Then
        Dim nb As NotificationBuilder
        nb.DefaultSound = Sound
        nb.DefaultVibrate = Vibrate
        nb.ContentTitle = Title
        nb.ContentText = Content
        nb.SmallIcon = Icon
        If p.SdkVersion >= 26 Then
            Dim ctxt As JavaObject
            Dim manager As JavaObject
            Dim Channel As JavaObject
            Dim importance As String
            If Sound Then importance = "IMPORTANCE_DEFAULT" Else importance = "IMPORTANCE_LOW"
            Dim ChannelVisibleName As String = Application.LabelName
            Channel.InitializeNewInstance("android.app.NotificationChannel", _
                   Array("MyChannelId1", ChannelVisibleName, manager.GetField(importance)))
            manager = ctxt.RunMethod("getSystemService", Array("notification"))
            manager.RunMethod("createNotificationChannel", Array(Channel))
            Dim jo As JavaObject = nb
            jo.RunMethod("setChannelId", Array("MyChannelId1"))
        End If
        Return  nb.GetNotification
        Dim n As Notification
        n.Sound = Sound
        n.Vibrate = Vibrate
        n.Icon = Icon
        n.SetInfo(Title, Content, TargetActivity)
        Return n
    End If
End Sub


  • samsung S3 (API 19).png
    samsung S3 (API 19).png
    33.1 KB · Views: 223
  • example.zip
    14.1 KB · Views: 215