We are in the process of upgrading the android salesforce marketing cloud SDK to v5.2.0 from v4.5.0 and we noticed that each time we uninstall and reinstall the app it gives a new device ID to that particular device in 5.2.0. (Which didn't occur in 4.5.0) Is there any way that we can avoid that behavior?
There is not.
Prior to version 4.9.x the Android SDK hashed together some bits of data and ANDROID_ID in order to generate it's unique device identifier. At the time this decision was made, 2011/2012, this was considered safe and resulted in a repeatable, unique device identifier.
Since then, however, several device manufacturers and 3rd party ROM makers did not honor the requirement that ANDROID_ID be unique. This created risk that 2 or more devices could potentially produce the same device identifier in our system.
As of version 4.9.x the Android SDK will neither persist an uninstall or a device data clearing, but we can, without a doubt, guarantee that no two devices will have the same unique identifier.
Given that our audience lists are device targeted you can appreciate how imperative this is for our and your success :)