Android Question whatsapp second notifications text is "null".

webkumanda

Member
Licensed User
Hi

I'm trying to read to whatsapp second notifications text but I read a "null".

Fist notifications is ok

Next readings is "null" :(

-------------

Sub SBNSurrogate(SBN As StatusBarNotification) As NOTI
Dim temp As NOTI, Extras As JavaObject = GetExtras(SBN)
' Log("extras : " & Extras)
SID = SBN.id
temp.Initialize
temp.text.Initialize

temp.id = SBN.id
temp.PackageName=SBN.PackageName
temp.TickerText= SBN.TickerText

temp.title = GetExtra(Extras, "title")
temp.subText = GetString(Extras, "subText")
temp.showChronometer = GetBoolean(Extras, "showChronometer")
temp.icon = GetDouble(Extras, "icon")
temp.text.Add(GetExtra(Extras, "text"))
temp.summaryText = GetExtra(Extras, "summaryText")
temp.textLines = GetExtra(Extras, "textLines")
temp.progress = GetDouble(Extras, "progress")
temp.progressMax = GetDouble(Extras, "progressMax")
temp.showWhen = GetBoolean(Extras, "showWhen")
temp.infoText = GetExtra(Extras, "infoText")
temp.progressIndeterminate = GetBoolean(Extras, "progressIndeterminate")
temp.scoreModified = GetBoolean(Extras, "scoreModified")

'temp.largeIcon = GetLargeIcon(Extras)
'Log("NOTI: " & temp)
Return temp


End Sub

Public Sub GetExtras(SBN As StatusBarNotification) As JavaObject
SDKversion = p.SDKversion
If SDKversion >= 19 AND SBN.IsInitialized Then
Dim jno As JavaObject = SBN.Notification
If jno.IsInitialized Then
Dim Extras As JavaObject = jno.GetField("extras")

Extras.RunMethod("size", Null)
Log("EX : " & Extras)

Return Extras
End If
End If
End Sub

'Available extras: title, subText, showChronometer(bool), icon(long), text textLines progress(int) progressMax(int) showWhen(bool) largeIcon(bmp) infoText progressIndeterminate(bool) scoreModified(bool)
Public Sub GetExtra(Extras As JavaObject, Name As String) As String

Return Extras.RunMethod("getString", Array As Object("android." & Name))
End Sub

Public Sub GetString(Extras As JavaObject, Name As String) As String
Dim temp As String = GetExtra(Extras, Name)
If temp = Null Then Return "" 'Isn't working for some reason, I still get null strings





Return temp
End Sub
Public Sub GetBoolean(Extras As JavaObject, Name As String) As Boolean
Dim temp As String = GetExtra(Extras, Name)
Return temp.ToLowerCase = "true"
End Sub
Public Sub GetDouble(Extras As JavaObject, Name As String) As Long
Return Extras.RunMethod("getInt", Array As Object("android." & Name))
End Sub

Public Sub GetLargeIcon(Extras As JavaObject) As Bitmap
Dim r As Reflector, temp As Bitmap 'doesn't work yet
r.Target = Extras
temp = r.RunMethod2("getParcelableExtra", "android.largeIcon", "java.lang.String")
Return temp
End Sub
 
Top