Giter VIP home page Giter VIP logo

Comments (21)

nadjib avatar nadjib commented on July 20, 2024 4

Finally it's work 😄 with 2.0.2 version (in foreground, in background and when the app is closed) 😃
But not work with 2.0.6 version !

from ti.goosh.

progress44 avatar progress44 commented on July 20, 2024

@Hrfreire what version of ti.goosh are you using?

from ti.goosh.

Hrfreire avatar Hrfreire commented on July 20, 2024

I downloaded the master code yesterday and compiled myself because some erros resolved on commit cfc52c0, after last release.

from ti.goosh.

progress44 avatar progress44 commented on July 20, 2024

@Hrfreire does that mean you're using firebase too?

from ti.goosh.

Hrfreire avatar Hrfreire commented on July 20, 2024

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.

Hrfreire avatar Hrfreire commented on July 20, 2024

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.

kopiro avatar kopiro commented on July 20, 2024

I can't replicate this issue.
Can you show me the code that are you using to catch notifications?

Thanks.

from ti.goosh.

frazei avatar frazei commented on July 20, 2024

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.

kopiro avatar kopiro commented on July 20, 2024

@frazei In which file is written this code? Alloy.js?

from ti.goosh.

frazei avatar frazei commented on July 20, 2024

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.

kopiro avatar kopiro commented on July 20, 2024

@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.

frazei avatar frazei commented on July 20, 2024

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.

progress44 avatar progress44 commented on July 20, 2024

@frazei if you have a Huawei phone, check this issue #39

from ti.goosh.

frazei avatar frazei commented on July 20, 2024

@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.

Hrfreire avatar Hrfreire commented on July 20, 2024

@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.

progress44 avatar progress44 commented on July 20, 2024

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.

nadjib avatar nadjib commented on July 20, 2024

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.

Hrfreire avatar Hrfreire commented on July 20, 2024

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.

nadjib avatar nadjib commented on July 20, 2024

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.

progress44 avatar progress44 commented on July 20, 2024

I'm glad you made it work.
What was going wrong when it wasn't working before?

from ti.goosh.

nadjib avatar nadjib commented on July 20, 2024

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)

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.