Unique identifier for Android phone - android

I'm building Android application which needs to identify device by some unique number/string.
I've heard about ANDROID_ID but there are also reports that it can be the same on some phone models or even updates.
Another thing is that it is recreated after factory reset or system reinstall. I can live with that although I would prefer if it stayed the same.
Is there another way to identify the phone without asking for more permissions? IMEI requires them(android.permission.READ_PHONE_STATE) but it can scare away users.
How Shazam does that? I know it identifies the phone permanently (it remembers that I was a user before it introduced 5 tags a month restriction for new users) even though I completely reinstalled the system.

Why not create a GUID in a file in a well-known location and have that be your unique identifier? That way you have full control and without the need for any elevated permissions (except for file system access.)

Related

Unique identifier (when targeting Android 10, lasting after factory reset)

I have this internal android app for the phones.
The company has it's own custom management for all the devices.
Hole thing is working based on the imei , as a unique key to identify each phone.
As you know from Android 10, the imei identifier is not accessible anymore.
I have read a bunch of post and articles, but none seems to satisfy my needs, as I need an unique identifier, that lasts also after factory reset, reboot, uninstall and so on.
Please any suggestions, are welcomed.
Check first Answer here.
it's using UUID with MediaDrm.
Tested on Xiaomi Pocophone F1 with Android 10
and it survived reboot, uninstall.
I didn't test it yet over the factory reset.

how does pay-per-install work on android?

I'm thinking to have a third party to promo my app, and I'll pay them per install. In order to avoid fraud, I need to have a unique ID stored in my database. My problem here is that I can't find a reliable unique ID.
IMEI - only works on phone
Android ID - can be changed even not a rooted device
WLAN MAC - not all devices have wifi, or the device has wifi turned off.
Bluetooth MAC - same as above
I know device with root access can easily change the IDs, but let's not worry about it now. I assume no one has a rooted device. How do I get a unique ID???
Please help. Thanks
Try looking into OpenUDID for Android, there doesn't seem to be a better way to do what you want for the time being:
https://github.com/vieux/OpenUDID

Android: How reliable is getMacAddress() as unique identifier

Are there known bugs or issues with getConnectionInfo().getMacAddress() when it's used as a unique device identifier?
One of the alternatives, the Android ID, seems to be not available (or not really unique) on some tablets. FAIL...
The only problem that I know of is that it is only available if Wi-Fi is enabled.
I think this is a big problem because some smartphone users probably never turn Wi-Fi on. Your app can turn Wi-Fi on itself, but this means your app needs an additional permission "android.permission.CHANGE_WIFI_STATE".
Your general issue - how to uniquely identify the device - is widely discussed, e.g.
Is there a unique Android device ID?
http://android-developers.blogspot.ca/2011/03/identifying-app-installations.html
In this video from last year Google I/O, Reto Meier talked about exactly that problem off identifieng a device correctly.
For the solution you will have to watch the video, because I don't remember it anymore. But I do remember his concerns about the "MacAddress"-Solution. The problem about this solution his that it addresses a particular device and not a particular "installation", think of the problem when a user, who installed your app, sells his phone to another person which will also install your app. With the MacAddress you have no chance to distinct between those two ...

Building a native app to uniquely identify, track and lock a smartphone handset

I'm currently doing some research about my project, a smartphone tracking native application, and I have four questions. Links to any material I can read up will be greatly appreciated, and the most useful/comprehensive response will be accepted.
The primary target smartphones are the Android, Blackberry and iPhone models.
For starters I found out here Uniquely Identify an Android Handset that IMEI can be used to uniquely identify Androids but I think I once read that it can be faked. I don't know about the iPhone and Blackberry.
What's the most reliable way to uniquely identify the smartphone device, if any? Can MAC addresses work or is it possible to spoof that? Can IMEIs truly be faked?
Is it possible to "lock" the device with a custom error message remotely via its unique identification, once the device is reported as stolen? This lock state will remain on the phone even when disconnected from the network, until it is reconnected to the network and unlocked remotely once again.
Assuming such a remote phone lock is possible, can such be reversible by the thief? The native app will run in stealth mode so that it cannot be uninstalled.
Can a cross-platform solution work in this case, or will I have to develop various native apps per platform?
EDIT:
Some more context. As Till rightly said, Apple's "Find my Phone" does this exact thing already (I am just finding out about it, but it looks like a perfect fit already). The user who is choosing to install the app is informed that the phone will be uniquely identified if they do install the app. As for locking the device, "Find my Phone" does it (I gather). Now I need to know how that might be possible on the two other platforms.
With regards the iPhone side of things:
You aren't allowed to uniquely identify the iPhone like that. Apple have just forbidden it unless you get the user's permission first. So if they refuse you permission, your app won't function and you'll need to find another way.
No, you can't do that.
See 2. Also you can't run an app in "stealth mode"
See 2.
Only the network operators can talk to the handsets on an IMEI level. The IMEI number IS the MAC address of GSM networks. However, you can't access that unless you have control of the network. Sure you can get the IMEI from the user, but you can't use that to locate the phone. On CDMA networks this address is called the MEID number.
But there are other ways:
You can get location data on either platform with the users' permission. This is the way you should think about developing your application. You'll want to assign a UUID to a user once they download and install your application on their phones. You can then have the phones report to a server every so often (heartbeat). As long as the phone is powered on and connected to a network, the user would be able to locate the phone.
You can also get the phones IP address on the network, among other things -- such as contacts, messages, files, cache data etc..
On Android it's pretty easy to implement this kind of functionality as a service that could would only be visible on the packages page. Further, if you have root access, you can write whatever kind of rootkit you want such that it hides itself from the system. Same with a jailbroken iPhone. I am not as knowledgeabe about iPhone services though.
Either way, the only cross platform compatibility you'd be able to exploit would be perhaps the way data is sent and received from the server. You could use some standard such as JSON to send and receive data (and hence the same server). Although, both platforms have JSON and Apache libraries, the other parts of the apps or services themselves will need to be completely and dependently developed for each platform (UI, Internal Content Handeling, Syscalls, Permissions, etc).
You can remotely lock, wipe, factory reset, etc. Android devices using the security and device administration Android system interface. This still requires the user to grant permission and it asks them an a more.. obnoxious.. way so that they know what exactly they are agreeing to when they give an app device administration permission. If you ever use an exchange server for business or school, it's likely you'll run into this.
I am unsure about remote iPhone device administration on a jailed system.
If you really want something that can't be removed lest you do a factory reset, you'll need to know a thing or two about Unix programming, and a lot about the operating systems that their respective SDK's don't (and probably shouldn't) tell you. You'll need to be comfortable poking around sources and even reverse engineering if called for. If you're still interested, you'll want to hang around the circles that work on custom phone firmware and software for the iPhone, and Android (and Blackberry). I would start with Android. It's probably the easiest since the sources for the AOSP are easily and legally available.

Are there any tools to sandbox a malware application even more than the granted permissions on Android?

Suppose I want to run some program which requests too many permissions. For example, record from the microphone or read IMEI of my phone. However, there are no practical explanation why recording from the mic or IMEI number is needed for this particular application, except for data mining.
I want to try this app, but restrict its permissions. For example, if it reads IMEI, it should get random IMEI(but the same every time). If it tries to read the mic, it should get silence.
Some other interesting permissions:
Phonebook read/write access -
returns zero contacts, pretend that
write is OK, but actually do
nothing.
Send SMS - pretend that SMS
is sent, but do nothing.
Get list of
visible Wi-Fi networks - return zero
networks.
Obviously the tool should require a rooted phone. Are there any such tools?
You could download the Android SDK and use an emulator to test our the applications. You could then set info like your phone book and test out how the app is using that data.
There is a TISSA prototype application, but it is not released, yet. In CyanogenMod 7 there is a setting to revoke application permissions, but if the app expects the API to return something useful instead of failing, it will crash, it is still not faking data.
i just found the free LBE Privacy Guard for rooted phones. It pretends to protect sms, Internet access, contacts, Call Logs, Positioning, Phone ID, Phone Call and phone state.

Categories

Resources