I am developing an Android app where a single user can use the app only in one device by using the same Gmail account(for sign-in) . If the user wants to sign in the app on a different device, he won't be able to do it using the same Gmail account. I am using ANDROID_ID in my application to identify a unique device using the following command--
Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);
Is it the correct option in this case, since I have seen in the developer website that
Avoid using hardware identifiers. In most use cases, you can avoid using hardware identifiers, such as
SSAID (Android ID), without limiting required functionality.
Android 10 (API level 29) adds restrictions for non-resettable dentifiers, which include both
IMEI and serial number. Your app must be a device or profile owner app, have
special carrier permissions, or have the READ_PRIVILEGED_PHONE_STATE privileged permission
in order to access these identifiers.
Link for the doc-
https://developer.android.com/training/articles/user-data-ids
Or is there any other way for doing the above? Thanks in advance.
you can define your own rule to generate a unqiue id,then save it on sp. every time you should check,get it and compare with the data that service provide.
or you can also use advicement ID to as unqiue device id.