My app regularly receives text messages from FirebaseMessaging.
BigText_Notification always works!
When I do a big picture download, the download works for a while and then stops working.
My app is closed but fm_MessageArrived itself works fine; only the next day the download fails.
I also tried using wait for download. I run it dozens of times and it works.
The download starts working again if I open and close the app again.
I'm going crazy.
I have b4a 12.8
Android 13
OkHttpUtils2 3.04
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="33"/>
Can anyone tell me why this happens?
BigText_Notification always works!
When I do a big picture download, the download works for a while and then stops working.
My app is closed but fm_MessageArrived itself works fine; only the next day the download fails.
I also tried using wait for download. I run it dozens of times and it works.
The download starts working again if I open and close the app again.
I'm going crazy.
I have b4a 12.8
Android 13
OkHttpUtils2 3.04
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="33"/>
Can anyone tell me why this happens?
B4X:
Sub fm_MessageArrived (Message As RemoteMessage)
provider.Initialize
testotitle=Message.GetData.Get("title")
testobody=Message.GetData.Get("body")
testonote=Message.GetData.Get("notedomani")
appoimage=Message.GetData.Get("image")
'ToastMessageShow(appoimage,False)
If appoimage="vuoto" Then
BigText_Notification
Return
End If
ToastMessageShow(appoimage,True)
'Wait For (DownloadBitmap("http://www.xxxxxxxxx.net/notifichestudio/" & Main.manager.GetString("utente") & "/dentista4.png")) Complete (Success As Boolean)
DownloadImage("https://www.xxxxxxxxxx.net/notifichestudio/" & Main.manager.GetString("utente") & "/dentista4.png")
Sleep(8000)
'ToastMessageShow(Success,False)
'If Success = True Then
Dim smiley As Bitmap
smiley = LoadBitmapResize(File.DirAssets, "smiley.png", 24dip, 24dip, False)
Dim n As NB6
n.Initialize("custom sound", Application.LabelName, "DEFAULT").SmallIcon(smiley)
n.BadgeIconType("SMALL").Number(1)
Dim FileName As String = "tada.mp3"
File.Copy(File.DirAssets, FileName, provider.SharedFolder, FileName)
Dim in As Intent
in.Initialize(in.ACTION_VIEW, "")
provider.SetFileUriAsIntentData(in, FileName)
n.SmallIcon(LoadBitmapResize(File.DirAssets, "smiley.png", 32dip, 32dip, True))
'disable the default sound
n.SetDefaults(False, True, True)
'set custom sound
n.CustomSound(provider.GetFileUri(FileName))
n.BigPictureStyle(bmp.Resize(256dip, 256dip, True), bmp, testotitle, testobody)
n.Color(0xFF00AEFF)
n.AddButtonAction(smiley, "Note di domani", MyReceiver2, "note")
Dim cs As CSBuilder
n.AddButtonAction(smiley, cs.Initialize.Color(Colors.Red).Bold.Append("Altre informazioni...").PopAll, MyReceiver2, "altro")
n.Build(testotitle, testobody, "tag", Main).Notify(3)
'End If
End Sub
Sub fm_TokenRefresh (Token As String)
Main.Tokken=Token
End Sub
Sub BigText_Notification
Dim n As NB6
smiley = LoadBitmapResize(File.DirAssets, "smiley2.png", 24dip, 24dip, False)
n.Initialize("default", Application.LabelName, "DEFAULT").SmallIcon(smiley)
Dim cs As CSBuilder
n.BigTextStyle(testotitle, cs.Initialize.BackgroundColor(Colors.Red).Append("summary text").PopAll,testobody)
n.Build(testotitle, testobody, "tag", Me).Notify(8)
End Sub
Sub DownloadBitmap(Link As String) As ResumableSub
Dim ret As Boolean = False
Dim j As HttpJob
j.Initialize("", Me)
j.Download(Link)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
bmp = j.GetBitmap
ret = True
End If
j.Release
Sub DownloadImage(Link As String)
Dim j As HttpJob
j.Initialize("", Me)
j.Download(Link)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
bmp = j.GetBitmap
End If
j.Release
End Sub