Comments (18)
Are you using FCM?
from ti.goosh.
GCM/FCM yea (it still seems to be in a transitional phase)
from ti.goosh.
It's a known issue. It has to do with the payload. It's not formatted correctly. Check out the documentation on how to send the correct payload.
from ti.goosh.
you mean the double data key? because i am sending it, and at times it works, but occasionally the above error happens. I cant yet reproduce a solid testcase for this though
from ti.goosh.
can you provide the code of how you use the module?
from ti.goosh.
i've made a bunch of code around it, but it boils down to the wiki examples:
var TiGoosh = require('ti.goosh');
TiGoosh.registerForPushNotifications({
success: self._success.bind(self),
error: self._error.bind(self),
callback: self._callback.bind(self)
});
Then the _callback
function prints the data for me in the console and handles the rest. However, by looking at the debug log you can see that the reported error is Java related, so however I implement it, it should not throw a NullPointer but instead show an error message that explains the error.
Here's a snippet from the tiapp.xml:
<application android:debuggable="false"
android:hardwareAccelerated="true"
android:icon="@drawable/appicon"
android:label="MyTitaniumApp"
android:largeHeap="true" android:theme="@style/Theme.Custom">
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
<activity android:label="@string/app_name"
android:launchMode="standard"
android:alwaysRetainTaskState="true"
android:name=".MyTitaniumAppActivity" android:theme="@style/Theme.Titanium">
<intent-filter>
<action android:name="android.intent.action.VIEW"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:scheme="mycustomurlscheme"/>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
from ti.goosh.
You've given three scenarios in the original comment but not specified when the error happens.
from ti.goosh.
I know, unfortunately I cant tell when exactly it happens, but if i would estimate:
- Open your app, send a push notification to it (while app is in foreground), everything should work and the callback function is called.
- After this, go to home menu on Android (taking the app to the background), send a push notification, click it, see error in console
from ti.goosh.
Have you checked the following closed issues:
#39
#36
#35
from ti.goosh.
i've checked my API for the third time, im sending the nested data
attribute as its supposed to. For some reason, when I kill my app/put it in background, and repeat that 2-3 times in various order, the error above will be thrown. I cant really say if its the module or something with the way the Titanium app Activity
s are managed
from ti.goosh.
Im also getting
02-21 16:17:24.421: E/GooglePlayServicesUtil(9648): The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
but I cant say if its related. Push Notifications work fine on initial app load
from ti.goosh.
The last one isn't related and it shouldn't be considered. It could be something with the Activity. Will make some tests as soon as I have some time
from ti.goosh.
Please do. Let me know when you need me to test something on the newest branch.
from ti.goosh.
I just noticed gittio has v2.0.2 while github has v2.0.0 as the latest release. I've been running 2.0.0 all the time
from ti.goosh.
Well, let me know if it fixes the issue
https://github.com/caffeinalab/ti.goosh/releases/tag/v2.0.2
from ti.goosh.
Unfortunately I'm getting the exact same error using 2.0.2.
I was previously using the gcm api endpoint ( https://gcm-http.googleapis.com/gcm/send ) but I've now changed it to fcm ( https://fcm.googleapis.com/fcm/send ). It did not make a difference though.
However I noticed in the tigoosh readme that you are sending notification data also in the data
object, while fcm explicitly wants separate objects like: "to" + "notification" + "data" (as seen here https://firebase.google.com/docs/cloud-messaging/server ). I've tried both syntaxes out but it still shows the same error message depending on background/foreground:
- Currently, as soon as I send a notification while having my app in the foreground, it shows the above error.
- When it is in the background, and I use the FCM syntax (which is a separate
notification
object in the JSON request) it shows:
03-02 12:21:15.721: E/TiLaunchActivity(31622): (main) [38328,38328] Android issue 2373 detected (missing intent CATEGORY_LAUNCHER or FLAG_ACTIVITY_RESET_TASK_IF_NEEDED), restarting app. MyAppActivity@ac7fdb4
- The above error does not show when using the GCM syntax (having the app in background). However, having the app in foreground and sending the data exactly as in the PHP example in the readme, it shows the error in post 1.
from ti.goosh.
okay I think i've found a cause of the problem. I wasnt consistently calling require('ti.goosh')
in my javascript, since I had an if-statement around it which checked if I had already registered the token.
I guess you will always need to call the ti.goosh module since it has to attach some Java stuff?
from ti.goosh.
Yes that is correct. The module needs to be instantiated every time you lunch the app since it handles any incoming notification.
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.