why this extension
Since we are not able to get DeviceId, get Imei, get Meid, get SimSerialNumber, get SubscriberId and get Serial from Android 10 and higher devices,
the most practical way is to generate a random string and save it on sdcard, and retrieve the string back from the file when needed.
This is what this extension is doing.
This can be done by build-in components, but I think this extension will save time for you.
- if the file is deleted from sdcard and the app was re-installed (same time), the uuid will change.
- not working in Screen.Initialized event, use a clock in stead
- not working on Redmi k20 pro (android 10)
if you think this extension is useful to you, you may donate to here
Nice extension @Kevinkun very useful,
It’s a good idea.
I have a little doubt. It stores the file in sd card. What if user don’t have sd card in his/her device? Will it store it in device internal storage?
by sdcard, i mean external storage. nowadays, there are seldom phones with no external storage, right?
infact, this extension store uuid in internal and external both.
Anyway, it’s better to check this before storing.
For Android 10 +, where will the file be stored?
/storage/emulated/0 or ASD ?
and will this work when targeting API 30
It will be stored in /sdcard/emulated/0/. That is why WRITE_EXTERNAL_STORAGE permission needed.
It’s working on my phone Android 11.
Welcome for any feedback.
A lot of famous app using this method. Connect your phone with computer by Usb, on sdcard you will find some small - sized hidden file which name start with a dot, and inside which there is a ramdom string.
How? Did it asked permission? Did you grant permission? In companion? Or apk? Android version?
If your app targets API 30 then you can’t write in external storage/phone storage.
Thanks, I was about to come back with that one
you may read-write only Download folder
Tested by compiling on AI2 test server. No uuid file created, cannot ask for Write permission / not granted. Extension needs to save to ASD for Android 11 / target API 30.
Yes you can.
But it would be beneficial to save data in ASD instead.
Thanks @TimAi2 ,
so it’s working on my phone (android11) only for now, is because Kodular is still target api 29?
but if save data in ASD, it will be deleted after app uninstall. The best way is to save to public download folder
After reinstall not access to old files!
Thanks and noted that not working on ai2-test server.