arleyandrada / PushClient

FREE and Open Source - Titanium PushClient Module
Other
44 stars 17 forks source link

Android Push not working (parse) #115

Closed nubu closed 8 years ago

nubu commented 8 years ago

Hey,

i have a problem using the module with android/Parse.

I'm using the genymotion emulator. Testing the Push from terminal or a online tool (like this http://techzog.com/development/gcm-notification-test-tool-android/) everything works fine.

But sending a test push from parse nothing appears / or shown up in the console of the application. Any idea? I had insert the serverkey & gcm id to the parse backend.

Note: ios pushes from parse (same account) works great.

any idea where to look at?

arleyandrada commented 8 years ago

Hi Nubu,

It is not possible to receive push notifications with Android or iOS emulated device.

Maybe, with genymotion, you can try to hack it and install the google play services... but it is not like a real or else a good choice to test push notification applications.

Regards,

Arley

nubu commented 8 years ago

Hey,

installed the play services before - there is no problem with it at all. (bt of course a real device is cooler)

I've added this line to the request:

// Android Specific if (OS_ANDROID) { params['pushType'] = 'gcm'; params['GCMSenderId'] = 'XXX'; }

Now I'm receiving the pushes from parse, like expected. But another problem occurs:

if i send a more complex push for example:

curl -X POST \ -H "X-Parse-Application-Id: XX" \ -H "X-Parse-REST-API-Key: XX" \ -H "Content-Type: application/json" \ -d '{ "channels": [ "test" ], "data": { "alert": "The Mets scored! The game is now tied 1-1.", "badge": "Increment", "sound": "cheering.caf", "title": "Mets Score!" } }' \ https://api.parse.com/1/push

as shown in the parse docs, the Pushclient.showlocalnotification throws an error. (App foreground and Background) Any idea?

Best, Nico

The error:

[WARN] :   W/System.err:    at br.com.arlsoft.pushclient.PushClientModule.sendNotification(PushClientModule.java:548)
[WARN] :   W/System.err:    at br.com.arlsoft.pushclient.PushClientModule.showLocalNotification(PushClientModule.java:164)
[WARN] :   W/System.err:    at org.appcelerator.kroll.runtime.v8.V8Object.nativeFireEvent(Native Method)
[WARN] :   W/System.err:    at org.appcelerator.kroll.runtime.v8.V8Object.fireEvent(V8Object.java:62)
[WARN] :   W/System.err:    at org.appcelerator.kroll.KrollProxy.doFireEvent(KrollPr
[WARN] :   W/System.err:    at org.appcelerator.kroll.KrollProxy.handleMessage(KrollProxy.java:1131)
[WARN] :   W/System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
[WARN] :   W/System.err:    at android.os.Looper.loop(Looper.java:135)
[WARN] :   W/System.err:    at org.appcelerator.kroll.KrollRuntime$KrollRuntimeThread.run(KrollRuntime.java:112)
[ERROR] :  TiExceptionHandler: (main) [144366,145410] ----- Titanium Javascript Runtime Error -----
[ERROR] :  TiExceptionHandler: (main) [0,145410] - In alloy/controllers/index.js:84,24
[ERROR] :  TiExceptionHandler: (main) [0,145410] - Message: Uncaught Error: length=0; index=0
[ERROR] :  TiExceptionHandler: (main) [0,145410] - Source:             PushClient.showLocalNotification(event.data);
[ERROR] :  V8Exception: Exception occurred at alloy/controllers/index.js:84: Uncaught Error: length=0; index=0
arleyandrada commented 8 years ago
// "badge" (Int) to iOS badge count indicator

Try to change the "badge" attribute to an integer value.

nubu commented 8 years ago

Hm, no difference

Could you maybe test the request in your environment?

arleyandrada commented 8 years ago

Hi Nubu,

You found a bug in my module. Remove the "sound" attribute or use a valid sound from res folder.

I will fix it and release a new version as soon as possible.

Regards,

Arley

nubu commented 8 years ago

Jeah saw it a few seconds ago :)

removed the sound and it's working. Thanks for help anyway, nice support as always!

arleyandrada commented 8 years ago

Fixed in release PushClient 1.12