Find the new Install ID?

Hi -
I'm struggling to work out how to access the new Install ID string programmatically, please can someone share a simple code fragment to do this?
Thanks!
Nik

Hi @Blitheringeejit
if your question is about accessing Install ID in a form you can't do that for now. We added Install ID recently because we will be forced to get rid of Device ID so then we will use that new Install ID instead. More info: Collect will need to stop using IMEI as deviceID and making simSerial and subscriberID available

If I'm wrong and you have your own fork and need to change something the code responsible for that id is in SharedPreferencesInstallIDProvider class.

Hi @Grzesiek2010: thanks for your quick response.
I am working with my own fork, and intend to add the Install ID to the querystring in the form list request. My fork works with my own custom server, and has historically used the DeviceID/IMEI (or wifi MAC address for non-IMEI devices) to identify the user in the querystring, so as to offer a form list customised for each user: see this post in the thread you mentioned. In the current version of my app (forked from Collect 1.8 - I don't update it very often!) the IMEI is already inaccessible when running on Android10 devices.
I did find the SharedPreferencesInstallIDProvider, and after some hacking about managed to obtain the stored InstallID using this code:

SharedPreferences prefs = new MetaSharedPreferencesProvider(this).getMetaSharedPreferences();
        SharedPreferencesInstallIDProvider myprefs = new SharedPreferencesInstallIDProvider(prefs,KEY_INSTALL_ID);
        String InstallID = myprefs.getInstallID();

But just because it works doesn't mean it's the right way to go about it! I'm very unfamiliar with the complexities of Android, and concerned that a bad implementation by me might break in a later version of Collect - so does this look like a sensible solution?
Grateful for any advice!
Nik

It depends where you want to use it if just replace install Id and use device id instead I would do just this:
https://github.com/getodk/collect/commit/85be5f38fa2eeab97c3f995ff3958fd2d7bc00df

Generally in other classes you can access it in the same way.

Thanks @Grzesiek2010. Now that you're deprecating the old device ID altogether, it definitely makes more sense to make the change in the PropertyManager class for back-compatiblity. I now have the install ID nicely appended as a querystring in FormListDownloader.java, after obtaining it as deviceId from the PropertyManager as before.
When the Install ID idea was first discussed, this post from @LN
suggested that a device ID should always have been appended to the download list url, and it was possibly an error that this had never been implemented in the app. It's certainly potentially useful for any custom server implementation, like mine - which is why I implemented it myself.
So I'd suggest adding it to FormListDownloader.java in the main repo, as I've done in my fork.
Thanks
Nik