Ionic Push on Android: unexpected error occured

admin

Administrator
Staff member
I'm trying to use Ionic Push notifications on android, but every time I got the following error:
Code:
Ionic Push:, (debug) unexpected error occured.
Ionic Push:, [object Object]

I'm using Genymotion as my emulator, with Google Play Services installed (<a href="https://stevenkideckel.wordpress.com/2014/12/27/how-to-install-google-play-services-on-genymotion/" rel="nofollow">https://stevenkideckel.wordpress.com/2014/12/27/how-to-install-google-play-services-on-genymotion/</a>). Testing on a real device is not working as well.

Also, I'm using this push plugin (<a href="https://github.com/phonegap/phonegap-plugin-push" rel="nofollow">https://github.com/phonegap/phonegap-plugin-push</a>), and installed like this:
Code:
ionic plugin add phonegap-plugin-push --variable SENDER_ID="my-gcm-project-number"

My push code look's like this:

<div class="snippet" data-lang="js" data-hide="false" data-console="true">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override">
Code:
var push = new Ionic.Push({
    'debug': true,

    'pluginConfig': {
        'android': {
            'senderID': 'my-project-number',
            'iconColor': '#343434'
        }
    }
});

push.register(function(token) {
    console.log('Device token:', token.token);
    push.saveToken(token);
});
</div>
</div>


I already configured my Ionic app using:
Code:
ionic config set dev_push false
ionic push --google-api-key my-google-api-key
ionic config set gcm_key &lt;my-gcm-project-number&gt;

I tried to search for similar problemas but never found a solution.

Anyone can help me?
Thanks!