Skip to content

Instantly share code, notes, and snippets.

@jbasinger
Created July 2, 2015 19:21
Show Gist options
  • Select an option

  • Save jbasinger/483304bd342fa07f6b43 to your computer and use it in GitHub Desktop.

Select an option

Save jbasinger/483304bd342fa07f6b43 to your computer and use it in GitHub Desktop.
Ionic Push Notification Post Gists
ionic plugin add https://github.com/phonegap-build/PushPlugin.git
ionic add ngCordova
ionic add ionic-service-core
ionic add ionic-service-push
angular.module('yourTotallyAwesomeApp')
.config(['$ionicAppProvider', function($ionicAppProvider) {
$ionicAppProvider.identify({
app_id: 'ionic_app_ID',
api_key: 'ionic_public_key',
gcm_id: 'google_project_number'
});
}]);
{
"tokens":[
"b284a6f7545368d2d3f753263e3e2f2b7795be5263ed7c95017f628730edeaad",
"d609f7cba82fdd0a568d5ada649cddc5ebb65f08e7fc72599d8d47390bfc0f20"
],
"notification":{
"alert":"Hello World!",
"android":{
"collapseKey":"foo",
"delayWhileIdle":true,
"timeToLive":300,
"payload":{
"$state": "a_ui-router_state",
"key1":"value",
"key2":"value"
}
}
}
}
angular.module('yourTotallyAwesomeApp', [
'ionic',
'ngCordova',
'ionic.service.core',
'ionic.service.push'
]);
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<script src="lib/ngCordova/dist/ng-cordova.js"></script>
<script src="lib/ionic-service-core/ionic-core.js"></script>
<script src="lib/ionic-service-push/ionic-push.js"></script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment