Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sendMessage invoked but no messageCallback defined #23

Closed
jcsomac opened this issue Oct 9, 2016 · 25 comments
Closed

sendMessage invoked but no messageCallback defined #23

jcsomac opened this issue Oct 9, 2016 · 25 comments

Comments

@jcsomac
Copy link

jcsomac commented Oct 9, 2016

i am getting this error when i receive a notification

screen shot 2016-10-09 at 1 57 06 pm

My code is:

screen shot 2016-10-09 at 2 28 50 pm

Thanks in advance.
Titanium SDK : 5.5.1

@progress44
Copy link
Contributor

What's the status of the app when this happens? Is it in the background, closed or open? Are you using the latest version of ti.goosh?

@jcsomac
Copy link
Author

jcsomac commented Oct 9, 2016

Hi... the app is open, and yes, i am using 1.6.1 version of the module.

@progress44
Copy link
Contributor

Does this happen always?

@jcsomac
Copy link
Author

jcsomac commented Oct 9, 2016

Yeap... i am trying right now, cleaning the project, and rebuilding it again.. and is the same..

@jcsomac
Copy link
Author

jcsomac commented Oct 9, 2016

Confirmed one more time.
and for the record, the notification arrives. but i want to do something when that happend.

d2491553-ad1d-45df-9bca-f6345ec45bc6

i want to insert the notification in a table to create a "notification counter".
But with no "callback" event, there is no way to doit.

Thanks for the help

@progress44
Copy link
Contributor

Yeah I understand. The callback is supposed to work. That's why we put it there. We're going to investigate the issue and see why this is happening.

@jcsomac
Copy link
Author

jcsomac commented Oct 9, 2016

hi again, i dont know if this can help you to help me, but i tried the old module caffeine.gcm and i got the same error message.

screen shot 2016-10-09 at 2 59 23 pm

maybe is some bad android configuration ?
thanks in advance.

@kopiro
Copy link
Contributor

kopiro commented Oct 10, 2016

Are you calling you iniciarApp on boot?

@jcsomac
Copy link
Author

jcsomac commented Oct 10, 2016

hi kopiro, yeap, iniciarapp() is a function, and i called just after some vars set.
The code you see, is the app.js
thanks.

@kopiro
Copy link
Contributor

kopiro commented Oct 10, 2016

Hi @jcsomac, maybe is not related, but you should never use the Ti.App.[VAR] form to store global objects.

From Titanium SDK starter tutorial:

Many users attempt to add to the Ti namespace as a means to persist data across contexts, extend / override native methods, etc. This can sometimes work but is very unreliable for the following reasons:

The Titanium end objects are really not true JavaScript objects. They are proxy representations of native operating system components. As such, they are constructed to pass through properties and method invocations. Your extensions could conflict with native functionality or interfere with proper operation of the proxy objects.
Sometimes you might be able to store things on the namespace but it's not changeable (i.e. an array stored on the namespace might not be able to be modified - mutable, etc.). Other-times your stored objects will be completely null.
Since this isn't an approved way of storing anything, there's no guarantee it will work in future releases of Titanium.
As a rule do not add to, or extend via the prototype, any object or module in the Titanium namespace. If you want to extend a core part of the Titanium API you should build a native module to accomplish this. If you're just looking for an extendible JS namespace, create your own (i.e. {{var MyApp={} }}).

Could you just try to write:

require('ti.goosh').registerForPushNotifications

@jcsomac
Copy link
Author

jcsomac commented Oct 10, 2016

Thanks Kopiro, and yes, this is old code and i am changing all that bad practices...
The problem persist when i try:

require('ti.goosh').registerForPushNotifications

but thanks anyhow..

@jcsomac
Copy link
Author

jcsomac commented Oct 13, 2016

hi guys... any news ? sugestions ?

@kopiro
Copy link
Contributor

kopiro commented Oct 13, 2016

Could you post an entire log of adb logcat | grep goosh with boot + notification?

@jcsomac
Copy link
Author

jcsomac commented Oct 13, 2016

Sorry @kopiro how can i do that ?

@progress44
Copy link
Contributor

@jcsomac just open a terminal window and run the code adb logcat | grep goosh

@jcsomac
Copy link
Author

jcsomac commented Oct 13, 2016

BEM $ adb logcat | grep goosh
bash: adb: command not found

it was executed in the root folder of the project.

@progress44
Copy link
Contributor

run it as android_sdk/platform-tools/adb logcat | grep goosh where android_sdk is the path to your sdk

@kopiro
Copy link
Contributor

kopiro commented Oct 19, 2016

@jcsomac ?

@jcsomac
Copy link
Author

jcsomac commented Oct 19, 2016

Sorry i was on vacations...
here is the output:

platform-tools $ ./adb logcat | grep goosh
D/PMS ( 849): acquireWL(21a1b2de): PARTIAL_WAKE_LOCK wake:com.bebesetmamans.forum/ti.goosh.IntentService 0x1 21357 10160 null
D/ti.goosh.IntentService(21357): Push notification received from: 713904143143
D/ti.goosh.IntentService(21357): Notification key : google.sent_time => 1476888270165 (java.lang.Long)
D/ti.goosh.IntentService(21357): Notification key : data => {"badge":1,"data":{"parent":"9565","child":"9621"},"alert":"Une maman vient de répondre à votre question al reves !","sound":"default","force_show_in_foreground":true,"vibrate":true,"tag":"APP","id":76763,"only_alert_once":false,"title":"Réponse du Forum BébésetMamans"} (java.lang.String)
D/ti.goosh.IntentService(21357): Notification key : google.message_id => 0:1476888270182359%54275acff9fd7ecd (java.lang.String)
D/ti.goosh.IntentService(21357): Notification key : collapse_key => do_not_collapse (java.lang.String)
E/ti.goosh.TiGooshModule(21357): sendMessage invoked but no messageCallback defined
D/PMS ( 849): releaseWL(21a1b2de): PARTIAL_WAKE_LOCK wake:com.bebesetmamans.forum/ti.goosh.IntentService 0x1 null

@kopiro
Copy link
Contributor

kopiro commented Oct 20, 2016

Could you try to do a full reinstall of app?

@jcsomac
Copy link
Author

jcsomac commented Oct 20, 2016

hi @kopiro, you
mean the titanium studio? or the android app?

@kopiro
Copy link
Contributor

kopiro commented Oct 20, 2016

The android app.

@jcsomac
Copy link
Author

jcsomac commented Oct 20, 2016

And that's it !!!
Worked like magic....
Is there any explanaition about this ?

@kopiro
Copy link
Contributor

kopiro commented Oct 20, 2016

Magic! :)
Anyway, I think something related to Android cache, but I don't really know.

@jcsomac jcsomac closed this as completed Oct 20, 2016
@e-m-s-y
Copy link

e-m-s-y commented Nov 29, 2016

A full re-install of my app also fixed: Sending event: exception on thread: AsyncTask #1 msg:java.lang.NullPointerException.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants