Advanced Notification

walterf25

Expert
Licensed User
Longtime User
Hello all, i'm updating one of my apps, and i'm using the Advanced Notification library, the version already released works just fine, haven't had any errors reported, but as i'm now trying to update it, i receive this message now when the Notification fires up,

android.app.RemoteServiceException: Bad notification posted from package com.dandre.apps: Couldn't expand RemoteViews for: StatusBarNotification(package=com.dandre.apps id=2 tag=null notification=Notification(vibrate=default,sound=default,defaults=0xffffffff,flags=0x10))
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1081)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)

Can anybody please help me solve this issue, i have not changed anything other than adding Spanish Language support to this app, i have not changed anything that may affect the notification, Any one has any idea?

Thanks Everyone!
Walter
 

cmweb

Active Member
Licensed User
Longtime User
Please post also the code of your notification...

Best regards,

Carsten

Gesendet von meinem GT-N7000 mit Tapatalk 2
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Code

Hi there here's my code, but as i said in my previous post i have not changed anything on this code,

I call the notification from this sub

B4X:
Sub TimerService_Tick
'StartServiceAt("", DateTime.Now + Schedule.itempicked * 60 * 1000, True)
Schedule.hc3.Execute(Schedule.req3, 2)
'Log("Starting Service")
Log("countdown initialized")
NotifyArrival
StopService("")
timerservice.Enabled = False
End Sub

and this is the Sub that take care of the notification

B4X:
Sub NotifyArrival
stoptime = DateTime.now
firedup = stoptime - Schedule.starttime
minute = firedup/1000
minute = minute / 60
findperiod = minute.IndexOf(".")
If findperiod > -1 Then
finalminute = minute.SubString2(0, findperiod)
'Log("minute " & finalminute)
Else
minute = firedup
'Log("minute " & finalminute)
End If

difference5 = Schedule.interval  - finalminute

'Log("Difference5 " & firedup)
   Dim cn As CustomNotification
cn.Initialize(2)
             cn.Number = 1
             cn.setIcon("icon")
             cn.TickerText = "Bus Arrival Time Notification"
            cn.AutoCancel = True

            cn.SetTextColor("title", Colors.Red)
            cn.SetTextColor("text", Colors.Blue)
             cn.SetText("title", "Bus Arrival Time")
            cn.SetText("text", "Your Bus will arrive in " & difference5 & " minutes")
            cn.SetTextSize("title", 16)
            cn.SetImage("image", LoadBitmap(File.DirAssets, "bus.png"))
               cn.Notify(2)
            
End Sub

Hope you can help me figure this out!

Thanks,
Walter
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
What Version of the Advanced Notification lib are you using, I accidentally posted a version that missed out the required permission for vibrations and that caused a few random strange issues. maybe try downloading the very latest and see if that solves it.
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
in fact, just realised you are using CUSTOM Nitifications not Advanced.

Check that the layout files are still located in the /res/ folder as per instructions in the Custom Notification release post.

Thanks
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Fixed it

Hi Barx, yes i have all the layout files in the res folder, but it works now, it's been such a long time i wrote this app that i couldn't remember that you have to clean your project in order for the r.java file to re-index all the resources, anyhow i did that and i now get notifications. :sign0060:


Thanks everyone, as always the B4A community to the rescue.

Cheers,
Walter
 
Upvote 0

barx

Well-Known Member
Licensed User
Longtime User
Your Welcome Walter

Happy Coding
 
Upvote 0
Top