Android Question NotificationListerner can't get text for Big Picture notifications


Well-Known Member
Licensed User
Longtime User
For some reason I get null for the title and TickerText for Big Picture style notifications, particularly for Youtube
largeIcon=(Bitmap) Not initialized

(Bundle) Bundle[{android.title=Digital Foundry, android.reduced.images=true, client_id=aaab797b-40c1-491e-bbde-d6cbf06cf3bd, android.subText=null,$BigPictureStyle, android.showChronometer=false, android.icon=2131232750, android.text=Resident Evil Village PC Port Review: OK, But Not Quite Good Enough, android.progress=0, android.progressMax=0, interaction_screen_bundle_extra=Bundle[mParcelledData.dataSize=184], android.appInfo=ApplicationInfo{3761b8a},, android.contains.customView=true, android.showWhen=true,, android.infoText=null, android.progressIndeterminate=false, android.remoteInputHistory=null, android.summaryText=Resident Evil Village PC Port Review: OK, But Not Quite Good Enough,$BigPictureStyle, android.title.big=Digital Foundry, logging_directive=[B@820f871}]

Sub SBNSurrogate(SBN As StatusBarNotification) As NOTI
	Dim temp As NOTI, Extras As JavaObject = GetExtras(SBN)
	temp.Initialize =
	temp.PackageName = SBN.PackageName
	temp.TickerText = GetString(SBN.TickerText)
	temp.Title  = GetString(GetExtra(Extras, "title"))
	temp.subText = GetString(GetExtra(Extras, "subText"))
	temp.showChronometer = GetBoolean(Extras, "showChronometer")
	temp.icon = GetDouble(Extras, "icon")
	temp.text = GetString(GetExtra(Extras, "text"))
	temp.textLines = GetString(GetExtra(Extras, "textLines"))
	temp.progress = GetDouble(Extras, "progress")
	temp.progressMax = GetDouble(Extras, "progressMax")
	temp.showWhen = GetBoolean(Extras, "showWhen")
	temp.infoText = GetString(GetExtra(Extras, "infoText"))
	temp.progressIndeterminate = GetBoolean(Extras, "progressIndeterminate")
	temp.scoreModified = GetBoolean(Extras, "scoreModified")
	If temp.title.Length = 0 Then temp.title  = GetString(GetExtra(Extras, "title.big"))
	If temp.text.Length = 0 Then temp.text  = GetString(GetExtra(Extras, "bigText"))
	'temp.largeIcon = GetLargeIcon(Extras)
	Log("NOTI: " & temp) ' the above data
	Log(Extras) 'the above bundle string
	'{android.title=👍 Someone liked your reply!, android.text="@AverageDamian which is stupid since the door was open!", android.bigText="@AverageDamian which is stupid since the door was open!", android.title.big=👍 Someone liked your reply!, 
	Return temp
End Sub

Public Sub GetExtras(SBN As StatusBarNotification) As JavaObject
	Dim p As Phone
	If p.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)
			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(temp As String) As String
	If temp = "null" Then Return ""
	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


Well-Known Member
Licensed User
Longtime User
Desired: title in (Bundle) Bundle[{android.title=👍 Someone liked your reply!, android.reduced.images=true, client_id=fdfb46cd-1d35-4263-9178-41cc91b275d3, android.subText=null,$BigTextStyle, android.showChronometer=false, android.icon=2131232750, android.text="@FelineAugmentation agreed", android.progress=0, android.progressMax=0, interaction_screen_bundle_extra=Bundle[mParcelledData.dataSize=184], android.appInfo=ApplicationInfo{b17cd79}, android.showWhen=true,, android.bigText="@FelineAugmentation agreed", android.infoText=null, android.progressIndeterminate=false, android.remoteInputHistory=null,$BigTextStyle, android.title.big=👍 Someone liked your reply!, logging_directive=[B@acc271f}]

getString failed, getParcelable: null
getParcelable failed, getSerializable: null
above methods failed, getHardWay: 👍 Someone liked your reply!

getHardWay gets it directly from the string version of the bundle by checking what's between "android.title=" and ", android.reduced.images=" which is a dirty method I don't like using...

Public Sub GetString(Extras As JavaObject, Name As String, Adjacent As String, ExtraString As String) As String
	Dim temp As String = GetExtra(Extras, Name)
	If temp = "null" Then
		Log("Desired: " & Name & " in " & ExtraString)
		temp = Extras.RunMethod("getParcelable", Array("android." & Name))
		Log("getString failed, getParcelable: " & temp)
		If temp = "null" Then
			temp = Extras.RunMethod("getSerializable", Array("android." & Name))
			Log("getParcelable failed, getSerializable: " & temp)
		End If 	
		If temp = "null" Then 
			temp = API.GetBetween(ExtraString, "android." & Name & "=", ", android." & Adjacent & "=")
			Log("above methods failed, getHardWay: " & temp)
			If temp = "null" Or temp.Length = 0 Then
				Dim lines() As Object = Extras.RunMethod("getCharSequenceArray", Array("android." & Name))
				temp = ""
				If lines = Null Then Return ""
				For Each line As Object In lines
					If temp.Length > 0 Then temp = temp & CRLF
					temp = temp & line
			End If 
		End If 
	End If
	If temp = "null" Then Return ""
	Return temp
End Sub
Upvote 0