Android Question Notification and "Unfortunately System UI has stopped"

Magma

Expert
Licensed User
Longtime User
Hi there...

I am using notifications... much time... but in some devices always changing... things to work or not...

Is there a way to all work with the same... steps ?

I am using b4a v9...

code example:
B4X:
at... main at top... i have:
#additionaljar: com.android.support:support-v4

into service i have:

Sub CreateNotification (Body As String) As Notification
    Dim notification As Notification
    notification.Initialize2(notification.IMPORTANCE_LOW)
    notification.Icon = "icon2"
    notification.Sound=False
    notification.Vibrate=False
    notification.SetInfo("some info...", Body, Main)
    Return notification
End Sub

i am calling that from:
Sub Service_Start (StartingIntent As Intent)
   If Main.manager.GetBoolean("check1")=True Then
       Service.StartForeground(1, CreateNotification("..."))
   End If
....

That example... may be work... may be not....

At android ver 4.4.2 in some devices working... at other give: Unfortunately System UI has stopped
At android ver 6,7 works perfect...


Is there a way that will work in any version... ?
 

Magma

Expert
Licensed User
Longtime User
...@Erel ...usually the createnotication running only one time...

for other notifications i am using different ids... like this - for those need to cancel them ? :

B4X:
Sub ccn(text As String)
    pqid=pqid+1
    cn.Initialize2(cn.IMPORTANCE_LOW)
    cn.Icon = "icon2"
    cn.Sound = False
    cn.Vibrate = False
       cn.SetInfo("blah blah blah ", text & " " & CRLF & DateTime.Date(DateTime.Now), Main)
    cn.Notify(pqid)
End Sub

Sleep not acceptable - is for call blocking...
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
@Erel... i am not saying that sleep is blocking... app is for call blocking ... so if use in middle the sleep perhaps 100ms i will loose a call identification / so will not block it :)

Icon... What's the best icon size (kb) height/width ? mine is just white and black and about: 300x300 pixels... 47kb... is it big... ?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
perhaps 100ms i will loose a call identification
why you are loosing it? You are knowing it inside the sub before the sleep, right? The value you know is still valid after the sleep.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Yes but i don't want the phone start ringing - i want to be fast..
1. Did you TRIED it?
2. WHERE did you stated this requirements? The thread is about that notifications are not working for you. No word about the fact what you are really trying to archieve.

Good luck. I´m out here.
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
@DonManfred

1. No but i will - i am just talking about it...
2. I am just thinking / May be notifications is not for me or not using them right - you have right. / no comment
3. Thanks for your answers, always make me think a lot.

Sorry................
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
For the story... DonManFred has right about SLEEP()... i gave it SLEEP(100) and not delaying... at least at my phone :)

For Android 4.4.2 - don;t know... must test it (first must find a device) - i will inform...
 
Upvote 0

Magma

Expert
Licensed User
Longtime User
Icon Seems have problem... notification icon (it's icon2) is ok because it is black/white colors... but the icon at scrolled notification is circle solid grayed... Icon of app (icon) is perfect...

in some androids... version 5 - the scrollabe notification icon is solid-gray with 3 white lines vertically from top to center...
 

Attachments

  • icon.png
    icon.png
    23.9 KB · Views: 204
  • icon2.png
    icon2.png
    47.2 KB · Views: 205
Upvote 0

Magma

Expert
Licensed User
Longtime User
I am saying... that:

icon.png ---> work ok ---> as icon for app at desktop of android...
icon2.png ----> works ok ---> as notification and i am using it...

but when phone is locked or when i scroll notifications - don't know exactly what icon is used and get a gray circled icon... "i want to change that icon at this view"

... the BaN BaNk... icon...
 

Attachments

  • Screenshot_2019-04-08-08-43-33.png
    Screenshot_2019-04-08-08-43-33.png
    224.1 KB · Views: 197
Upvote 0
Top