Android Question DeviceID - same function same phone 2 apps - 2 IDs - help...

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
hi

i have this code that i use to get the device id
B4X:
Sub GetDeviceID() As String
    Dim DeviceID As String=""
    Dim p As Phone
  
    Try
      
        DeviceID = P.GetSettings("android_id").ToUpperCase
      
        Log($"DeviceID: ${DeviceID}"$)
  
    Catch
      
        Log(LastException)
        DeviceID = ""
      
    End Try
  
    Return DeviceID
  
End Sub

i have 2 apps on the same phone
the id's i get are different in each app
it was ok until (i think) i had to change signature key in one app
how do i make sure to get the same id on both apps?
it is critical

i can't change now the mechanism or the id form the first app as it is active with users
so i need to make sure on the new app to get the same id, or a replacement that will be used such as phone number or anything else

i use the device id to share data between the apps on my server so if they're no match it wont work

it did work and as said when changed the signature key it changed
now even if i try to use the old key the id is different

tested on android 13
sdk 31
i think on previous versions like 9 it did work (but it worked like charm on android 13 until the key change)
please help...
thanks
 

Num3

Active Member
Licensed User
Longtime User
Due to legal restrictions and for privacy reasons, on more recent android devices the computed device ID will always be diferent from phone to phone, and also everytime you change the app key, delete & reinstall the app or reset the device.
For the purpose you want, you must develop your own solution.
 
Upvote 0

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
Due to legal restrictions and for privacy reasons, on more recent android devices the computed device ID will always be diferent from phone to phone, and also everytime you change the app key, delete & reinstall the app or reset the device.
For the purpose you want, you must develop your own solution.
Thanks
Are you saying that on same phone, 2 apps will get different device ID?
I removed and reinstalled many times, the ID is still different and it is the same as it was before removing the app.

Is there anything I can have to identify the device and to be identical on both apps

Or alternatively to share a file between them (tried that and failed as I couldn't use the same file from both apps)
Any idea?
 
Upvote 0
Top