I´m facing a problem on handling the register-unregister my activities/services or whatever I use from an aerogear installation.
If I register from a service onCreate() and unregister in onDestroy(), when I uninstall the application, the device keeps registered on server side... If I install the application again, it registers the device again and you can repeat this until you get tired. And, of course, sending a push to the alias given by the user, the messages will arrive once per registration.
Also, each time the application registers to aerogear, the deviceToken is different, meaning that it´s got more to do with a generated hash for each installation than for a unique identifier for the pair (app, device).
So, now the question, how to handle the whole cycle? and I mean, the daily run and the issue about if the user decides to uninstall the app, it gets killed and could not unregister and one month later decides he liked it so much that ends up reinstalling the thing again. thx.
update
The problem grows as I go testing my application. If I log with two different users in the same device, then I get both user messages and I've got to twist a little bit more the client implementation.
update with aerogear database data
here´s the installation log for two devices with three reinstalls:
id alias deviceToken deviceType enabled operatingSystem osVersion platform variantID
0dd99505-bba9-45e9-bfbf-38621bd41c3d 568b347a5df69915000pig@gmail.com APA91bG9XSPpwbFenw0UETFLRxr2XoFw-HlH5yZpPgoCIVZLnv0QSqCx5iKqqhJ-tWF5CRISbydv6ItWZKxklD8OPtfxvuq1ekQEI3XkbFajsmGIJ3yjUIC0MGw3v2ITVd6byVtZLsI9uTfiDXyeNrXTxprzVxr9ng ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
0ee3619f-0eb4-4139-b1fa-fe3403eb380c 1c24c6e05b58738f000edu@gmail.com APA91bFrNknt7d57dFR5DagE4Nf1bCVyB93Jl1xU5_qELwYn5JmjYUpXrLE10yC6beZdUgae0ZgtKXgLI4LI-E_ROAFEI4xi-ZPhuE8UZB6K05L_mIWSk7kt32D7S9G2clw3WG51zvcQmaeg8xsG_VW-rnwfKZQVcg ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
107d4dac-fbcf-4f82-9135-702b83d06f7f 568b347a5df69915000pig@gmail.com APA91bEaN4AMJPZgML931rO4AdrMudfTmGVmYPqqARVLX1RxIfyYB46fGxlSK0w7g3qnU2d_cVOBi907TFIMoxBaOe3bvKI8DqsacrXMmT-DjhFoFRS2z4QCec9u0aRPm-EB9UwhfMrE3RrctdxDdNCQ0douuppYVQ ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
161474b6-067d-4b54-a750-e21a9896814e 1c24c6e05b58738f000edu@gmail.com APA91bGFE6cxLcxPDoRmv-HEIpA2jQndccrCryuR3q5BN4PG3EyHxISFoMCIwaPPXX8BIinrJOvNCbwpIrVOKw_mSv5TcLZnSgonR1grpiRkJ0mmwbFCme2CrwoMpkLkVUP7ZjwnYsr0HR3MKzmJLakrnlN-eMKr-g ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
a5cddabe-1c00-4369-b4cc-f6c5da8f8740 568b347a5df69915000pig@gmail.com APA91bGmFT7NCpfb1q4WHFK2wmQCQdMtW9ulQLiZYwrt9oyU4mqv9gCBN959pCw_wKy2zHw-JBU0p5SCzdpKN5l8i7uqPWk24ORHKE1Vf6rRUINkIRJheKVT6V6Wk38WQ7Rw1AgrqYXZN7WUImVSgd5cqq_p8lLISg ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc
f7514716-68d9-4d00-837a-f1f9da503151 1c24c6e05b58738f000edu@gmail.com APA91bHTFJE7-nz_KB4aa2RUcEnFTVB0IzQZ-ZffPTujLWgi60xTMUeAet6YoUZJnXKnhBOSdAPgoaLDW18PWnwKXtc2MXxKjMYQQENNDdOxKQIV4fnMrAFWfwD_VT6x5XOJUWdQovGUwXiMX9SshCDvZJ4QnM1x_w ANDROID 1 android 4.4.4 android 4ae83272-5db7-41f6-879d-c907a39bd3fc