Android Question Help extracting largeIcon from Notification Listener

kolpolok

Member
Licensed User
Longtime User
How to get largeIcon from Notification Listener

(Bundle) Bundle[{android.title=Road No 11, android.reduced.images=true, android.subText=10 min · 3.4 km · 6:24 AM ETA, android.showChronometer=false, android.text=Work - 6:24 AM ETA, android.progress=0, android.progressMax=0, android.appInfo=ApplicationInfo{e12b86b com.google.android.apps.maps}, android.showWhen=true, android.largeIcon=Icon(typ=BITMAP size=95x95), android.infoText=null, android.progressIndeterminate=false, android.remoteInputHistory=null, android.colorized=true}]

The type is android.graphics.drawable.Icon and I cant convert it to bitmap
 

kolpolok

Member
Licensed User
Longtime User
With this code
B4X:
Log(GetType(extras.RunMethod("get", Array("android.largeIcon"))))

I get
android.graphics.drawable.Icon
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Such messages are unneeded and will only cause me to ignore the thread.

You can convert it to a drawable with:
B4X:
Dim ctxt As JavaObject
ctxt.InitializeContext
Dim drawable As Object = icon.RunMethod("loadDrawable", Array(ctxt))

You can then set it as a view background or draw it with Canvas.DrawDrawable.
 
Upvote 0
Top