Comments (23)
Same problem here. Did you find a solution?
from ti.goosh.
might be related to https://jira.appcelerator.org/browse/TIMOB-24316
i know there's some titanium issues regarding intents in general. Hopefully those will be fixed in 6.0.4
from ti.goosh.
Issue is with the Modules parseBootIntent method it should be setting:
if (key.equals(INTENT_EXTRA)) { notification = intent.getExtras().getString(INTENT_EXTRA); }
from ti.goosh.
can you test and create a pull request for this?
from ti.goosh.
The issue @Bertuzb mentioned seems related. The pull request for the fix includes this commit tidev/titanium-sdk@dddb6a3
The condition above should be correct instead
if (key.equals(INTENT_EXTRA)) { notification = intent.getExtras().getString(INTENT_EXTRA); }
from ti.goosh.
im running 6.0.4 now though but I still cant seem to receive notification data in-app (after clicking notification) while having the app in background
from ti.goosh.
I'll make some tests shortly
from ti.goosh.
https://gist.github.com/Bertuzb/217b080b935aab362c72b213c3625368
its the testcase I used. Basically, the focus
event on the main window is called when resuming from background. It should contain some data but it currently doesnt. Hope it helps
from ti.goosh.
- SDK: 6.0.4 https://github.com/caffeinalab/titanium_mobile/tree/6_0_X_CAFFEINA fork from the -
official 6.0.4 release with some new features. - ti.goosh: 2.0.6
- device: Samsung Galaxy S5 G900F
[x] App closed: Notification is received and callback is fired when tapped on it
[x] App in background: Notification is received and callback is fired
[x] App in foreground: Callback is fired
Tested with SDK 6.0.0.GA and all cases still work.
from ti.goosh.
You should always call registerForPushNotifications
because it initialises the module with the callback functions.
$.index.open();
var TiGoosh = require('ti.goosh');
TiGoosh.registerForPushNotifications({
// The callback to invoke when a notification arrives.
callback: function(e) {
alert(e.data);
/*var data = JSON.parse(e.data || '');
Ti.API.debug("Callback", data);*/
},
// The callback invoked when you have the device token.
success: function(e) {
// Send the e.deviceToken variable to your PUSH server
Ti.API.debug('Notifications: device token is ' + e.deviceToken);
},
// The callback invoked on some errors.
error: function(err) {
Ti.API.error('Notifications: Retrieve device token failed', err);
}
});
from ti.goosh.
can you test the additional data
attribute? I am also receiving the notification when the app is in background but when clicking it, the app does not receive any data.
If you could provide your testcase that would be awesome too.
I've loaded the register function of TiGoosh immediately upon startup but it does not make a change in comparison to clicking a label and firing it that way
from ti.goosh.
Also that first comment confused me, a fork of 6_0_X with "some new features" but last line says you tested with 6.0.0.GA
from ti.goosh.
I tested the module with both our fork of the sdk 6.0.4.GA and the official sdk 6.0.0.GA and it works every time. The code I'm using is the one I provided in the comment above.
alert(e.data)
is correctly displayed in each case
from ti.goosh.
what do you do exactly with the google play services? I notice i get an error stating
[ERROR] GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
but i am not sure how to install these and how to make it work with various android devices. Until now I was under the assumption this did not affect this issue, but perhaps it does?
from ti.goosh.
The message is obsolete. It's a bug in google play services but doesn't impact on the module. It works nonetheless
from ti.goosh.
last thing i can find is this error im getting:
05-04 13:05:38.802: E/Notification(2383): setLatestEventInfo() is deprecated and you should feel deprecated.
05-04 13:05:38.802: E/Notification(2383): java.lang.Throwable
05-04 13:05:38.802: E/Notification(2383): at android.app.Notification.setLatestEventInfo(Notification.java:2083)
05-04 13:05:38.802: E/Notification(2383): at com.android.server.am.ActivityManagerService$MainHandler.handleMessage(ActivityManagerService.java:2352)
05-04 13:05:38.802: E/Notification(2383): at android.os.Handler.dispatchMessage(Handler.java:102)
05-04 13:05:38.802: E/Notification(2383): at android.os.Looper.loop(Looper.java:154)
05-04 13:05:38.802: E/Notification(2383): at android.os.HandlerThread.run(HandlerThread.java:61)
05-04 13:05:38.802: E/Notification(2383): at com.android.server.ServiceThread.run(ServiceThread.java:46)
Im using a Samsung Galaxy S3 but its running Android 7.1 (LineageOS). I have also tried on an Android 6.0.1 device but it does not throw the above error. Both devices will not call the callback even though its registered on startup.
Can you post the tiapp manifest?
from ti.goosh.
hold on im experiencing some differences between the api endpoints
https://android.googleapis.com/gcm/send (old one which this module implies)
and
https://fcm.googleapis.com/fcm/send (new one which i use)
I am getting correct callback events indeed on the gcm variant
from ti.goosh.
well this seems to have something to do with https://firebase.google.com/docs/cloud-messaging/concept-options#notifications_and_data_messages .
The payload im sending to POST https://fcm.googleapis.com/fcm/send
is:
$data = json_encode(
[
$sendKey => $to,
'notification' => ..., // title and body as seen in https://firebase.google.com/docs/cloud-messaging/http-server-ref#notification-payload-support
'data' => [
'data' => $data // some custom data
]
]
);
Removing the notification
key causes the use of data
key to form a notification. The data
key must then contain alert
(and preferabbly also title
). Defining notification
takes precedence though.
The notification
object behaves like (quote): "FCM automatically displays the message to end-user devices on behalf of the client app. Notification messages have a predefined set of user-visible keys and an optional data payload of custom key-value pairs."
I will try some tests with the data
object, but I have to make it work for iOS devices as well (they use the same firebase service).
from ti.goosh.
Yeah that's true. I remember, I answered this in a previous issue. notification
and data
don't work well together. Check out https://github.com/caffeinalab/ti.goosh/blob/master/test-fcm to see a simple implementation
from ti.goosh.
ok thanks for the effort you put into this. I will try to convert my api call to use the data-setup, but i might receive conflicts on the iOS side.
It might be a good idea as well to put a notice somewhere in the readme, that points the difference out vs notification
and data
. The TiGoosh module states GCM/FCM support after all but it has some gotcha's
from ti.goosh.
Yeah true. We'll update the documentation. Thanks for the feedback
from ti.goosh.
hallo , I have problem
I use SDK: 6.0.4 , Appcelerator Studio build: 4.8.1
ti.goosh: 2.0.6
device: Lenovo k4 note a7010
[x] App closed: Notification is received and callback is fired when tapped on it
[x] App in foreground: Callback is fired
My problem is :
[x] App in background: Notification is received and callback not fired
from ti.goosh.
@zulfiandri still encountering this problem?
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.