Giter VIP home page Giter VIP logo

Comments (18)

progress44 avatar progress44 commented on June 21, 2024

Are you using FCM?

from ti.goosh.

bert-w avatar bert-w commented on June 21, 2024

GCM/FCM yea (it still seems to be in a transitional phase)

from ti.goosh.

progress44 avatar progress44 commented on June 21, 2024

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.

bert-w avatar bert-w commented on June 21, 2024

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.

progress44 avatar progress44 commented on June 21, 2024

can you provide the code of how you use the module?

from ti.goosh.

bert-w avatar bert-w commented on June 21, 2024

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.

progress44 avatar progress44 commented on June 21, 2024

You've given three scenarios in the original comment but not specified when the error happens.

from ti.goosh.

bert-w avatar bert-w commented on June 21, 2024

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.

progress44 avatar progress44 commented on June 21, 2024

Have you checked the following closed issues:
#39
#36
#35

from ti.goosh.

bert-w avatar bert-w commented on June 21, 2024

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 Activitys are managed

from ti.goosh.

bert-w avatar bert-w commented on June 21, 2024

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.

progress44 avatar progress44 commented on June 21, 2024

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.

bert-w avatar bert-w commented on June 21, 2024

Please do. Let me know when you need me to test something on the newest branch.

from ti.goosh.

bert-w avatar bert-w commented on June 21, 2024

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.

progress44 avatar progress44 commented on June 21, 2024

Well, let me know if it fixes the issue
https://github.com/caffeinalab/ti.goosh/releases/tag/v2.0.2

from ti.goosh.

bert-w avatar bert-w commented on June 21, 2024

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.

bert-w avatar bert-w commented on June 21, 2024

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.

progress44 avatar progress44 commented on June 21, 2024

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)

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.