An inconvenient implementation of GetDeviceId

Discussions about syncing data via Bluetooth, Dropbox, FTP, and using CSWeb
Forum rules
New release: CSPro 8.0
Post Reply
lestcape
Posts: 37
Joined: August 27th, 2016, 1:11 pm

An inconvenient implementation of GetDeviceId

Post by lestcape »

The GetDeviceID function (https://www.csprousers.org/help/CSPro/g ... ction.html) doesn't return the device id. Instead and how is described in the documentation it return an android id. So, the device ID that is received in CSWeb does not match with the device id that we can retrieve in the CSPro logic. I consider this a bad thing because we can not use the device id that we have in the server side to inform something to the interviewer because they don't have a build in and then easy way to recognize his own device id.

The are a way in the CSPro logic to get the device id as same of how we receive it in the CSWeb side? Can be added if not?

When CSPro 7.5 will be release, we can easy create reports in the server side that can be used to inform the interviewers about several important things that was occurs in his devices. The inconvenient implementation of GetDeviceId should be notice even more then.
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: An inconvenient implementation of GetDeviceId

Post by josh »

The deviceid returned by getdeviceid is the Android id. This is the same as the device id used in sync. What makes you think that they are different?
lestcape
Posts: 37
Joined: August 27th, 2016, 1:11 pm

Re: An inconvenient implementation of GetDeviceId

Post by lestcape »

I don't think they are different, instead to us they are in fact different. We create a survey column and store the result of the GetDeviceID in it. We also store the device id that send the data from CSWeb in a table when we recive the data. Then we compare both values form the same cases and we get a different result. In particular when a tablet was registered in google we are getting as GetDeviceID the google email, while we continuous having a number for the device id in CSWeb.

But worse, several tablets was registered with the same google account, so we end up having the same "device id" for different devices.

I think this thread is relevant to this discussion: https://android.stackexchange.com/quest ... -device-id
josh
Posts: 2399
Joined: May 5th, 2014, 12:49 pm
Location: Washington DC

Re: An inconvenient implementation of GetDeviceId

Post by josh »

Are you sure you are not using GetUserName() instead of GetDeviceId() in the CSPro logic? GetUserName() will return the email address but GetDeviceId() will return the Android ID. This is the implementation of GetDeviceId() on Android. As you can see, it is returning the Android ID.

Code: Select all

fun exgetdeviceid(): String {
    val activity = Messenger.getInstance().currentMessage.activity
    return Settings.Secure.getString(activity.contentResolver, Settings.Secure.ANDROID_ID).toLowerCase(Locale.ENGLISH)
}
The same code is used to get the device id used in the sync history.

You can run the attached CSPro app on an Android device to see both the device id and the username. I think you will find that the device id as reported by this app matches the device column in the sync history table in CSWeb.
Attachments
devid.zip
(2.78 KiB) Downloaded 166 times
lestcape
Posts: 37
Joined: August 27th, 2016, 1:11 pm

Re: An inconvenient implementation of GetDeviceId

Post by lestcape »

Thanks. I think you are right. I suspect that some of my clients have an older version that used GetUserName() instead of GetDeviceId(), while most of them have the GetDeviceId(). I'm trying to localize a tablet code to be sure this is what occurs, but most of signals point to that.

Sorry for the noise then, because this is an apparently failure on update the devices on our side. We change the function in the last moment without change the structure and this is why we can not notice the difference in the server of to have an updated client or not, as the dictionary in both cases is the same.
Post Reply