Android Question Service Bad notification startForeground

imgsimonebiliato

Well-Known Member
Licensed User
Longtime User
Hello,
I create a service that works foreground.

Code: Copy
Sub Process_Globals
Dim sNotif As Notification
End Sub

Sub Service_Create
sNotif.Initialize
Service.StartForeground(1, sNotif)
End Sub

When I start the application, I've got this log error.
What's wrong?


Code: Copy
** Activity (main) Create, isFirst = true **


--Service Started--
** Service (sinventario) Start **

Start Service
** Activity (main) Pause, UserClosed = true **

android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: icon must be non-zero

    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1488)
    at android.os.Handler.dispatchMessage(Handler.java:110)
    at android.os.Looper.loop(Looper.java:193)
    at android.app.ActivityThread.main(ActivityThread.java:5292)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:515)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:824)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:640)
    at dalvik.system.NativeStart.main(Native Method)
 
You have initialized the notification, but as the exception says you haven't set an icon for it.

If you just want to the use app's default icon use:
Code: Copy
sNotif.Iccon = "icon"

Also you haven't called SetInfo or SetInfo2, are you sure you want to display no text to the user?
 
Upvote 0
If it is possible, I don't want also to display the notification
 
Upvote 0
Back
Top