I am using Pushwoosh + ionic1 to do the push, I would like to use their API to do individual push, so I need to save the device token in my database. I can get the device token, however, I don’t know how to save it into localstarge. Or how can I call to get the device token in other controller with local storage enable ? The code is as below :

In APP.js

function onPushwooshInitialized(pushNotification) {

//if you need push token at a later time you can always get it from Pushwoosh plugin pushNotification.getPushToken( function(token) { console.info('push token: ' + token); $localStorage.pushwooshHWID = token; // it can’t save to localStorage as local storage is not defined here.


); }

function initPushwoosh() { var pushNotification = cordova.require("pushwoosh-cordova-plugin.PushNotification");

pushNotification.registerDevice( function(status) { alert("registered with token: " + status.pushToken); // I can register and get the token onPushwooshInitialized(pushNotification);


angular.module('App', ['ionic', 'ngStorage','ngCordova','ngCordovaOauth' ,'starter.controllers','ngSanitize', 'srfSocialSharing','ui.router','btford.socket-io'])

.run(function($ionicPlatform) { $ionicPlatform.ready(function() { initPushwoosh(); }); })

Many thanks for the help !

asked 30 Dec '16, 05:08
eheading's gravatar image


Hello !

Actually, you need to create your own method that will grab a token from local storage and save it in your database. Because Pushwoosh SDK doesn't have such functionality. Below you can find a basic sample of interaction with getPushToken and local storage:

$localstorage.set('pushwooshToken', token);
sendTokenToYourServer(); //you should grab a token from local storage in this method

Please let me know if you require any further assistance here!

Regards, Alex.

permanent link
answered 30 Dec '16, 11:33
Alex's gravatar image


Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 30 Dec '16, 05:08

question was seen: 792 times

last updated: 30 Dec '16, 11:33