0
votes

I'm building an Ionic app, installed the phonegap push plugin and set up the ionic io push settings with a real google developer api key. I didn't set any certificates or other keys for android in the ionic framework. For IOS I didn't set anything, as the app is still in development and there isn't a Apple Developer Account yet.

Now I was very happy, as I could receive push notifications. Now I found 2 problems with the notification:

1: It's single line, so the text would be "Hey this notification is too lo...". How can I make sure this is multi line?

2: When I press the notification, it doesn't open the app. Is this because it's a debug apk?

Here is the push data I send using the ionic push api:

tokens": tokens,
"profile": profile,
"notification": {
    "title": title,
    "message": message,
    "android": {
        "icon": "ic_stat_icon",
        "icon_color": "#99004C"
    },
    "ios": {
            "badge": "1"
    }
}
1

1 Answers

1
votes

After contacting the dev team of phonegap and ionic, we managed to find the solution. It turns out that there is a bug in the Ionic push framework OR the phonegap push plugin. Which one it is I'm not sure about.

It turns out that setting the android 'icon' in the data that you push to the Ionic push framework breaks the notification. This causes the notification to not be expendable, so only single line, not opening the app when you tap the notification, no sound etc.

The solution to this is setting the icon in the init of the phonegap plugin like so:

.run(function ($ionicPlatform, $http) {
    $ionicPlatform.ready(function () {
        var push = new Ionic.Push({
            "debug": true,
            "pluginConfig": {
                "android": {
                    "icon": "ic_stat_icon"
                }
            }
        });

        push.register(function(token) {
            console.log("Device token: " + token.token);
        })
    });
})