We could use primary key (indexed out of the box) as an ID that we can sort on, we just need to make sure findAllDeviceTokenForVariantIDByCriteria does not return duplicates, i.e. we need to make sure that there can't be more than one deviceToken stored for given variantID (I believe that's what we have now, just checking).
Btw on related note, we should make sure that one device is not registered in more than one variant for given app, since then the user would get the message twice as well (but that's something we should probably leave up to app developer?)
|