با سلام و سپاس خدمت کاربران عزیز وب سایت یاهو ۹۸ YAHOO
امروزه خیلی از دوستان برای ارسال نوتیفیکیشن توی اندروید ۷ به بالا مشکل دارن ان شالله با این تکه کد مشکلشون حل میشه
قبل از نوتیفیکیشن زدن اول باید چنل بسازید. به شکل زیر چنل بسازید کتابخونه های phone و JavaObject رو تیک بزنید.
Sub CreateNotificationChannel(ImportanceLevel As Int)
Dim p As Phone
If p.SdkVersion >= 26 Then
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim channelId As String = "channel_" & ImportanceLevel
Dim channel As JavaObject
channel.InitializeNewInstance("android.app.NotificationChannel", Array(channelId, Application.LabelName, ImportanceLevel))
'modify the channel
'For example: disable the badge feature
channel.RunMethod("setShowBadge", Array(False))
'set it
Dim manager As JavaObject = ctxt.RunMethod("getSystemService", Array("notification"))
manager.RunMethod("createNotificationChannel", Array(channel))
End If
End Sub
و به این شکل هم نوتیفیکیشن بزنید.
Dim n As Notification
CreateNotificationChannel(n.IMPORTANCE_HIGH)
n.Initialize2(n.IMPORTANCE_HIGH)
n.Icon = "icon"
n.SetInfo("test", "test", Main)
n.Notify(1)
