Git Product home page Git Product logo

Comments (12)

scotty86 avatar scotty86 commented on July 1, 2024 6

fml (I know, best start for a comment, but it took me hours to figure it out...)

Problem:
I always got a white square as notification icon. My launch icon is a grey square with some text.

What I tried:

<meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_background" />
  • I tried: (But I think it's wrong. This file is for splash screens as its comments say. Therefore I removed it afterwards.)

Hello.

Working now. The icons are ok. But i have to add a reference for them on res/drawable/launch_background.xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
	<item android:drawable="@android:color/white" />
	<!-- You can insert your own image assets here -->
	<item>
		<bitmap android:gravity="center" android:src="@mipmap/ic_background" />
	</item>
</layer-list>

Nothing worked, still got the dammit white square 😡

Solution:
I defined the icon in the LocationSettings:

BackgroundLocator.registerLocationUpdate(
	callback,
	//optional
	androidNotificationCallback: notificationCallback,
	settings: LocationSettings(
		accuracy: LocationAccuracy.NAVIGATION,
		notificationTitle: "Awesome title",
		notificationMsg: "Event more awesome text",
		notificationIcon: "@drawable/ic_background",
		wakeLockTime: 60*6,
		autoStop: false,
		interval: 2
	),
);

notificationIcon: "@drawable/ic_background" fixed the problem!

from background_locator.

wemersonrv avatar wemersonrv commented on July 1, 2024 4

Hello.

Working now. The icons are ok. But i have to add a reference for them on res/drawable/launch_background.xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
	<item android:drawable="@android:color/white" />
	<!-- You can insert your own image assets here -->
	<item>
		<bitmap android:gravity="center" android:src="@mipmap/ic_background" />
	</item>
</layer-list>

from background_locator.

gpibarra avatar gpibarra commented on July 1, 2024

It seems more like an android problem than a library problem.
What versions do you have in the emulate? What do you have on the physical device?
Make sure the icon is png with a transparent background and a single color. Maybe there is a pixel with a different color that is what you see.

from background_locator.

wemersonrv avatar wemersonrv commented on July 1, 2024

It seems more like an android problem than a library problem.
What versions do you have in the emulate? What do you have on the physical device?
Make sure the icon is png with a transparent background and a single color. Maybe there is a pixel with a different color that is what you see.

Emulator: Google Pixel 2 (Android 9)
Device: Moto G5 ( Android 7.1,1 )... but i have 500 testers working my app in beta and all of them have the same issue.

Here the icon.. It is a 1 color (black) png with transparent background... If different, will not work in emulator... i tested other icons and colors with no transparent background and nowt works in debug... in short... Icon is good and works in debug... even when i install the app-debug.apk in my device:

image

Used an 900x900 PNG icon with base to generate all mipmap-xhdpi icons...

See the ic_icons on my project:

image

from background_locator.

gpibarra avatar gpibarra commented on July 1, 2024

try changing the dimensions of the icon

Small Notification Icon (mdpi) | 24x24
Small Notification Icon (hdpi) | 36x36
Small Notification Icon (xhdpi) | 48x48
Small Notification Icon (xxhdpi) | 72x72
Small Notification Icon (xxxhdpi) | 96x96

https://documentation.onesignal.com/docs/customize-notification-icons

from background_locator.

wemersonrv avatar wemersonrv commented on July 1, 2024

try changing the dimensions of the icon

Small Notification Icon (mdpi) | 24x24
Small Notification Icon (hdpi) | 36x36
Small Notification Icon (xhdpi) | 48x48
Small Notification Icon (xxhdpi) | 72x72
Small Notification Icon (xxxhdpi) | 96x96

https://documentation.onesignal.com/docs/customize-notification-icons

I'm using the right dimension for ?dpi. This is not the problem. The problem is the icon is not rendered right when in release... Just in *debug. If the icons were out of size, they would not have been rendered correctly even in the debug. The home icon i add in my previous post is only to show a sinle color and final file that was used to generate each dimension icon.

See below, try with anoter icon, creating each mdpi/hdpi/xdpi/etc icon with right dimensions (24x24 36x36, etc)... works on debug, but not in release:

debug
image

release
See that in release, i made a zoom to show a single pixel rendered.
image

from background_locator.

moovida avatar moovida commented on July 1, 2024

I can confirm that the notification icon works flawless. It is most probably an issue of the image not being properly created.

Best you use this online tool: http://romannurik.github.io/AndroidAssetStudio/icons-notification.html

I made it like this and it works perfectly.

from background_locator.

wemersonrv avatar wemersonrv commented on July 1, 2024

I can confirm that the notification icon works flawless. It is most probably an issue of the image not being properly created.

Best you use this online tool: http://romannurik.github.io/AndroidAssetStudio/icons-notification.html

I made it like this and it works perfectly.

Not works. I'm created the icons using this tool... test with my own image, and test with the same image in tool library (home icon on clipart)... none of them works.

When run in debug (emulator or device via adb) it works... fine fine but when make a release not works.

Other question: shouldn't notification icons be in the ** drawable-xxhdpi** folder instead mipmap ??

from background_locator.

moovida avatar moovida commented on July 1, 2024

I am quite puzzeled, for me this worked having the notification icon done in asset studio and paced like this:

image

and then just calling it like:

    var locationSettings = LocationSettings(
        notificationTitle: "SMASH location service is active.",
        notificationMsg: "",
        notificationIcon: "smash_notification",
        wakeLockTime: 20,
        autoStop: false,
        accuracy: smashLocationAccuracy.accuracy,
        interval: 1);

I have no other reference to smash_notification.png anywhere.

from background_locator.

sspatari avatar sspatari commented on July 1, 2024

I've solved it by setting it like in the images below
image
image

And all the png should be black and white

from background_locator.

andrezanna avatar andrezanna commented on July 1, 2024

fml (I know, best start for a comment, but it took me hours to figure it out...)

Problem:
I always got a white square as notification icon. My launch icon is a grey square with some text.

What I tried:

<meta-data
            android:name="com.google.firebase.messaging.default_notification_icon"
            android:resource="@drawable/ic_background" />
  • I tried: (But I think it's wrong. This file is for splash screens as its comments say. Therefore I removed it afterwards.)

Hello.
Working now. The icons are ok. But i have to add a reference for them on res/drawable/launch_background.xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
	<item android:drawable="@android:color/white" />
	<!-- You can insert your own image assets here -->
	<item>
		<bitmap android:gravity="center" android:src="@mipmap/ic_background" />
	</item>
</layer-list>

Nothing worked, still got the dammit white square 😡

Solution:
I defined the icon in the LocationSettings:

BackgroundLocator.registerLocationUpdate(
	callback,
	//optional
	androidNotificationCallback: notificationCallback,
	settings: LocationSettings(
		accuracy: LocationAccuracy.NAVIGATION,
		notificationTitle: "Awesome title",
		notificationMsg: "Event more awesome text",
		notificationIcon: "@drawable/ic_background",
		wakeLockTime: 60*6,
		autoStop: false,
		interval: 2
	),
);

notificationIcon: "@drawable/ic_background" fixed the problem!

this solved my issue

from background_locator.

alwijein avatar alwijein commented on July 1, 2024

Hello.

Working now. The icons are ok. But i have to add a reference for them on res/drawable/launch_background.xml:

<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
	<item android:drawable="@android:color/white" />
	<!-- You can insert your own image assets here -->
	<item>
		<bitmap android:gravity="center" android:src="@mipmap/ic_background" />
	</item>
</layer-list>

this solve my issue

from background_locator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.