Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49185

$ionicPush.register() not returning token

$
0
0

@ladragoon wrote:

I'm really hoping someone can help me, this has been driving me nuts. I'm trying to migrate my existing Ionic 1 project over to utilize the new Ionic Cloud Push functionality. I've followed the instructions very carefully, multiple times, but can't get the push notifications to work. The docs are not clear - is a user required to authenticate using Ionic Cloud User Authentication for Push Notifications to work?

Here is my current set up. Please let me know if you would like me to paste in additional code or clarify any particulars as to my set up.

  1. I created an Ionic Cloud services account and logged in. I then followed all the steps on the http://docs.ionic.io/setup.html page. I've never had any problem using Promises so I skipped the bluebird step.

  2. I then created an app id using "ionic io init".

  3. Added "ionic.cloud" to my app.js
    Here's the pertinent section of my config:
    .config(['$ionicCloudProvider',function($ionicCloudProvider){
    $ionicCloudProvider.init({
    "core": {
    "app_id": "MY APP ID"
    },
    "push": {
    "sender_id": "MY PERSONAL SENDERID",
    "pluginConfig": {
    "ios":{
    "badge": true,
    "sound": true
    },
    "android" : {
    "iconColor": "#343434"
    }
    }
    }
    });

I've checked both the app_id and sender_id several times to make sure they're correct.

  1. I followed the migration doc very carefully http://docs.ionic.io/migration.html

  2. I added the $ionicPush.register() promise to my controller:

    .controller('DashCtrl', ['$ionicPush', '$ionicPlatform', function($ionicPush, $ionicPlatform){
    $ionicPlatform.ready(function(){
    $ionicPush.register().then(function(t){
    return $ionicPush.saveToken(t);
    }).then(function(t){
    console.log("Token saved: " + t.token);
    });
    });

  3. Token never arrives. I send a push notification and it never arrives to my device when I build && run on my Android phone.

What am I doing wrong? Should I move the $ionicPush.register() promise into the .run? Is anyone else having problems? Thanks in advance!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49185

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>