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

Dont recive push notifications

$
0
0

@PterPmnta wrote:

Hi, I 'm trying to get notifications on a test application to find out first as implimentarlo and then apply it to my application that is almost over .

I followed these steps

http://docs.ionic.io/services/push/

This is my code

<!DOCTYPE html>
<html>

<head>
     <meta charset="utf-8">
       <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
       <title>Probando notificaciones</title>

      <link href="lib/ionic/css/ionic.css" rel="stylesheet">
      <link href="css/style.css" rel="stylesheet">

<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->

<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ionic.cloud.min.js"></script>

<!-- cordova script (this will be a 404 during development) -->
<script src="cordova.js"></script>

<!-- your app's js -->
<script src="js/app.js"></script>
 </head>

 <body ng-app="starter">

<ion-pane>
    <ion-header-bar class="bar-stable">
        <h1 class="title">Ionic Blank Starter</h1>
    </ion-header-bar>
    <ion-content>
        <div class="list list-inset" ng-controller="pushCtrl">
            <button class="button button-block button-assertive" ng-click="mostrar()">Mostrar</button>
        </div>

    </ion-content>
</ion-pane>
</body>

 </html>

angular.module('starter', ['ionic', 'ionic.cloud'])

.run(function($ionicPlatform, $ionicPush) {
        $ionicPlatform.ready(function() {

            if (window.cordova && window.cordova.plugins.Keyboard) {

                cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
                cordova.plugins.Keyboard.disableScroll(true);
            }

            if (window.StatusBar) {
                StatusBar.styleDefault();
            }

            $ionicPush.register().then(function(t) {
                return $ionicPush.saveToken(t);
            }).then(function(t) {
                console.log('Token saved:', t.token);
            });

        });

    })
    .config(function($ionicCloudProvider) {
        $ionicCloudProvider.init({
            "core": {
                "app_id": "1fec09ac"
            },
            "push": {
                "sender_id": "1038915667657",
                "pluginConfig": {
                    "ios": {
                        "badge": true,
                        "sound": true
                    },
                    "android": {
                        "iconColor": "#343434"
                    }
                }
            }
        });
    })

.controller('pushCtrl', function($scope, $ionicPush) {

    $scope.$on('cloud:push:notification', function(data) {
        var msg = data.message;
        alert(msg.title + ': ' + msg.text);
    });

});

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49171

Trending Articles



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