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