Sending push notification with segmentation

Not sure I’m doing it correctly or not, I put an ajax call in ionic.run to save the device token once it’s registered to my db. like this

push.register(function(token) {

  $http({
    method: 'POST',
    url: config.hostname + '/api/token/save',
    skipAuthorization: true,
    headers: {
      'owner': config.owner
      },
      data: {token:token}
  }).then(function successCallback(response) {
      console.log("response:",response);
  })
  push.saveToken(token);  // persist the token in the Ionic Platform
});

Then in my dashboard I will use those saved token and send to ionic.io, but I have one doubt. How to avoid sending those device token which has already inactive. Like u have 1000 download and got 1000 device token, but the active user is only around 100, u wouldn’t want send 1000 right?