arleyandrada / PushClient

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

Pushclient Module Titanium #41

Closed somefakeuser closed 9 years ago

somefakeuser commented 9 years ago

Hi,

i had purchased your module and have a problem to set it up correctly. So i hope, that you can help me out. :)

Info: I am using Titanium 3.4 and the titanium map-module. (beside others) On the first run with your module i can’t compile, cause your Module is using an older version of google-play-services.jar than the maps module. —> So i copied the maps jar file to the libs folder of the module - seems to be the solution.

But now i am receiving a new error and i have no idea how to solve this.

[ERROR] Application Installer abnormal process termination. Process exit value was 1
[ERROR] :  Failed to run  :
[ERROR] :  
[ERROR] :  UNEXPECTED TOP-LEVEL EXCEPTION:
[ERROR] :  java.lang.IllegalArgumentException: already added: Lcom/google/android/gms/R$color;
[ERROR] :   at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:122)
[ERROR] :   at com.android.dx.dex.file.DexFile.add(DexFile.java:161)
[ERROR] :   at com.android.dx.command.dexer.Main.processClass(Main.java:685)
[ERROR] :   at com.android.dx.command.dexer.Main.processFileBytes(Main.java:634)
[ERROR] :   at com.android.dx.command.dexer.Main.access$600(Main.java:78)
[ERROR] :   at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:572)
[ERROR] :   at com.android.dx.cf.direct.ClassPathOpener.processArchive(ClassPathOpener.java:284)
[ERROR] :   at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:166)
[ERROR] :   at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:144)
[ERROR] :   at com.android.dx.command.dexer.Main.processOne(Main.java:596)
[ERROR] :   at com.android.dx.command.dexer.Main.processAllFiles(Main.java:498)
[ERROR] :   at com.android.dx.command.dexer.Main.runMonoDex(Main.java:264)
[ERROR] :   at com.android.dx.command.dexer.Main.run(Main.java:230)
[ERROR] :   at com.android.dx.command.dexer.Main.main(Main.java:199)
[ERROR] :   at com.android.dx.command.Main.main(Main.java:103)
[ERROR] :  1 error; aborting

Do you have any idea how to solve this? Cause the module looks really nice to me and i’m really wanna to use it. :&

arleyandrada commented 9 years ago

I'm working in a fix to the Google Play Services version conflict. Plans to be released today.

Regards,

Arley

somefakeuser commented 9 years ago

Hi Arley,

that would be awesome :)

Best,

arleyandrada commented 9 years ago

The problem was finally solved! You can use the version of PushClient module attached. Remember to do a "clean" in your project before building again (after updating the module).

Any questions or problems return me.

[ attachment removed ]

somefakeuser commented 9 years ago

Hey,

thanks for this - it’s working now :-) Small question - Is it normal that the callback is fiert threetimes? (android)

Best,

arleyandrada commented 9 years ago

No, it's not normal. Check if you did not registered the callback event multiple times.

Regards,

Arley

somefakeuser commented 9 years ago

Hey,

short question - You don’t have any example with a working android-notification, do you? :)

best,

arleyandrada commented 9 years ago

Attached Click Here is a basic sample project.

Regards,

Arley

somefakeuser commented 9 years ago

Hey,

thanks for that - alerady saw this. :)

Maybe i have to be more specific: I need to show a notification(android) when the application is in background or/and closed. So far i’m not able to do so - if you have anything regarding this it would be really nice and a huge help for me.

best,

arleyandrada commented 9 years ago

There's no special requirements.

When my module detects the received notification it "automatically" shows an alert in android notification tray, similar to the existing iOS behavior.

The payload data sent through parse there is at last an "alert" attribute? It's the only requirement!

Take a look at the available attributes documented in my sample code.

Regards,

Arley

somefakeuser commented 9 years ago

hmm i saw the attributes, but at which point i have to use them?

arleyandrada commented 9 years ago

Which push notification provider you are using to send your payload data?

Using any provider or creating your own server, you will set the payload data to be sent (usually defined in JSON format), which may contain the special attributes that are documented.

My sample project uses the Parse.com provider (powerfull and easy).

Maybe can help: http://developer.android.com/google/gcm/index.html http://www.zinniakhan.com/2014/07/check-google-cloud-messaging-gcm-client.html

Regards,

Arley

somefakeuser commented 9 years ago

Ah ok- seems legit.

I’m using Kinvey.com for this purpose - i think it’s simmilar to parse.

I am now doing something like this on my serverside script.

var androidPayload = {title : "title", alert : "test", ticker : "Ticker" };
push.sendPayload(doc, iOSAps, iOSExtras, androidPayload);

But on Android nothing happens, if the app is in background. (ios works without any problem) (On Foreground all data is „arrived“ correctly)

Best,

arleyandrada commented 9 years ago

Take a look at the received data in foreground, check its content and share with me.

JSON.stringify(event.data)

Try: var androidPayload = {"alert":"test"};

Regards,

Arley

somefakeuser commented 9 years ago

This is the result of „background“ (so the data is arriving correctly i think, there’s just no notification)

[INFO] :   {"type":"PushClient_Callback","source":{"bubbleParent":true,"apiName":"Ti.Module","invocationAPIs":[],"_events":{"PushClient_Success":{},"PushClient_Error":{},"PushClient_Callback":{}}},"data":{"msg":"{\"alert\":\"test\"}","gcm":{"handlerId":0,"messageType":"gcm"},"collapse_key":"do_not_collapse","from":"251626472384"},"mode":3,"bubbles":false,"success":true,"code":0,"cancelBubble":false}

Result of Foreground:

{"type":"PushClient_Callback","source":{"bubbleParent":true,"apiName":"Ti.Module","invocationAPIs":[],"_events":{"PushClient_Success":{},"PushClient_Error":{},"PushClient_Callback":{}}},"data":{"msg":"{\"alert\":\"test\"}","gcm":{"messageType":"gcm"},"collapse_key":"do_not_collapse","from":"251626472384"},"mode":1,"bubbles":false,"success":true,"code":0,"cancelBubble":false}

Thanks in advance.

arleyandrada commented 9 years ago

The data received is in wrong format.

Your payload data is within an strange "msg" attribute.

This is the problem! Check your provider.

Regards,

Arley

somefakeuser commented 9 years ago

Hey,

after some review togehter with kinvey, one question: Do you maybe could recompile the module for me adjusted the string coming in for android to match this?

I don't have much experience with this side of titanium development and it would be a great help. If not i have to try it by myself.

Best,

arleyandrada commented 9 years ago

Attached is a new PushClient module version with an new "kinvey compatibility" feature.

Is everything working now!

Regards,

Arley

[ attachment removed ]