andrehtissot / cordova-plugin-firebase-extended-notification Goto Github PK
View Code? Open in Web Editor NEWSimple notification message from server as "data" that allows more options as how it will apear to the notified user.
License: MIT License
Simple notification message from server as "data" that allows more options as how it will apear to the notified user.
License: MIT License
Hi,
I'd like to choose when to display the dialog asking the user for permission to send push notifications. Even when I remove onNotification, getToken or onTokenRefresh calls it keeps on asking for permission on first launch.
Thanks
Hi André Tissot,
I successfully implement cordova-plugin-fcm in my IONIC application and its work perfectly in my devices, But I need to send large Icon and a small icon in the notification. I don't have much PHP knowledge. Please help me how to implement your plugin in my app. If you have any PHP file by which I send large icon and small icon in the notification. Please help me.
I wanted to know if anyone managed to make this plugin work with
Phonegap build
I have this error
:processReleaseGoogleServices
Found com.google.firebase:firebase-crash:+, but version 10.+ is needed for the google-services plugin.
Found com.google.android.gms:play-services-ads:+, but version 10.+ is needed for the google-services plugin.
Found com.google.android.gms:play-services-location:11.+, but version 10.+ is needed for the google-services plugin.
Found com.google.firebase:firebase-core:+, but version 10.+ is needed for the google-services plugin.
Found com.google.firebase:firebase-messaging:+, but version 10.+ is needed for the google-services plugin.
Found com.google.firebase:firebase-config:+, but version 10.+ is needed for the google-services plugin.
:processReleaseGoogleServices FAILED
FAILURE: Build failed with an exception.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.+.
BUILD FAILED
Total time: 3.247 secs
Error: /project/gradlew: Command failed with exit code 1 Error output:
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
FAILURE: Build failed with an exception.
Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.+.
Hi,
Thanks for the plugin.
I think I'm missing something. Is it supposed to work with firebase-admin or only via curl ?
I'm trying to call admin.messaging().sendToTopic('myTopic', payload)
with this payload but I get an error
var payload = {
data: {
dataValuesToGetWhenClickedOn: '111',
notificationOptions: {
id: '4',
title: 'Title test',
text: 'Test message',
smallIcon: 'drawable/icon',
largeIcon: 'https://avatars2.githubusercontent.com/u/1174345?v=3&s=96',
autoCancel: true,
vibrate: [200,300,200,300],
color: '0000ff',
headsUp: true,
sound: true
}
}
};
=> 'Messaging payload contains an invalid value for the "data.notificationOptions" property. Values must be strings.'
From the Firebase doc:
Data message payloads are composed of custom key-value pairs with a few restrictions, including the fact that all values must be strings
https://firebase.google.com/docs/cloud-messaging/admin/send-messages#defining_the_message_payload
I'm probably missing something obvious...
Thanks again
Hi! i need to execute JS function with params when click on notification.
how can i do this with your plugin?
Hello I have a problem with sending the push to all my apps.
So far, my apps send to my server the token and the id of the app.
Everything is saved in a database, so if I want to send a notification to an app (for example: com.example.app1), the database pulls me the entire token list from the com.example.myapp1 or com.example.myapp2.
Using a "for loop" I send the message to each of the token, using curl.
But this system takes quite a while and sometimes crashes with a 500 error.
So I thought of assigning each of my app a different topic, so that I could put in the "to:" field something like / topic / myapp1
But how do you do this in javascript?
How do I register the app to for example the topic: cantandocondios?
@andrehtissot, how to add Heads-up (peeking) notifications for Android?
Would really like to test your plugin but am having some problems.
where to put google-services.json?
Is it possible not to show the received notification depending on the variables? I write the interface where the user chooses to show him notifications or not. or better to do on the server side?
Hello @andrehtissot
Currently using this plugin on Android 10 and the "openApp": true option not working. Any ideal why this is so?
Hi,
The plugin works great on Android but I don't manage to make it work on iOS. I tried sendToTopic and sendToDevice via Firebase admin but nothing worked.
My APN auth key is loaded on Firebase, I have enabled the Push capabilities via Xcode, I use a good certificate. But it doesn't work.
Is that a bug ?
Thanks
Question: How do I get more apps on the same firebase project?
To run your test app I created a project with firebase and everything worked correctly.
Then I created another app with cordova, with another name (com.example.myapp) , and I added it to the same firebase project.
What happens is that the authorization id is the same for the two Apps, and if I remove your test app, I do not get the push messages anymore.
If I pulse in a push message sent to my app (com.example.myapp), it opens your test app ... and that hurts!
Do I have to create a project for each app?
regards
MaX
I try to use this plugin many times, but this error always happens
Element provider#android.support.v4.content.FileProvider at AndroidManifest.xml:41:9-43:20 duplicated with element declared at AndroidManifest.xml:12:9-14:20
See http://g.co/androidstudio/manifest-merger for more information about the manifest merger.
:processArmv7DebugManifest FAILED
C:\Users\Jonatas Borges\Desktop\sandbox\platforms\android\AndroidManifest.xml Error:
Validation failed, exiting
FAILURE: Build failed with an exception.
Manifest merger failed with multiple errors, see logs
Assuming it should be together with the original cordova-plugin-firebase - the plugin causes AndroidManifest.xml problem on build time (tried android only):
{myPath}/AndroidManifest.xml:63:9-65:20 Error: Element provider#android.support.v4.content.FileProvider at AndroidManifest.xml:63:9-65:20 duplicated with element declared at AndroidManifest.xml:30:9-32:20 {myPath}\AndroidManifest.xml Error: :app:processDebugManifest
Hi,
I tried to send the following message from my firebase admin app (in firebase functions)
const payload = {
data: {
dataValuesToGetWhenClickedOn: '111',
notificationOptions: JSON.stringify({
id: '4',
title: 'Title test',
text: 'Test message',
smallIcon: 'drawable/icon',
largeIcon: 'https://avatars2.githubusercontent.com/u/1174345?v=3&s=96',
autoCancel: true,
vibrate: [200,300,200,300],
color: '0000ff',
headsUp: true,
sound: true
})
}
};
return firebaseAdmin.messaging().sendToDevice(tokens, payload);
The message is being received, because:
However when on background, nothing seems to happen...
Unlike in you app example, I use FirebasePlugin to catch messages.
I also tried -
const payload = {
notification: {
title: "try",
body: "now",
},
data: {
dataValuesToGetWhenClickedOn: '111',
notificationOptions: JSON.stringify({
id: '4',
title: 'Title test',
text: 'Test message',
smallIcon: 'drawable/icon',
largeIcon: 'https://avatars2.githubusercontent.com/u/1174345?v=3&s=96',
autoCancel: true,
vibrate: [200,300,200,300],
color: '0000ff',
headsUp: true,
sound: true
})
}
};
return firebaseAdmin.messaging().sendToDevice(tokens, payload);
But now I only got regular message with title and body and no cool images...
thanks
I have two apps, both with firebase-exended-nofification.
Obviously the packages names an ids, are differents and I can install both in my phone.
But when I add this plugin, I can install only one, because the second one rise me the error "INSTALL_FAILED_CONFLICTING_PROVIDER"
If I remove the first app from the phone I can install the second.
If I remove the firebase-exended-nofification plugin from one of the two apps, I can install both in the phone...
any idea how to fix it?
how to send notification on multiple devices at one time, i have 20 thousand users
I would like to be able to pass my app a url to open an article.
My app reads articles via json from my website, and I would like if the user presses the push message, open the correct article in the app.
Any idea how I can do it?
regards
MaX
Hello!
I am having this error when trying to build.
FAILURE: Build failed with an exception.
* Where:
Build file '/app/build.gradle' line: 95
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all files for configuration 'classpath'.
> Could not find any matches for com.android.tools.build:gradle:2.3.+ as no versions of com.android.tools.build:gradle are available.
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/build/gradle/maven-metadata.xml
https://jcenter.bintray.com/com/android/tools/build/gradle/
file:/.m2/repository/com/android/tools/build/gradle/maven-metadata.xml
file:/.m2/repository/com/android/tools/build/gradle/
Required by:
unspecified:unspecified:unspecified
> Could not find any matches for com.google.gms:google-services:3.1.+ as no versions of com.google.gms:google-services are available.
Searched in the following locations:
https://jcenter.bintray.com/com/google/gms/google-services/maven-metadata.xml
https://jcenter.bintray.com/com/google/gms/google-services/
file:/.m2/repository/com/google/gms/google-services/maven-metadata.xml
file:/.m2/repository/com/google/gms/google-services/
Required by:
unspecified:unspecified:unspecified
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
I added this plugin but for some reason I am unable to get a token on my nexus 5 running 8.0. My timeout logs gets printed out. iOS works fine.
let tries = 200; var interval = setInterval(function () { if (--tries < 0) { clearInterval(interval); console.log('Unable to get token before timeout'); } (<any>window).FCMPlugin.getToken(function (token) { if (token !== null && token !== '') { console.log('Firebase Token: ', token); clearInterval(interval); } }, function (e) { console.error('Unable to get token: ', e) }); }, 100);
try building my last app after adding your plugin I have this error
Execution failed for task ':processArmv7DebugGoogleServices'.
> Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 10.+.
removing the plugin I can build without problems.
I tring changing the classpath 'com.google.gms:google-services:3.0.0' and then com.google.android.gms to 9.+. but it doesn't works
Any hint how to fix that?
regards
MaX
why can't play sound on cordova-android 7.1.1?
on Cordova-Android 6.2.3 it works well, but after upgrade Cordova-Android 7.1.1 it doesn't work.
I see something different in the folder location
@ 6.2.3 => res \ raw
@ 7.1.1 => app \ src \ main \ res \ raw
how can this return to work on cordova-android 7.1.1?
Hi andrehtissot
I successfully succeed to build and deploy the example app on my phone (android 8.0).
I also succed to send a notif with the PHP example script, and if I add logging in the onNotification event I can see data coming when the app is running (foreground or background)
But, I don't have any badge nor notification in the android notification zone when the app is in background or closed.
As well, when I click on the 'Show Notification' button nothing is coming
I also tried to add smth like:
FirebaseExtendedNotification.showNotification({dataValuesToGetWhenClickedOn: 111}, data.notificationOptions);
in the onNotification event, but nothing is coming
Any idea of what's wrong?
Thx
Hi i tested openApp, however my app cant execute when notification receive.
as subject, there is a problem in the AndroidManifest.xml.
every time I run "cordova run android", the same strings was added to AndroidManifest.xml, and as conseguence, some warnings in the logs, ad the app can't be lauched automactly from cordova.
Please have a look below
$ cat platforms/android/AndroidManifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="1" android:versionName="0.0.1" package="com.example.demo" xmlns:android="http://schemas.android.com/apk/res/android">
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/icon" android:label="@string/app_name" android:supportsRtl="true">
<activity android:exported="true" android:launchMode="singleTop" android:name="com.andretissot.firebaseextendednotification.NotificationActivity" android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:exported="true" android:launchMode="singleTop" android:name="com.andretissot.firebaseextendednotification.NotificationActivity" android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:exported="true" android:launchMode="singleTop" android:name="com.andretissot.firebaseextendednotification.NotificationActivity" android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:exported="true" android:launchMode="singleTop" android:name="com.andretissot.firebaseextendednotification.NotificationActivity" android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:exported="true" android:launchMode="singleTop" android:name="com.andretissot.firebaseextendednotification.NotificationActivity" android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:exported="true" android:launchMode="singleTop" android:name="com.andretissot.firebaseextendednotification.NotificationActivity" android:screenOrientation="portrait">
<intent-filter>
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
I noticed I still get banner notification even if the app is open. Is this expected behavior? I would expect to continue to receive notification on the background when the app is open but not show the iOS banner.
Thanks
I have problem build my project. There is duplication on android.support.v4.content.FileProvider.
I currently use cordova-plugin-file plugin with cordova-plugin-firebase-extended-notification plugin which causes this issue.
I do not know how to merge this together.
Below is my android manifest, please help.
AndroidManifest.txt
Hi, as title, with the last version of this plugin I can't build, due this error on the console:
Error: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
for the moment i'm back to 1.2.3 version
my system is ubuntu 14.04 with
$ cordova -v
7.0.1
The plugin and the example notify.php works great, but I need to use my own app icon, instead the default gray bell from "@mipmap/icon"
I tried to put my path, like @mipmap-ldpi-v4/icon.png but still resist me.
Do you have idea how to change it?
regards
MaX
Hi, this morning all works fine, but this afternoon occors this error below.
Creating Cordova project for the Android platform:
Path: platforms/android
Package: org.example.myapp
Name: myapp
Activity: MainActivity
Android target: android-25
Subproject Path: CordovaLib
Android project created with [email protected]
Installing "card.io.cordova.mobilesdk" for android
Subproject Path: CordovaLib
Installing "cordova-plugin-console" for android
Installing "cordova-plugin-device" for android
Installing "cordova-plugin-firebase-extended-notification" for android
Failed to install 'cordova-plugin-firebase-extended-notification': CordovaError: Failed to fetch plugin cordova-plugin-fcm-with-dependecy-updated via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 254 Error output:
The problem rise because the dependencies cannot be satisfacted, so id I try to install cordova-plugin-fcm by hand whith "cordova plugin add cordova-plugin-fcm" I can download it, but onlye the previous version: 2.1.1.
cordova-plugin-device 1.1.5 "Device"
cordova-plugin-fcm 2.1.1 "FCMPlugin"
cordova-plugin-firebase-extended-notification 1.4.1 "Firebase Extended Notification Cordova Plugin"
cordova-plugin-inappbrowser 1.7.0 "InAppBrowser"
cordova-plugin-splashscreen 4.0.2 "Splashscreen"
Now I can build, but there is another error... my app can't receive network data anymore.... :(
Olá André, tudo joia?
Como implementar ou usar uma imagem grande? No caso o:
.setStyle(new Notification.BigPictureStyle()
.bigPicture(aBigBitmap))
Para expandir a notificação.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.