title: Ionic push not working - user not registered
body: <p>I just had my first contacts with the ionic framework. I've worked with Phonegap and AngularJS before however, so it was not all that new to me.
  I found out that there is this new feature to use Google Cloud Messaging push notifications in Ionic, through the Ionic Push feature (<a href="http://blog.ionic.io/announcing-ionic-push-alpha/" rel="nofollow">http://blog.ionic.io/announcing-ionic-push-alpha/</a>).</p>
  
  <p>Related lines of code from <code>app.js</code></p>
  
  <pre><code>angular.module('starter', ['ionic','ionic.service.core', 'starter.controllers', 'starter.services'])
  
  .run(function($ionicPlatform) {
    $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
      if (window.cordova &amp;&amp; window.cordova.plugins &amp;&amp; window.cordova.plugins.Keyboard) {
        cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        cordova.plugins.Keyboard.disableScroll(true);
  
      }
      if (window.StatusBar) {
        // org.apache.cordova.statusbar required
        StatusBar.styleLightContent();
      }
  
      // enable push notifications
      Ionic.io(); 
  
      // enable users (http://docs.ionic.io/docs/user-quick-start)
      // this will give you a fresh user or the previously saved 'current user'
      var user = Ionic.User.current();
  
      // if the user doesn't have an id, you'll need to give it one.
      if (!user.id) {
        user.id = Ionic.User.anonymousId();
        // user.id = 'your-custom-user-id';
      }
      console.log('user-id:' + user.id);
  
      //persist the user
      user.save();
  
      var push = new Ionic.Push({
        "debug": true,
        "onNotification": function(notification) {
          var payload = notification.payload;
          console.log(notification, payload);
        },
        "onRegister": function(data) {
          console.log(data.token);
        }
      });
  
      push.register(function(token) {
        console.log("Device token:",token.token);
      });
      push.addTokenToUser(user);
      console.log('token added to user');
  
    });
  })
  </code></pre>
  
  <p>Log from <code>ionic serve</code></p>
  
  <pre><code>ionic $ 0     361081   log      Ionic Core:, init
  1     361083   log      Ionic Core:, searching for cordova.js
  2     361085   log      Ionic Core:, attempting to mock plugins
  3     361155   log      user-id:1cc3d21c-b687-4988-b944-ad07b1a677c8
  4     361158   log      Ionic Push:, a token must be registered before you can add it to a user.
  5     361159   log      Ionic Push:, token is not a valid Android or iOS registration id. Cannot save to user.
  6     361159   log      token added to user
  7     361160   log      Ionic Push:, register
  8     361160   error    ReferenceError: PushNotification is not defined, http://localhost:8100/lib/ionic-platform-web-client/dist/ionic.io.bundle.min.js, Line: 2
  9     361526   log      Ionic User:, saved user
  </code></pre>
  
  <p>Any input is welcome, I am also more than happy to provide more information if needed.</p>
  
  <p>EDIT 10/05/2015:</p>
  
  <ul>
  <li>found out that <code>dev_push = false</code> only works on physical devices, not in browser</li>
  <li>I tried to add token to user before even registering the user</li>
  </ul>