Comments (21)
Finally it's work
But not work with 2.0.6 version !
from ti.goosh.
@Hrfreire what version of ti.goosh are you using?
from ti.goosh.
I downloaded the master code yesterday and compiled myself because some erros resolved on commit cfc52c0, after last release.
from ti.goosh.
@Hrfreire does that mean you're using firebase too?
from ti.goosh.
Yes. I'm using firebase.
I'm using django-fcm lib: https://django-fcm.readthedocs.io/en/latest/
It works when the app is opened. If the app is in background or closed, the notification arrives, but when user click the notification, the callback function is not fired.
from ti.goosh.
I've tested on my tablet (Samsung galaxy note 8.0) android 4.4.4, and it works when the app is on background but not when the app is closed.
On Motorola moto x 2014 android 6.0 and Xaomi redmi 2 pro android 5.1.1, not working when the app is in background or closed.
from ti.goosh.
I can't replicate this issue.
Can you show me the code that are you using to catch notifications?
Thanks.
from ti.goosh.
I have the same problem using FCM, Android 6.0, Ti 6.0.1.GA and Ti.Goosh 2.0.0 (tested 2.0.1 today with no difference at all).
It works only with the app open and in foreground.
var TiGoosh = require('ti.goosh');
TiGoosh.registerForPushNotifications({
callback: function(e) {
alert('Received push: ' + JSON.stringify(e));
},
success: function(e) {
deviceToken = e.deviceToken;
Ti.App.Properties.setString('deviceToken', deviceToken);
Ti.API.debug('deviceToken '+deviceToken);
},
error: function(err) {
alert('Failed to register for push notifications! ' + err);
Ti.API.error(err);
}
});
from ti.goosh.
@frazei In which file is written this code? Alloy.js?
from ti.goosh.
I have a file that is called push.js in the root (Resources) that exports a few functions via:
exports.registerAndroid = function() {
and this file is included inside app.js (that's not an alloy project):
var push = require('push');
if (Ti.Platform.Android) {
push.registerAndroid();
I've used this structure for years without any problem, it's the same for ios and it works...
Do you think that it can be a problem?
from ti.goosh.
@frazei I don't think so. Could you try to send a minimum part of your project by replicating this structure (only with Push)
from ti.goosh.
Thank you for your help!
I've made a simple app only with the push part:
https://www.dropbox.com/s/y86l6iu0516bxfa/simplepush.zip?dl=0
While making some more tests I've found out there was an error in the server part (the PHP script was using the "id" property as a varchar, not as a number) and now I can receive notifications even when the app is in background.
But the problem still remains if I close (or kill) the app: I do not receive notification at all.
from ti.goosh.
@frazei if you have a Huawei phone, check this issue #39
from ti.goosh.
@progress44 Yes! You are right... followed the instructions from http://www.androidheadlines.com/2016/01/how-to-fix-missing-notifications-on-huawei-phones.html and now it's working: I really hate Android and all this complications.
Thanks @progress44 and @kopiro for your kind support!
from ti.goosh.
@progress44 I just found that the django-fcm module (and FCM console) that I use, send some information inside 'notification' instead 'data' . The notification arrives normally, but the callback is not executed if the app is in background. I forked the django fcm module and edited to send all on 'data' and now it's working normally.
So, probably everyone that uses FCM console will have this problem.
from ti.goosh.
Yeah I imagined that was the case. I'm working on an updated to support FCM as it seems that people are starting to prefer it to GCM
Thanks for the information
from ti.goosh.
I have same problem, the app is calling the callback function only if is on foreground. When the app is closed and I click on the notification, the app open, but not execute callback function.
Any solution ?
from ti.goosh.
If you are using firebase, send the data notification inside 'data' object. Normally firebase uses 'notification' object to send the data. In my case, change it for data, works.
from ti.goosh.
Yes it's work when app is on foreground or background, but not if it is closed.
When the app is closed and I click on the notification, the app open, but not execute callback function.
from ti.goosh.
I'm glad you made it work.
What was going wrong when it wasn't working before?
from ti.goosh.
When the app is closed and I click on the notification, the app open, but not execute callback function
from ti.goosh.
Related Issues (20)
- How can we use both ios? HOT 3
- Failed to get GCM Registration Token:TIMEOUT HOT 1
- Cannot build with 7.1.0 SDK. HOT 10
- Crash Report HOT 2
- Crash report from Google Play HOT 1
- Crash report HOT 2
- Recent crash report HOT 10
- java.lang.ClassCastException receiving foregrounded FCM ttl and sent_time HOT 2
- Silent notification not receiving payload? HOT 2
- Getting invalid sender error
- Compilation Error HOT 10
- targetSdkVersion="26" Notifications not received on some android device HOT 24
- Android Oreo Issue --Notification is not receiving in background HOT 3
- Not getting callback when the app is in background or killed HOT 27
- [WARN] : W/ti.goosh.IntentService: Show Notification: FALSE HOT 5
- ti.goosh and ti.admob together
- Use Android notification channels HOT 1
- Firebase support - internal dependencies HOT 8
- Remove app from background, No notification get
- Need to bump version for TiSDK 9.x version HOT 2
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 ti.goosh.