Android Question Trasparent Icon Notify

Discussion in 'Android Questions' started by MarcoRome, Mar 28, 2015.

  1. MarcoRome

    MarcoRome Expert Licensed User

    Hi all.
    I have this code in my service:
    Code:
    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:

    Code:
    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
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

    It is working fine here. I've tested it with this code:
    Code:
    Sub Activity_Create(FirstTime As Boolean)
       
    Dim n As Notification
       n.Initialize
       n.Icon = 
    "trasp"
       n.SetInfo(
    "asdasd""Asdasd", Me)
       n.Notify(
    0)
    End Sub
    If you are using rapid debug mode then you should click on Tools - Clean project after you copy the file.
     
  3. MarcoRome

    MarcoRome Expert Licensed User

    Hi Erel. The reason is this:

    Code:
    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
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice