Comments (12)
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:
- I generated the required image-files with https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=clipart&source.clipart=ac_unit&source.space.trim=1&source.space.pad=0&name=ic_stat_ac_unit
- my icon-name is ic_background
- because I selected an icon the subdirs are res/drawable-*
- I copied the content of the downloaded zip-file to path_to_app_project/android/app/src/main
- I added following to the application-tag in android/app/src/main/AndroidManifest.xml
<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.
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.
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.
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:
Used an 900x900 PNG icon with base to generate all mipmap-xhdpi
icons...
See the ic_icons
on my project:
from background_locator.
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.
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) | 96x96https://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:
release
See that in release, i made a zoom to show a single pixel rendered.
from background_locator.
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.
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.
I am quite puzzeled, for me this worked having the notification icon done in asset studio and paced like this:
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.
I've solved it by setting it like in the images below
And all the png should be black and white
from background_locator.
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:
I generated the required image-files with https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=clipart&source.clipart=ac_unit&source.space.trim=1&source.space.pad=0&name=ic_stat_ac_unit
- my icon-name is ic_background
- because I selected an icon the subdirs are res/drawable-*
I copied the content of the downloaded zip-file to path_to_app_project/android/app/src/main
I added following to the application-tag in android/app/src/main/AndroidManifest.xml
<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.
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)
- How can I send data from location callback to controller? HOT 1
- location_callback_handler.dart not found when run release project HOT 5
- [ERROR:flutter/shell/common/shell.cc(93)] Dart Error: Dart_LookupLibrary: library 'package:untitled/location_callback_handler.dart' not found. HOT 4
- Unable to build flutter release version with background_locator lastest HOT 1
- Library Update
- Issue on release build HOT 8
- Unable to capture location in release mode (Android) HOT 4
- Unable to run on iOS
- Error java.lang.IncompatibleClassChangeError: Found interface com.google.android.gms.location.FusedLocationProviderClient HOT 1
- Error on init app flutter with carp_background_location HOT 5
- java.lang.IncompatibleClassChangeError: The method 'com.google.android.gms.tasks.Task com.google.android.gms.location.FusedLocationProviderClient.requestLocationUpdates(com.google.android.gms.location.LocationRequest, com.google.android.gms.location.LocationCallback, android.os.Looper)' was expected to be of type virtual but instead was found to be of type interface (declaration of 'rekab.app.background_locator.provider.GoogleLocationProviderClient' appears in /data/app/com.doa.lojisoft.saray-JqLCd0a12SEpAYQu6cUZjg==/base.apk:classes2.dex) HOT 2
- Service stopped suddenly in release mode android
- Data type mismatch (nullable type) and method implementation error in kotlin code just after adding the dependency HOT 1
- [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Invalid argument: is a regular instance: Instance of 'LocationDto'
- What is speed measured in?
- How to stop service after a period of time?
- Upgrade Background_Locator
- Need Code or Library in kotlin only
- I so confused about "getting location updates even when the app is killed" !!!!
- Is it still maintained? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from background_locator.