Android Question Trasparent Icon Notify

MarcoRome

Expert
Licensed User
Longtime User
Hi all.
I have this code in my service:
B4X:
      nNotify.Initialize
    If nascondi <> "0" Then   
       nNotify.Icon = "icon"
       nNotify.SetInfo("Recording Call", "Active", Main)
    nNotify.OnGoingEvent=True
    Else
    nNotify.Icon = "trasp"
    End If
       nNotify.Sound=False
       nNotify.Vibrate=False
    nNotify.Light=False
    nNotify.Notify(1)
    Service.StartForeground(1,nNotify)
    SI.Initialize2("SI", 999)
    'Parte in Foregroung cosi da non essere distrutto
    Service.StartForeground(1,nNotify)

and in attachment i have my icon trasparent ( trasp.png ).
i copy this icon into ....\Objects\res\drawable and put only read.
But when app start, crash app and i have this message:

B4X:
Installing file.
PackageAdded: package:com.devil.app.recordcall
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for com.devil.app.recordcall
Subscriptions AVAILABLE.
** Service (managerservice) Create **
android.app.RemoteServiceException: Bad notification for startForeground: java.lang.IllegalArgumentException: contentView required: pkg=com.devil.app.recordcall id=1 notification=Notification(pri=0 icon=7f020034 contentView=null vibrate=null sound=null defaults=0xfffffffc flags=0x40 when=1427578658621 ledARGB=0x0 contentIntent=N deleteIntent=N contentTitle=N contentText=N originalPackageName=N tickerText=N kind=[null])
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1484)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:146)
    at android.app.ActivityThread.main(ActivityThread.java:5692)
    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:1291)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1107)
    at dalvik.system.NativeStart.main(Native Method)

If i delete trasp.png all work without problem
Any idea ?
Thank you
Marco
 

Attachments

  • trasp.png
    trasp.png
    290 bytes · Views: 214

MarcoRome

Expert
Licensed User
Longtime User
Hi Erel. The reason is this:

B4X:
nNotify.Initialize
    If nascondi <> "0" Then  
    nNotify.Icon = "icon"
    nNotify.SetInfo("Recording Call", "Active", Main)
    nNotify.OnGoingEvent=True
    Else
    nNotify.Icon = "trasp"
    nNotify.SetInfo("Recording Call", "Active", Main)  ' <-------------- IF YOU DONT ADD SetInfo CRASH 
    End If
       nNotify.Sound=False
       nNotify.Vibrate=False
    nNotify.Light=False
    nNotify.Notify(1)
    Service.StartForeground(1,nNotify)
    SI.Initialize2("SI", 999)
    'Parte in Foregroung cosi da non essere distrutto
    Service.StartForeground(1,nNotify)

Thank you
Marco
 
Upvote 0
Top