Android Question Is it Ok to use Phone.GetSettings("android_id")


Active Member
Licensed User
Hi all.

Is it safe to use a code like this to get unique phone id? It works on my Android 10 phone today. But what about tomorrow? Or Advertising ID is a only safe way?

Sub GenerateID() As String
        Dim P As Phone
        Dim IDAndroid As String=P.GetSettings("android_id")
        Log("IDAndroid=" & IDAndroid)
        Return IDAndroid
        Log("GenerateID " & LastException)      
        Return "Error"
    End Try
End Sub


Well-Known Member
Licensed User
Erel suggests to use the advertising ID or generate a random number when the app starts for the first time:



Active Member
Licensed User
It can actually be useful in some cases. Read more here:
(I wasn't aware to this in the past)

It is not a device / global id but it can be used in your app and it isn't reset when the app is uninstalled and later installed again.
Thank you, Erel.

So if the user just updates his app with new version (let say developer has made a few changes) via Google Play AdvertisingID won't change? Am I correct?