[Aerogear-users] Latin Characters in Push Notification

Summers Pittman supittma at redhat.com
Wed Jul 27 10:28:19 EDT 2016


Which versions of Android, aerogear-android-push, and unified push server
are you using?



On Wed, Jul 27, 2016 at 10:20 AM, LinkZ <mcrj777 at gmail.com> wrote:

> Hi Folks,
>
> I am trying to send push notifications using following code...
>
> *curl:*
> "curl -u "XXXXXXXXXXXX" -v -H "Accept: application/json" -H "Content-type:
> application/json;charset=UTF-8" -X POST -d '{"alias" : ["12345678912"],
> "ttl" : 3600, "message": { "alert":"Do it faça.", "sound":"default",
> "badge":0, "idNotificacao":1}}' pushserver.pt/rest/sender
>
> *My Handler:*
> ...
> public class NotificationBarMessageHandler implements MessageHandler {
>     public static final int NOTIFICATION_ID = 1;
>     private Context context;
>
>     public static final NotificationBarMessageHandler instance = new
> NotificationBarMessageHandler();
>
>     public NotificationBarMessageHandler() {
>     }
>
>     @Override
>     public void onMessage(Context context, Bundle bundle) {
>         this.context = context;
>         //Here I get the message without latin character.
>         //message = "Do it faa".
>         String message = bundle.getString(UnifiedPushMessage.ALERT_KEY);
>         NFPApplication application = (NFPApplication)
> context.getApplicationContext();
>         application.addMessage(message);
>         notify(bundle);
>     }
> ...
> }
>
> *AndroidManifest*:
> ...
> <receiver
>
>
> android:name="org.jboss.aerogear.android.unifiedpush.gcm.AeroGearGCMMessageReceiver"
>     android:permission="com.google.android.c2dm.permission.SEND">
>     <intent-filter>
>         <action android:name="com.google.android.c2dm.intent.RECEIVE" />
>         <action android:name="com.google.android.c2dm.intent.REGISTRATION"
> />
>         <category android:name="br.empresa.cliente.projeto" />
>     </intent-filter>
>     <meta-data
>         android:name="DEFAULT_MESSAGE_HANDLER_KEY"
>
>
> android:value="br.empresa.cliente.projeto.handler.NotificationBarMessageHandler"
> />
> </receiver>
> ...
>
> *VMOptions*:
> ...
> -Dfile.encoding=UTF-8
> ...
>
> When the message is in English, latin charset, everything works. However,
> when I try other languages or the character ç, they are deleted from the
> string.
>
> Note: When I test the iPhone everything works fine, but when I test on
> Android have this problem to the same message.
> It's encoded in utf-8, my database is MySQL deployed on a Linux server.
>
>
> Thanks in advance.
>
>
>
> --
> View this message in context:
> http://aerogear-users.1116366.n5.nabble.com/Latin-Characters-in-Push-Notification-tp767.html
> Sent from the aerogear-users mailing list archive at Nabble.com.
>
> _______________________________________________
> Aerogear-users mailing list
> Aerogear-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/aerogear-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/aerogear-users/attachments/20160727/fee6cc0e/attachment.html 


More information about the Aerogear-users mailing list