Setting an Android Notification Icon to a remote URL

前端 未结 2 398
猫巷女王i
猫巷女王i 2020-12-20 14:37

I want to use a remote URL (like a favicon) for a notification icon, however the constructor for a notification accepts only a resource ID (which is an integer) instead of s

相关标签:
2条回答
  • 2020-12-20 14:57

    You can't do this in Android currently, because resources can only be loaded from the /res/ directory of your APK. See Resources and Internationalization. The /res/ directory is built when you create your APK and can't be changed after.

    Do you expect your Icon to change often enough that you need to query a URL to ensure it is up to date every time you send a notification?

    Most applications that need to change their icon would simply put an update out on the Android market.

    0 讨论(0)
  • 2020-12-20 14:59

    Since API 11 Android has had the ability to use a Bitmap for a largeIcon in notifications. This has been expanded even further in Jelly Bean to allow entire notifications to be an image, BigPictureStyle.

    0 讨论(0)
提交回复
热议问题