Testing push notification not working

I am using this command with my
own APP_ID and PRIVATE_API_KEY (secret key) from apps.ionic.io page.

curl -u PRIVATE_API_KEY: -H "Content-Type: application/json" -H "X-Ionic-Application-Id: APP_ID" https://push.ionic.io/api/v1/push -d '{"tokens":["DEVICE_TOKEN"],"notification":{"alert":"I come from planet Ion."}}'

and, when I execute the line, I get

{"result":"queued","message_id":"20c04df8343611e5b4296ec080739562"}

So, its queued…?

I have setup the push with below code in ‘TabsCtrl’(highest ctrl in my app)

// Identify your user with the Ionic User Service
	var user = $ionicUser.get();
    if(!user.user_id) {
      user.user_id = $scope.guid;
    };
    angular.extend(user, {
      name: 'evangelion',
    });
    $ionicUser.identify(user).then(function(){
      $scope.identified = true;
      //alert('Identified user ' + user.name + '\n ID ' + user.user_id);
    });

    // Wait for device API libraries to load
    $ionicPlatform.ready(onDeviceReady);

    function onDeviceReady(){    
    	// Register with the Ionic Push service.  All parameters are optional.
	    $ionicPush.register({
	      canShowAlert: true, //Can pushes show an alert on your screen?
	      canSetBadge: true, //Can pushes update app icon badges?
	      canPlaySound: true, //Can notifications play a sound?
	      canRunActionsOnWake: true, //Can run actions outside the app,
	      onNotification: function(notification) {
	        // Handle new push notifications here
	        // console.log(notification);
	        return true;
	      }
	    });
    }

also have below code in app.js

.config(['$ionicAppProvider', function($ionicAppProvider) {
  // Identify app
  $ionicAppProvider.identify({
    // The App ID (from apps.ionic.io) for the server
    app_id: 'APP_ID',
    // The public API key all services will use for this app
    api_key: 'PUBLIC_API_KEY',
    // Set the app to use development pushes
    dev_push: true
  });
}])

.config(function($stateProvider, $urlRouterProvider) {

I don’t see push notification on my app on device.

I also did,

$ ionic push --ios-dev-cert

and got

“Successfully uploaded certificate”

what am I missing…?

1 Like

Having exact same issue.

Same problem, but when i try whit https://apps.ionic.io/app/myappid/push/tools i receive only alert in the app :frowning: