arleyandrada / pushclient Goto Github PK
View Code? Open in Web Editor NEWFREE and Open Source - Titanium PushClient Module
License: Other
FREE and Open Source - Titanium PushClient Module
License: Other
Hi Arley,
I've tried out your module and was suprised at how easy it is :).
I'm trying out some equivalent modues to GCM receivers for a couple of days.
Let me ask some before I dev deep with yours:
1: Is your module capable of recieving messages while the app isn't running?
(I'm guessing the answer is no but let me ask just in case!)
I'm also trying out GCM.js also and it seems it's got a bit advantage to your module.
http://iamyellow.net/post/40100981563/gcm-appcelerator-titanium-module
( GCM.js looks a little bit outdated though, since it's based on gcm.jar)
2: I didn't notice but the error below came up in console. any ideas?
[ERROR] GooglePlayServicesUtil: The Google Play services resources were not found. Check your project configuration to ensure that the resources are included.
Full trace: http://pastebin.com/A94iEDGg
Thanks in advance, if you need further infos please hit me up!
Best,
can you give me an example to create status notification with your module and resume when click at it.
Thanks,
Hello,
Here is my source code, [PRIVATE]
I am using https://github.com/benbahrenburg/LocalNotify for notification.
Please help us in solving the issue.
Thanks,
Hi,
I'm looking for a way to push data to Android and iOS... and I found PushClient.
Before buying the module I would like to know how I would push messages from my server to apps. Have you a technical documentation on the api of the server side ?
Moreover, like I understand the module process, my server would send directly messages to GCM and APN, is it right ?
Best regards
Hi,
I'm seeing the pushclient at market place.
How does it work for push notifications from outside?
Does it work?
How can i sent from my server?
The app need to run as service or something specific?
Regards
Hi,
I've purchased the module "PushClient" some time ago but I have problems in using.
When I include it and compile gives me the following error:
[INFO] : Running dexer: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/bin/java "-Xmx1024M" "-XX:-UseGCOverheadLimit" "-Djava.ext.dirs=/Users/xxxxx/Library/android-sdk-macosx/platform-tools" "-jar" "/Users/xxxxx/Library/android-sdk-macosx/build-tools/21.1.1/lib/dx.jar" "--dex" "--output=/Users/xxxxx/Documents/Titanium_Studio_Workspace/I Portali/build/android/bin/classes.dex" "/Users/xxxxx/Documents/Titanium_Studio_Workspace/I Portali/build/android/bin/classes" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/lib/titanium-verify.jar" "/Users/xxxxx/Library/Application Support/Titanium/modules/android/ti.map/2.2.2/map.jar" "/Users/xxxxx/Library/Application Support/Titanium/modules/android/ti.map/2.2.2/lib/google-play-services.jar" "/Users/xxxxx/Documents/Titanium_Studio_Workspace/I Portali/modules/android/br.com.arlsoft.pushclient/1.6/pushclient.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/kroll-v8.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-analytics.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/aps-analytics.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-android.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/jaxen-1.1.1.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/ti-commons-codec-1.3.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/kroll-common.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/titanium.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-app.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-ui.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/nineoldandroids-appc-2.4.0.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-filesystem.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-media.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-appcompat.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/android-support-v4.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/android-support-v7-appcompat.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-locale.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-network.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/thirdparty.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-xml.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-utils.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-geolocation.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-accelerometer.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-contacts.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-map.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-calendar.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-gesture.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-platform.jar" "/Users/xxxxx/Library/Application Support/Titanium/mobilesdk/osx/3.4.1.GA/android/modules/titanium-database.jar"
[ERROR] : Failed to run dexer:
[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:732)
[ERROR] : at com.android.dx.command.dexer.Main.processFileBytes(Main.java:673)
[ERROR] : at com.android.dx.command.dexer.Main.access$300(Main.java:82)
[ERROR] Application Installer abnormal process termination. Process exit value was 1
[ERROR] : at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:602)
[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:632)
[ERROR] : at com.android.dx.command.dexer.Main.processAllFiles(Main.java:510)
[ERROR] : at com.android.dx.command.dexer.Main.runMonoDex(Main.java:279)
[ERROR] : at com.android.dx.command.dexer.Main.run(Main.java:245)
[ERROR] : at com.android.dx.command.dexer.Main.main(Main.java:214)
[ERROR] : at com.android.dx.command.Main.main(Main.java:106)
[ERROR] : 1 error; aborting
I Use Appcelerator Version: 3.4.1, Project "Mobile Primary"
Other modules configured: ti.map
Only Android Project.
Thanks in advance,
Hi
We purchased your PushClientModule a couple of weeks ago and are now implementing it in our code.
We can successfully register the device, and receive a registration id back from GCM, most of the time. Sometimes it returns an unable to register this device error. Why would that be happening?
We have not been able to receive notifications. Our web service successfully sends notifications to GCM using our sender id and api key, and receives a message id back, however the message is not received on the android phone.
We have it running in debug mode, connected to Titanium on a Mac, with a breakpoint set at the first line of the callback. It never gets hit after sending the message through our web service, or through the code provided at http://stackoverflow.com/questions/22168819/android-test-push-notification-google-cloud-messaging-online.
Can you shed some light on what we may be doing wrong?
Here is how we have implemented the code. The IOS portion works with no issues.
( function() {'use strict';
var _core = require('/system/core');
exports.RegisterForNotifications = function() {
var pushClient = _core.android ? require('br.com.arlsoft.pushclient') : undefined,
registerOptions = _core.android ? {
GCMSenderId: '130519290945'
} : undefined,
deviceToken = null,
receivePush = function (event) {
var data = JSON.parse(event.data);
//Ti.Media.vibrate();
_core.utilities.log('Push data received: event = ' + event);
if(_core.android) {
switch (event.mode) {
case pushClient.MODE_FOREGROUND:
_core.utilities.log('Callback in Foreground: ' + JSON.stringify(data));
break;
case pushClient.MODE_CLICK:
_core.utilities.log('Callback from Click: ' + JSON.stringify(data));
break;
case pushClient.MODE_BACKGROUND:
pushClient.endBackgroundHandler(data.handlerId);
_core.utilities.log('Callback from Silent:nn' + JSON.stringify(data));
break;
default:
_core.utilities.log('Unknown event.moe:' + JSON.stringify(event.mode));
break;
}
}
else if (_core.ios){
Ti.UI.iPhone.appBadge = data.badge > 0 ? data.badge : undefined;
}
if(!_core.utilities.isEmpty(data.message)) {
_core.popup.open({
message: data.message
});
}
},
deviceTokenSuccess = function(event) {
_core.utilities.log('Push Notifications: device token is: ' + _core.android ? event.registrationId : event.deviceToken);
_core.settings.deviceToken = _core.android ? event.registrationId : event.deviceToken;
Ti.App.Properties.setObject('settings', _core.settings);
},
deviceTokenError = function(event) {
if(_core.android) {
switch (event.code) {
case pushClient.ERROR_SENDER_ID:
event.error = 'Undefined GCMSenderId';
break;
case pushClient.ERROR_PLAY_SERVICES:
event.error = 'Google Play Services not available';
break;
case pushClient.ERROR_NOT_SUPPORTED:
event.error = 'Not supported error';
break;
case pushClient.ERROR_REGISTER:
event.error = 'Unable to register this device. Perhaps it is already registered?';
break;
case pushClient.ERROR_UNREGISTER:
event.error = 'Unable to unregister this device';
break;
default:
event.error = 'Unknown error';
break;
}
}
_core.utilities.log('Push Notifications: registration error: ' + event.error);
},
registerForIOSPush = function () {
Ti.Network.registerForPushNotifications({
success: deviceTokenSuccess,
error: deviceTokenError,
callback: receivePush
});
// Remove event listener once registered for push notifications
Ti.App.iOS.removeEventListener('usernotificationsettings', registerForIOSPush);
};
if (_core.ios) {
// Check if the device is running iOS 8 or later
if (parseInt(Ti.Platform.version.split(".")[0], 10) >= 8) {
// Wait for user settings to be registered before registering for push notifications
Ti.App.iOS.addEventListener('usernotificationsettings', registerForIOSPush);
// Register notification types to use
Ti.App.iOS.registerUserNotificationSettings({
types: [
Ti.App.iOS.USER_NOTIFICATION_TYPE_ALERT,
Ti.App.iOS.USER_NOTIFICATION_TYPE_SOUND,
Ti.App.iOS.USER_NOTIFICATION_TYPE_BADGE
]
});
} else {
// For iOS 7 and earlier
Ti.Network.registerForPushNotifications({
// Specifies which notifications to receive
types: [
Ti.Network.NOTIFICATION_TYPE_BADGE,
Ti.Network.NOTIFICATION_TYPE_ALERT,
Ti.Network.NOTIFICATION_TYPE_SOUND
],
success: deviceTokenSuccess,
error: deviceTokenError,
callback: receivePush
});
}
} else if(_core.android) {
pushClient.addEventListener(pushClient.EVENT_SUCCESS, deviceTokenSuccess);
pushClient.addEventListener(pushClient.EVENT_ERROR, deviceTokenError);
pushClient.addEventListener(pushClient.EVENT_CALLBACK, receivePush);
pushClient.registerPush(registerOptions);
}
};
}());
I posed about this on the "Push Client" Answers section. I am also sending it in an email as I really need a quick response.
I have two apps running this module that work great on iOS, but both fail to work on android. With both apps I get the following in my Console before the tablet gives me an “unfortunately, this application has stopped”
[WARN] : dalvikvm: threadid=16: thread exiting with uncaught exception (group=0x417e2ce0)
[ERROR] : TiApplication: (AsyncTask #1) [1813,1813] Sending event: exception on thread: AsyncTask #1 msg:java.lang.RuntimeException: An error occured while executing doInBackground(); Titanium 3.4.1,2014/11/13 13:33,5982e8f
[ERROR] :TiApplication: java.lang.RuntimeException: An error occured while executing doInBackground()
[ERROR] : TiApplication: at android.os.AsyncTask$3.done(AsyncTask.java:300)
[ERROR] : TiApplication: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
[ERROR] : TiApplication: at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
[ERROR] : TiApplication: at java.util.concurrent.FutureTask.run(FutureTask.java:242)
[ERROR] : TiApplication: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) [ERROR] : TiApplication: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
[ERROR] : TiApplication: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
[ERROR] : TiApplication: at java.lang.Thread.run(Thread.java:841)
[ERROR] : TiApplication: Caused by: java.lang.NullPointerException
[ERROR] : TiApplication: at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:478)
[ERROR] : TiApplication: at android.app.PendingIntent.getBroadcast(PendingIntent.java:467)
[ERROR] : TiApplication: at com.google.android.gms.gcm.GoogleCloudMessaging.d(Unknown Source)
[ERROR] : TiApplication: at com.google.android.gms.gcm.GoogleCloudMessaging.dn(Unknown Source)
[ERROR] : TiApplication: at com.google.android.gms.gcm.GoogleCloudMessaging.unregister(Unknown Source)
[ERROR] : TiApplication: at br.com.arlsoft.pushclient.PushClientModule$2.doInBackground(PushClientModule.
I am sorry the errors got cut off, But this is most of them. I will send you an email tomorrow when I have access to the rest. If you have any hints as to what the problem is, please let me know.
The module seems to work great, the only thing I can’t figure out is how to tell if the unregisterPush() method is successful or not.
Hi,
we are using PushClient to handle push notifications in our Titanium app. On Android we don't receive any notifications when the app is not running (background or foreground). Does PushClient support receiving notifications in this case?
Regards,
Hi Arley,
Yes, I do have a question about using the PushClient. After I followed all the steps and ran the example application on Android v. 4.2.2, I get an alert that the registration was successful and get a registration id. But, when I send a push message to that id, the application crashes upon receipt of the message. Here's the console output:
[WARN] : dalvikvm: Unable to resolve superclass of Lbr/com/arlsoft/pushclient/GCMBroadcastReceiver; (326)
[WARN] : dalvikvm: Link of class 'Lbr/com/arlsoft/pushclient/GCMBroadcastReceiver;' failed
[WARN] : dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x41563ac8)
[ERROR] : TiApplication: (main) [486369,1343621] Sending event: exception on thread: main msg:java.lang.RuntimeException: Unable to instantiate receiver br.com.arlsoft.pushclient.GCMBroadcastReceiver: java.lang.ClassNotFoundException: Didn't find class "br.com.arlsoft.pushclient.GCMBroadcastReceiver" on path: /data/app/com.push-1.apk; Titanium 3.2.2,2014/03/05 12:22,96e9a07
It appears that the "GCMBroadcastReceiver" class cannot be found. Do you know how I can fix this?
Thank you
hi Arley
sorry to bother you again.
I was subscribed to iOS using a GitHub Parse previous to buy you module. Then I realize that Titanium.Network.registerForPushNotifications don´t work in Android and bought your module.
Now I'm trying to unify my code using only your module and after unregister iOS, I can´t get it subscribe again. The first alert return a successful registrationId, but after that an error happens when Parse.registerDevice is called.
Please help !!!!
Hi, I have a question, when the application is completly closed(it's dead not sleep), how can I handle the push notifications? Actually any of callbacks are triggered when the application is closed and a notification is sent.
I really don't understand when MODE_CLICK & MODE_ACTION are triggered, May you explain to me?
Thanks.
Hi,
we have bought two seats of your Appcelerator Titanium Module PushClient. But if we start our App with the module on an Android Smartphone we get the following error:
"License violation detected. Unlicensed module(s) detected. You must be a subscriber to use one or more of the modules included with this project.. Please contact Appcelerator Support.“
What is the problem? Please help!
Sincerely
Hello,
I just purchased your PushClient from the marketplace and there is no iOS example code included. The iOS example is just the Android example code.
I need to know more on how to use this module.
Thanks,
Hi Supportteam,
I bought your module and got it running with your parse example.
Pushes are working, but Click-Callback-Events are never deleted from my phone.
Every time I open my app, I receive the first click event, that was generated.
Even if I push new notifications, the notification is uptodate, but on clicking it I receive the old click event.
I habe to restart my phone to get rid of the old click event.
Do you have any suggestions on fixing this behaviour?
Hey Arley,
I don't think you understood my question correctly, I was asking if there was a way to track the push opens on the Parse website, like when a push is open, it lets the Parse API know that it was received/opened.
One more question as well. Is there a way to set the notification icon for the push notification on Android? I'm assuming it's through the registerOptions, but I can't quite seem to figure it out...
Thanks,
Hello,
hope your well.
I bought your Titanium module this morning and wonder if you can help me with some tips to use it.
Looking your documentation and examples in iphone I won't understang where I need to place my cert id from Apple. I'm new in this topics, sorry if sounds dummy.
Thanks for your help
So I've downloaded the module, got the documentation but I need to know how to install the modules.
Another thing I don't understand is if i need to configure all the files on parse folder that the example folder has.
I wonder if you could assist please?
I’m using your module and it’s working great for iOS, however whatever I do I cannot get it to work with Android, I keep getting the error message that “Google Play services not available” when I try to register. I have double checked the GCM Sender ID several times.
Thanks for your time.
Oi Arley, estava agora mesmo procurando vc no fórum do google :-)
Será que seu módulo vai trabalhar com http://codecanyon.net/item/send-mobile-push-notification-messages/6548533?WT.ac=search_item&WT.oss_phrase=push%20notification&WT.oss_rank=3&WT.z_author=smartiolabs ?
Estou iniciando com Titanium. Estivemos criando alguns apps pelo goodbarbe.com e como.com mas já não resolve.
Precisamos uma app bonita, simples, e integrada com o Wordpress pois estamos montando uns sistemas de gestão com marketing integrado e seria importantíssimo unir um app com possibilidade de enviar notificações pelo painel Wordpress.
Eu teria alguma dificuldade em usar seu módulo nesse sentido?
Você teria algum tempo para participar de um projeto?
Hello,
I have bought PushClient iOS module from marketplace but i couldn't use it. Is there a tutorial how to use this ? I have look at the example but couldn't make it.
Thanks
Dear Sir / Madame,
We have found a problem after the update to iOS 8 in your version.
We get error messages.
enabledRemoteNotificationTypes is not supported in iOS 8.0 and later.registerForRemoteNotificationTypes: is not supported in iOS 8.0 and later.
Can you please tell us if you are going to update the module, because we have bought the module, but it's not working in iOS 8.
Best regards,
Hi Arley,
Thanks for the great library. We just have a few questions:
Thanks!
Dear Arley,
Thanks for your message. I'm testing it right now. I've the Android part up and running, but the iOS version not. I try to get that working first. Maybe there's more documentation available for the iOS version, but I'll figure it out myself.
Thanks,
Hi Arley,
Hope you're doing well. I've noticed you've released a new version of PushClient. I'm glad to see you're keeping your modules up-to-date. I'm having a problem with the latest version though, it gives me a compilation error. I'm using Ti SDK 3.4.0 GA. Switching back to PushClient 1.5 lets me compile my app successfully. Please advise. Thank you.
Hola,
Tenemos un problema con vuestro módulo. Hace muchos días atrás os escribimos para pediros ayuda.
Mi compañera de trabajo compró vuestro módulo y lo hemos implementado en una aplicación. Hemos adaptado el ejemplo adjunto para que la aplicación se registre en nuestro servidor. (solo hemos cambiado la url de "parse" por la nuestra y unos parámetros).
Hasta aquí todo bien, la aplicación se abre, se registra correctamente y muestra el "alert", pero cuando desde el servidor enviamos una notificación push la aplicación no hace absolutamente nada. No muestra "alerts" y "Titanium console" no muestra mensajes.
¿Hay que hacer algo más que lo que indica el ejemplo de el módulo?
——————
Hi there,
We have a problem with your module. Many days ago I wrote to ask for your help.
My coworker bought your module and have put in an application. We have adapted the attached example for the application to register on our server. (we have only changed the url of "parse" for ours and parameters).
So far so good, the application opens is recorded correctly and displays the "alert", but from the server when sending a push notification application does absolutely nothing. No shows "alerts" and "Titanium console" does not display messages.
Should we do more than indicating the example of the module?
———————————
Oi lá,
Temos um problema com o seu módulo. Muitos dias atrás eu escrevi para pedir sua ajuda.
Meu colega comprou o seu módulo e ter colocado em um aplicativo. Nós adaptamos o exemplo em anexo para o pedido de registo no nosso servidor. (só mudaram a url de "parse" para nosso e parâmetros).
Até aí tudo bem, o aplicativo abre é registrado corretamente e exibe o "alerta", mas a partir do servidor ao enviar um pedido de notificação de envio não faz absolutamente nada. Não mostra "alertas" e "consola Titanium" não exibir mensagens.
Devemos fazer mais do que indica o exemplo do módulo?
Hello!
I have a question about your iOS module, works with Parse at 100% percent? can i use it with my own server and php? and most important, will be updates for new Xcode versions and titanium versions? thanks in advance!
Hi there! Thanks for the great module!
By the way, in iOS8
"enabledRemoteNotificationTypes is not supported in iOS 8.0 and later.”
"RegisterForRemoteNotificationTypes:. Is not supported in iOS 8.0 and later”
error message that comes out.
And it seems can not send notification to iOS8 device.
I use Parse.com. would not be a good solution?
sorry google translated. Thank you
Hello,
I have install your module, but when I run app in titanium I get this error:
Error: couldn't not find module: parse
thanks very much for your help,
Oi Arley,
Uso PHP nos servidores, e se possível, gostaria de exemplos.
Pretendo adquirir seu módulo ainda hoje.
Hi Arley:
I been develop an app pretty cool, of course using your Push Client module. Currently I deploy the app on Android device and every push send is received I mean, everything is cool. But if the app is closed (press the back button in android device, no pressing home button ) any push send is received no more.
I would expected that push client module, start a service and keep running even if the app is close, am I wrong?
What I have to do in order to keep service push notification running in background to received push notification even if app is closed!
The push notification module is limited, to keep running in order to received push ?
Regards
Hey Arley,
Since updating to v1.6, background notifications in android have stopped working. We didn't have a chance to try iOS notifications yet and so I can't comment on that right now.
We haven't changed a thing in our code yet. Only updated to v1.6.
Here is a log:
[ link removed ]
Lines 30-83 - app finishes closing.
Line 104 - module sets a notificationId property to a value of 8.
...then nothing happens. I'm not sure the background callback is being fired.
Any ideas?
Thanks,
I'm testing it today, what do I need to do to activate it there were no instructions for android
Tudo bem Arley,
Obrigado pelo email e pelo módulo.
O seu módulo esta funcionando muito bem, mas estou precisando de uma ajuda sua.
Você colocou um exemplo do Parse no seu código e eu o estou usando para desenvolver o meu app.
Eu mando as informações para o Parse com o channel, deviceId e tudo mais e funciona perfeitamente, e o channel até aparece na dashboard de push do Parse. Eu escolho o meu channel de teste e envio push mas ele não chega.
Tudo funciona certinho menos o recebimento do push.
Você saberia me dizer que problema poderia ser isso?
Sei que o exemplo do parse não faz parte do módulo e você o colocou lá somente para nos ajudar, mas eu estou quebrando a cabeça com isso aqui e não consigo entender o porque.
Muito obrigado.
Att,
Hi,
after installing the modules in Titanium Studio I tried to start the app.js from the folder /iphone/examples on my iphone and all I get is the following error.
Can You help me?
Best regards,
Ralf
[ERROR] : Script Error {
[ERROR] : backtrace = "#0 () at :0";
[ERROR] : line = 1;
[ERROR] : message = "Can't find variable: OS_ANDROID";
[ERROR] : name = ReferenceError;
[ERROR] : sourceId = 38284000;
[ERROR] : sourceURL = "file://localhost/var/mobile/Applications/D2B78A08-7C1E-40D3-B43D-15931CA006B3/PN2.app/app.js";
[ERROR] : }
Hi,
I have purchased the PushModule yesterday.
I have noticed a weird behaviour that stops me to use this module in production release.
If the Android device receives multiple notifications, only a click on the last notification opens the app. Click on all other notifications do nothing
Can you please solve this problem?
BTW: I have also posted a question "setLargeIcon and setNumber" in the marketplace. Would be nice if you can also respond on this.
Thx
Hello, i just bought your module and im trying to configure it to work with APN, but i cant see where/how to setup it with the APN keys :s
Can you send me a link of a more detailed documentation?
[]'s
Hi,
i can't understand how it works.
I bought the plugin and after installed I successfully receive the push message from google, but no notification appears.
I read this in the app.js documentation:
// Notification properties:
// "alert" (String) to text message - or "text" to Android
// "sound" (String) to sound file to play - "default" to Android default sound
// "badge" (Int) to badge count indicator
// "content-available" (Int) to iOS background notification
// -->> Requires set remote-notification UIBackgroundModes in tiapp.xml
// "notificationId" (Int) to Android notification identification
// "title" (String) to override Android notification title - default app name
// "ticker" (String) to override Android ticker message - default alert message
// "vibrate" (Boolean) to use default Android device vibration
// "lights" (Boolean) to use default Android device lights
// "smallIcon" (String) set small icon to Android notification from assets
// "largeIcon" (String) set large icon to Android notification from local file or url
// "category" (String) to iOS 8 interactive notification
// "ledARGB" (Color) to change default Android device light color
// "ledOnMS" (Int) to change default Android device light blink on time
// "ledOffMS" (Int) to change default Android device light blink off time
But where i have to set this variables ?
Can you provide a full example with notifications ?
Thank you,
Francesco.
Hello. I am sorry if my english is not right, i am from spain...
Maybe you could send me an example of ios and android configuration?? In the example into the module i think is only for android...
Thanks a lot.
I assume you have a sample implementation? Can you email your like app.js sample file so I can compare your API with what I have to see if this is worth pursuing?
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. :&
Hi, I have a little issue with the module, when I try to unregister I get an error and the application crashes, I'm working in android this is my code
``
if (Ti.App.Properties.getString(REG_ID_PROP_KEY, "") === "")
PushClient.registerPush(registerOptions);
else {
Ti.API.info("unregister GSM");
PushClient.unregisterPush(); // here is the error!
//PushClient.registerPush(registerOptions);
}
Issue #2
I commented the code where the device is registered again, I have a server call in SUCCESS callback, I have a button, when that button is tapped it should unregister and register, in SUCCESS callback it should notify to server the new token, but If I tap the button 2 or more times, the SUCCESS callback executes multiple times and do multiple server calls.
This is my complete function:
function ManagePushNotifications(userObj) {
var PushClient = require('br.com.arlsoft.pushclient');
var registerOptions = {
GCMSenderId: 'XXXXXXXXX',
APNTypes: [PushClient.NOTIFICATION_TYPE_BADGE, PushClient.NOTIFICATION_TYPE_ALERT, PushClient.NOTIFICATION_TYPE_SOUND]
};
var eventSuccess = function(event) {
Ti.API.info('eventSuccess:' + JSON.stringify(event));
if (!event) {
Ti.API.error('Error subscribing to Push Notificacions');
// Should never happen...
return;
}
//Save reg_id in device preferences
Ti.App.Properties.setString(REG_ID_PROP_KEY, event.registrationId);
userObj.GCM_RegID = event.registrationId;
sendGCMRegistrationID(userObj);
};
var eventError = function(event) {
Ti.API.info('eventError:' + JSON.stringify(event));
if (!event) {
alert('Error:\n\nInvalid error');
// Should never happen...
return;
}
switch (event.code) {
case PushClient.ERROR_SENDER_ID:
alert('Error:\n\nUndefined GCMSenderId');
// Only for Google Cloud Messaging (Android)
break;
case PushClient.ERROR_PLAY_SERVICES:
alert('Error:\n\nGoogle Play Services not available\n\n' + event.error);
// Only for Google Cloud Messaging (Android)
break;
case PushClient.ERROR_NOT_SUPPORTED:
alert('Error:\n\nNot supported error\n\n' + event.error);
// Possible error messages for iOS:
// - "Unable to run with iOS Simulator"
// - "Unable to run with iOS in DEBUG mode"
// - "Unable to run with iOS DEV profile due to Titanium Mobile issue
// #17030"
// Possible error messages for Android:
// - "This device is not supported"
break;
case PushClient.ERROR_REGISTER:
alert('Error:\n\nUnable to register this device\n\n' + event.error);
break;
case PushClient.ERROR_UNREGISTER:
alert('Error:\n\nUnable to unregister this device\n\n' + event.error);
break;
default:
alert('Error:\n\nUnknown error\n\n' + JSON.stringify(event));
// Should never happen...
}
};
var eventCallback = function(event) {
Ti.API.info('eventCallback:' + JSON.stringify(event));
if (!event) {
alert('Callback:\n\nInvalid callback');
// Should never happen...
} else if (event.mode == PushClient.MODE_FOREGROUND) {
alert('Callback in Foreground:\n\n' + JSON.stringify(event.data));
// Push data received with app in foreground
} else if (event.mode == PushClient.MODE_CLICK) {
alert('Callback from Click:\n\n' + JSON.stringify(event.data));
// Push data received when user clicks in notification message
} else if (event.mode == PushClient.MODE_BACKGROUND) {
// Requires set remote-notification UIBackgroundModes in tiapp.xml
PushClient.endBackgroundHandler(event.data.handlerId);
// Put the application back to sleep before any UI interations
alert('Callback from Silent:\n\n' + JSON.stringify(event.data));
// Push data received with app in background
} else if (event.mode == PushClient.MODE_ACTION) {
alert('Callback from Action:\n\n' + event.category + '\n' + event.identifier + '\n\n' + JSON.stringify(event.data));
// Push data received when user choose an action from notification message
} else {
alert('Callback:\n\n' + JSON.stringify(event.data));
// Should never happen...
}
};
PushClient.addEventListener(PushClient.EVENT_SUCCESS, eventSuccess);
PushClient.addEventListener(PushClient.EVENT_ERROR, eventError);
PushClient.addEventListener(PushClient.EVENT_CALLBACK, eventCallback);
Ti.API.info("GCM Reg ID " + Ti.App.Properties.getString(REG_ID_PROP_KEY, ""));
if (Ti.App.Properties.getString(REG_ID_PROP_KEY, "") === "")
PushClient.registerPush(registerOptions);
else {
Ti.API.info("unregister GSM");
PushClient.unregisterPush(registerOptions);
//PushClient.registerPush(registerOptions);
}
}
Hi Guys,
I am really interested in your Push Client package.
Can you tell me how we get the value for
GCMSenderId : 'put-your-google-cloud-messaging-sender-id-here'
How do we configure this for iOS?
Do you have sample code for an iOS App ?
Cheers
Hi.
This in only Works for iOS?
Hi!
My goal is to develop a light-chat using your “push module”; actually I’m new using titanium studio.
I will appreciate if you have any suggest.
Kind regards.
Hi there
I've been tasked with developing an Appcelerator app, with notification capabilities - and it loos like your PushClient module will do the trick.
I just see that all documentation talks about subscribing to a channel, and then, on the broadcast side, sending notifications to everyone.
So - is PushClient capable of being in a system with potentially many channels, and having many clients receiving from one or more of those channels?
if so - I'm going to start pestering my people here to buy PushClient.
Any information much appreciated!
Thanks
I posed about this on the "Push Client" Answers section. I am also sending it in an email as I really need a quick response.
I have two apps running this module that work great on iOS, but both fail to work on android. With both apps I get the following in my Console before the tablet gives me an “unfortunately, this application has stopped”
[WARN] : dalvikvm: threadid=16: thread exiting with uncaught exception (group=0x417e2ce0)
[ERROR] : TiApplication: (AsyncTask #1) [1813,1813] Sending event: exception on thread: AsyncTask #1 msg:java.lang.RuntimeException: An error occured while executing doInBackground(); Titanium 3.4.1,2014/11/13 13:33,5982e8f
[ERROR] :TiApplication: java.lang.RuntimeException: An error occured while executing doInBackground()
[ERROR] : TiApplication: at android.os.AsyncTask$3.done(AsyncTask.java:300)
[ERROR] : TiApplication: at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
[ERROR] : TiApplication: at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
[ERROR] : TiApplication: at java.util.concurrent.FutureTask.run(FutureTask.java:242)
[ERROR] : TiApplication: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231) [ERROR] : TiApplication: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
[ERROR] : TiApplication: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
[ERROR] : TiApplication: at java.lang.Thread.run(Thread.java:841)
[ERROR] : TiApplication: Caused by: java.lang.NullPointerException
[ERROR] : TiApplication: at android.app.PendingIntent.getBroadcastAsUser(PendingIntent.java:478)
[ERROR] : TiApplication: at android.app.PendingIntent.getBroadcast(PendingIntent.java:467)
[ERROR] : TiApplication: at com.google.android.gms.gcm.GoogleCloudMessaging.d(Unknown Source)
[ERROR] : TiApplication: at com.google.android.gms.gcm.GoogleCloudMessaging.dn(Unknown Source)
[ERROR] : TiApplication: at com.google.android.gms.gcm.GoogleCloudMessaging.unregister(Unknown Source)
[ERROR] : TiApplication: at br.com.arlsoft.pushclient.PushClientModule$2.doInBackground(PushClientModule.
I am sorry the errors got cut off, But this is most of them. I will send you an email tomorrow when I have access to the rest. If you have any hints as to what the problem is, please let me know.
Hello,
i bought your module to use it with parse.com.
Sorry but I was not able to configure a simple solution with the provided example.
In the resource folder I have the app.js
and apse the parse folder with the 3 files.
alloy.js parse.js and config.json.
I entered the parse.com credentials to the config.json.
But these files does seem not to be required by app.js.
Please help me with a working example.
I would pay extra for it.
Best regards,
The module seem to work quite well for me in conjunction with Parse, but how do I set the badge number on iOS and Android? It will increment the badge, but I can't seem to reset it?
Thanks,
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.