aditmer / NightscoutHybridMobile

A cross platform mobile app that shows your Nightscout website in a WebView.
5 stars 3 forks source link

Re-register with iOS APNs during launch #38

Closed srmoss closed 7 years ago

srmoss commented 7 years ago

@sobrecht found that during app upgrade, APNs disposes of her device token and therefore notifications are no longer delivered.

According to this stackoverflow, and this Apple doc, we should probably be re-registering every time the app launches.

To accommodate this, we should:

  1. Register with APNs during app launch
  2. Compare the device token with the InstallationID
  3. If different, un-register with the old InstallationID (if not null)
  4. And re-register with the new InstallationID

This will ensure the disposed device token is also no longer in ANH/NS.

aditmer commented 7 years ago

I think I have this resolved. We should test with server logging before I push a new build.