Hi ...
I'm trying to use NB6 instead of Built-in notification
I put this code a Service Start
the first time notification appear with icon and every things OK
But second time when I open the app and the service start again, gives me this error message and the service stop.
Where is the problem?
test project attached
Thank you ...
I'm trying to use NB6 instead of Built-in notification
I put this code a Service Start
B4X:
Sub Service_Start (StartingIntent As Intent)
Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
Dim n As NB6
If n.IsInitialized = False Then
Private icon As Bitmap
icon = LoadBitmapResize(File.DirAssets, "test.png", 24dip, 24dip, False)
n.Initialize("default", Application.LabelName, "LOW").AutoCancel(False).SmallIcon(icon)
Service.StartForeground(100, n.Build("Test1", "test ..... 1", "", Main))
Else
n.Build("Test 2", "test ..... 2", "", Main).Notify(100)
End If
End Sub
the first time notification appear with icon and every things OK
But second time when I open the app and the service start again, gives me this error message and the service stop.
B4X:
** Service (testservice) Start **
android.app.RemoteServiceException: Bad notification posted from package b4a.example: Couldn't update icon: StatusBarIcon(icon=Icon(typ=RESOURCE pkg=b4a.example id=0x00000000) visible user=0 )
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2019)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7225)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Where is the problem?
test project attached
Thank you ...