Hello together,
I have a very strange problem with notifications in my app for some time now.
It happens that after one or two days of continuous use of the app, a second notification appears, which cannot be clicked away.
Only after a restart of the phone everything is normal again.
For your information:
I automatically send traffic jam notifications to my app every 10 minutes. These also arrive without problems and the notification also disappears as soon as you click on it or remove it.
After one or two days a second notification appears, which only contains the app name and nothing else.
It seems that this notification also appears briefly in the phone as soon as another notification is received. So to speak as an indicator that something is happening in the background. At some point, however, this remains permanently there and no longer goes away.
I have already removed many places in the code to find the error, but without success.
It seems that this only happens with Xiamio smartphones under MIUI.
Has anyone else had the same problem and solved it?
Smartphone: Mi Note 10 Lite
MIUI Global: 12.5.5
B4A Version: 11
Thank you very much for your help!
Here is my code and two screenshots:
I have a very strange problem with notifications in my app for some time now.
It happens that after one or two days of continuous use of the app, a second notification appears, which cannot be clicked away.
Only after a restart of the phone everything is normal again.
For your information:
I automatically send traffic jam notifications to my app every 10 minutes. These also arrive without problems and the notification also disappears as soon as you click on it or remove it.
After one or two days a second notification appears, which only contains the app name and nothing else.
It seems that this notification also appears briefly in the phone as soon as another notification is received. So to speak as an indicator that something is happening in the background. At some point, however, this remains permanently there and no longer goes away.
I have already removed many places in the code to find the error, but without success.
It seems that this only happens with Xiamio smartphones under MIUI.
Has anyone else had the same problem and solved it?
Smartphone: Mi Note 10 Lite
MIUI Global: 12.5.5
B4A Version: 11
Thank you very much for your help!
Here is my code and two screenshots:
FirebaseMessaging:
#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
Private fm As FirebaseMessaging
End Sub
Sub Service_Create
fm.Initialize("fm")
End Sub
Public Sub SubscribeToTopics
fm.SubscribeToTopic("general") 'you can subscribe to more topics
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.IsInitialized Then fm.HandleIntent(StartingIntent)
Sleep(0)
Service.StopAutomaticForeground 'remove if not using B4A v8+.
End Sub
Sub fm_MessageArrived (Message As RemoteMessage)
Log("-------------------Message arrived-------------------")
DateTime.DateFormat="hh:mm:ss"
Log("Datum/Uhrtzeit: " & DateTime.Date(DateTime.now))
Log($"Message data: ${Message.GetData}"$)
'---------------------------------------------------------------
'---------------------------------------------------------------
Dim no As NB6
Dim AppIcon As Bitmap
AppIcon.Initialize(File.DirAssets, "icon_staumelder_app_notification_24x24.bmp")
no.Initialize("default", Application.LabelName, "DEFAULT").AutoCancel(True).SmallIcon(AppIcon)
no.Build("Message arrived", "TEXT TEXT TEXT", "tag1", Main).Notify(1) 'It will be Main (or any other activity) instead of Me if called from a service.
'---------------------------------------------------------------
'---------------------------------------------------------------
End Sub
Sub Service_Destroy
End Sub