[Aerogear-users] Latin Characters in Push Notification

LinkZ mcrj777 at gmail.com
Wed Jul 27 10:20:13 EDT 2016


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.



More information about the Aerogear-users mailing list