marcick Well-Known Member Licensed User Longtime User Feb 9, 2016 #1 I need to identify the devices where the app is installed, to enable/disable some functions basing on a licence structure (the app communicate to my server the device_id and get back a licence level). In B4A it was easy reading the IMEI, here I have learned that the IMEI is not readable, so I found on this forum this method to get a "unique" device_id. Code: Copy Dim no As NativeObject no =no.Initialize("UIDevice").RunMethod("currentDevice", Null) log(no.GetField("identifierForVendor").AsString) What I see is that uninstalling the app, rebooting the phone and reinstalling it, that code change ! Is that possible or for sure I have a bug somewhere in my code ?
I need to identify the devices where the app is installed, to enable/disable some functions basing on a licence structure (the app communicate to my server the device_id and get back a licence level). In B4A it was easy reading the IMEI, here I have learned that the IMEI is not readable, so I found on this forum this method to get a "unique" device_id. Code: Copy Dim no As NativeObject no =no.Initialize("UIDevice").RunMethod("currentDevice", Null) log(no.GetField("identifierForVendor").AsString) What I see is that uninstalling the app, rebooting the phone and reinstalling it, that code change ! Is that possible or for sure I have a bug somewhere in my code ?
Erel B4X founder Staff member Licensed User Longtime User Feb 9, 2016 #2 marcick said: In B4A it was easy reading the IMEI Click to expand... Note that it becomes harder and harder with each version of Android. In Android 6 it is no longer possible to read the IMEI. marcick said: What I see is that uninstalling the app, rebooting the phone and reinstalling it, that code change ! Click to expand... This is the expected behavior. Once all apps from the same vendor are uninstalled the id is reset. You can store a random string in KeyChain. It will be preserved. Upvote 0
marcick said: In B4A it was easy reading the IMEI Click to expand... Note that it becomes harder and harder with each version of Android. In Android 6 it is no longer possible to read the IMEI. marcick said: What I see is that uninstalling the app, rebooting the phone and reinstalling it, that code change ! Click to expand... This is the expected behavior. Once all apps from the same vendor are uninstalled the id is reset. You can store a random string in KeyChain. It will be preserved.
marcick Well-Known Member Licensed User Longtime User Feb 9, 2016 #3 Thanks Erel, I'll do like this, or accept that in case of uninstall/reinstall the licence need to be activated again. If the app isn't uninstalled/reinstalled but just get and update from AppStore the id is not changed, true ? Upvote 0
Thanks Erel, I'll do like this, or accept that in case of uninstall/reinstall the licence need to be activated again. If the app isn't uninstalled/reinstalled but just get and update from AppStore the id is not changed, true ?
tufanv Expert Licensed User Longtime User Feb 9, 2016 #4 marcick said: Thanks Erel, I'll do like this, or accept that in case of uninstall/reinstall the licence need to be activated again. If the app isn't uninstalled/reinstalled but just get and update from AppStore the id is not changed, true ? Click to expand... I needed stg like this and i solved it as Erel said with keychain. With every app run you can check if keychain has a key of "deviceid" . If exists then you can retrieve the device id and device id will never change . If no key , it means that the app is being run for the first time. You can assign a random value between 1000000 and 9999999 and assign to device and put into keychain. If you even unistall the app , the key will remain at keychain. This is a perfect solution. Upvote 0
marcick said: Thanks Erel, I'll do like this, or accept that in case of uninstall/reinstall the licence need to be activated again. If the app isn't uninstalled/reinstalled but just get and update from AppStore the id is not changed, true ? Click to expand... I needed stg like this and i solved it as Erel said with keychain. With every app run you can check if keychain has a key of "deviceid" . If exists then you can retrieve the device id and device id will never change . If no key , it means that the app is being run for the first time. You can assign a random value between 1000000 and 9999999 and assign to device and put into keychain. If you even unistall the app , the key will remain at keychain. This is a perfect solution.
marcick Well-Known Member Licensed User Longtime User Feb 9, 2016 #5 Thanks Tufanv. Which would be the equivalent of Keychain for Android ? Because my solution is IMEI based I need to change something there also, before some user try my app on 6.0. Upvote 0
Thanks Tufanv. Which would be the equivalent of Keychain for Android ? Because my solution is IMEI based I need to change something there also, before some user try my app on 6.0.
tufanv Expert Licensed User Longtime User Feb 9, 2016 #6 I dont know if there is a solution in android because when you uninstall at andorid it removes everything. I use imei for android and keychain for ios marcick said: Thanks Tufanv. Which would be the equivalent of Keychain for Android ? Because my solution is IMEI based I need to change something there also, before some user try my app on 6.0. Click to expand... Upvote 0
I dont know if there is a solution in android because when you uninstall at andorid it removes everything. I use imei for android and keychain for ios marcick said: Thanks Tufanv. Which would be the equivalent of Keychain for Android ? Because my solution is IMEI based I need to change something there also, before some user try my app on 6.0. Click to expand...
marcick Well-Known Member Licensed User Longtime User Feb 9, 2016 #7 I'll open a new thread later in B4A section. Thanks. Upvote 0
marcick Well-Known Member Licensed User Longtime User Feb 9, 2016 #8 btw, I'm asking if the reason they don't like we get access to a unique device identifier is because with that code we can publish a free app and then manage a way to ask money to the user (as I have intention to do). Again, I wonder if when we submit the app to the store they could have a deep look to the code and discover this. Upvote 0
btw, I'm asking if the reason they don't like we get access to a unique device identifier is because with that code we can publish a free app and then manage a way to ask money to the user (as I have intention to do). Again, I wonder if when we submit the app to the store they could have a deep look to the code and discover this.
tufanv Expert Licensed User Longtime User Feb 9, 2016 #9 No , I am already using it. I dont think they will look deep Upvote 0