Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change the small icon? #4

Open
anonwins opened this issue May 19, 2021 · 2 comments
Open

How to change the small icon? #4

anonwins opened this issue May 19, 2021 · 2 comments

Comments

@anonwins
Copy link

Hi,

can you give me a hint on how to change the small icon (white dot) in the notification?

@shreyashsaitwal
Copy link
Owner

That white dot is actually supposed to be the application's icon. I'm not sure why, but that white dot is only visible on Android 11. I've tested it on older versions (10, 8, 6) and the application's icon was showing currently.

The following line is responsible for setting up that icon:

.setSmallIcon(activity.getApplicationInfo().icon)

@anonwins
Copy link
Author

I think this is caused by the small icon's background color. If it is set to transparent, perhaps it will be solved. Unfortunately, I couldn't find proper code that builds. So it's up to you. What I have is:

	if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
	    notification.setColor(getResources().getColor(R.color.TRANSPARENT));
	}

Which results to "error: package R does not exist". Also, I read that getResources().getColor is deprecated.
Some discussion: https://stackoverflow.com/questions/31842983/getresources-getcolor-is-deprecated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants