View previous topic :: View next topic |
Author |
Message |
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Tue Oct 05, 2021 3:40 am Post subject: Android UUID-like |
|
|
Code: | function all_trim(s)
return s:match"^%s*(.*)":match"(.-)%s*$"
end
local fh = assert(io.popen'wmic csproduct get uuid')
result = fh:read'*a'
fh:close()
result = string.gsub(result,'UUID',"")
result = all_trim(result)
--print(result) |
Is there a way to get unique id from phone with Lua code?
Like a command similar to the code above! There were some Java examples, but I couldn't get them to work with lua.
Thanks in advance for the answers.
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
|
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Wed Oct 06, 2021 2:52 am Post subject: |
|
|
The above code still works fine. "WMIC" print(results)
How can I run this command in lua?
Code: | String unique_id = android.provider.Settings.Secure.getString(getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); |
Ref : https://developer.android.com/reference/android/provider/Settings.Secure#ANDROID_ID
I'm looking for a way to run the above code inside the lua code to get the ID on the phone for the first time (with the app that will activate a lua directory).
---------------------------------------
There are many masters with lua knowledge in CE and I know this as the most active lua forum.
---------------------------------------
|
|
Back to top |
|
|
atom0s Moderator Reputation: 198
Joined: 25 Jan 2006 Posts: 8516 Location: 127.0.0.1
|
Posted: Wed Oct 06, 2021 3:19 am Post subject: |
|
|
You can't run that specific code from CE at all. That has to be executed on the actual phone using the Java Android SDK. It's not for pulling remote info from the phone on other platforms.
ByTransient wrote: | The above code still works fine. "WMIC" print(results)
|
While it may work fine on your system, it is marked deprecated and can be disabled on various OEM systems by default. (HP, Dell, etc. have been known to have WMI disabled on their copies of Windows.)
It being deprecated as well means that it is marked for removal at a later point in time with Windows. And may be fully removed/disabled in a future update.
If you are relying on it for system information, there is a chance it will fail to poll anything.
_________________
- Retired. |
|
Back to top |
|
|
ByTransient Expert Cheater Reputation: 5
Joined: 05 Sep 2020 Posts: 240
|
Posted: Wed Oct 06, 2021 7:31 am Post subject: |
|
|
Thanks @atom0s. Your attention to detail is admirable.
What I'm trying to do is find a way to use the VIP member test code on android phone as well as on PC.
I think I can do this with the Android ID that Google Play created on the first installation.
Or it could be another unique ID that I can access with the Lua code.
|
|
Back to top |
|
|
|