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

Android notification icon in status bar #1051

Closed
julianlecalvez opened this issue Jul 26, 2016 · 7 comments
Closed

Android notification icon in status bar #1051

julianlecalvez opened this issue Jul 26, 2016 · 7 comments

Comments

@julianlecalvez
Copy link

Hello !

I'm trying to manage local notifications in my app, but I have a trouble understanding the icons.
I setup my notifications icons with those 2 config lines :
smallIcon: "res://icon",
icon: "res://icon",

And I get my icon on the notification itself (beside the text), but I have a white square in the status bar.
I also tried to dissociate the "icon" entry with a white version of it, but it does not affect my notification. I still have my colored icon on the notification, and the white square in the status bar.

What am I missing ?

Thanks !

@alexalghisi
Copy link

Where did you put the icon ? :)

@julianlecalvez
Copy link
Author

Here is my ionic resources directory tree :

resources/
├── android
│   ├── icon
│   │   ├── drawable-hdpi-icon.png
│   │   ├── drawable-ldpi-icon.png
│   │   ├── drawable-mdpi-icon.png
│   │   ├── drawable-xhdpi-icon.png
│   │   ├── drawable-xxhdpi-icon.png
│   │   └── drawable-xxxhdpi-icon.png
│   └── splash
│       ├── drawable-land-hdpi-screen.png
│       ├── drawable-land-ldpi-screen.png
│       ├── drawable-land-mdpi-screen.png
│       ├── drawable-land-xhdpi-screen.png
│       ├── drawable-land-xxhdpi-screen.png
│       ├── drawable-land-xxxhdpi-screen.png
│       ├── drawable-port-hdpi-screen.png
│       ├── drawable-port-ldpi-screen.png
│       ├── drawable-port-mdpi-screen.png
│       ├── drawable-port-xhdpi-screen.png
│       ├── drawable-port-xxhdpi-screen.png
│       └── drawable-port-xxxhdpi-screen.png
├── icon.png
├── icon.psd
├── ios
│   ├── icon
│   │   ├── icon-40.png
│   │   ├── icon-40@2x.png
│   │   ├── icon-40@3x.png
│   │   ├── icon-50.png
│   │   ├── icon-50@2x.png
│   │   ├── icon-60.png
│   │   ├── icon-60@2x.png
│   │   ├── icon-60@3x.png
│   │   ├── icon-72.png
│   │   ├── icon-72@2x.png
│   │   ├── icon-76.png
│   │   ├── icon-76@2x.png
│   │   ├── icon-83.5@2x.png
│   │   ├── icon-small.png
│   │   ├── icon-small@2x.png
│   │   ├── icon-small@3x.png
│   │   ├── icon.png
│   │   └── icon@2x.png
│   └── splash
│       ├── Default-568h@2x~iphone.png
│       ├── Default-667h.png
│       ├── Default-736h.png
│       ├── Default-Landscape-736h.png
│       ├── Default-Landscape@2x~ipad.png
│       ├── Default-Landscape~ipad.png
│       ├── Default-Portrait@2x~ipad.png
│       ├── Default-Portrait~ipad.png
│       ├── Default@2x~iphone.png
│       └── Default~iphone.png
├── splash.png
└── splash.psd

@rwillett
Copy link
Collaborator

If this is still a problem, please update with the template in #1188.

@rwillett
Copy link
Collaborator

Closed as no response from original poster.

@Jharilela
Copy link

Jharilela commented Mar 18, 2017

I want to display a notification when a user messages via firebase cloud messaging. I expect the service to display the title, text of the message along with the app icon

When the app is in the foreground, notifications are awesome. It loads the title, text, icon and everything runs smoothly. However, when the app is in the background or inactive, the icon dissapears and a grey block appears.

Environment

Plugin version: 2.1.1
Platform: Android
OS version: 7.0 (Nougat)
Device manufacturer / model: ONEPLUS A3003
Cordova version (cordova -v): 6.4.0
Cordova platform version (cordova platform ls): android 6.0.0
Plugin config :

Expected Behavior

When app is in background and foreground

| icon |
|_________|
Title : John Do
Text : hey there

Actual Behavior

When app is in foreground

| icon |
|_________|
Title : John Do
Text : hey there

When app is in background, the icon becomes grey

| grey |
| symbol |
|__________|
Title : John Do
Text : hey there

Context

I am loading messages from Firebase Cloud Messaging (FCM). After receiving the data in JSON format, I load the data onto the the schedule function

FCMPlugin.onNotification(function(data){
	console.log('received notification ',data);
	$cordovaLocalNotification.schedule({
		 id: "1234",
		 title: data.title,
		text: data.text,
		icon : "res://icon.png",
		smallIcon : "res://icon.png",
		sound: null
	}).then(function () {
		console.log("The notification has been displayed");
	}).catch(function(err){
		console.warn("unable to display notification");
	});
});

The data i am receiving is in a JSON format as below

{
    "title" : "John Do",
    "text" : "hey there"
}

@rwillett
Copy link
Collaborator

Don't hijack another thread, especially one that's closed. Create a new issue.

This has also been covered a few times, you need to create the right icon and create a hook to copy the notification icon to the correct place. See #1222 for the solution.

@Jharilela
Copy link

Jharilela commented Mar 18, 2017 via email

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

No branches or pull requests

4 participants