I'm doing an application, for the trial version I have to recognize phone from something like IMEI or MAC address, but if you are good you can spoof them, so is there something on Android that doesn't change at all? Thank you
there is something called UDID which is generated on boot and it only cleared when device reset to its factory defaults. So you can use it if it matches your requirement. Here is the link to which tells how to generate it.
Related
I'm after some help - I've noticed that some Cambridge Scientific StarPADs have an IMEI clash when we check for Unique ID.
((TelephonyManager)paramContext.getSystemService("phone")).getDeviceId();
or
Settings.Secure.getString(paramContext.getContentResolver(), "android_id");
I'm at a bit of a loss, the supplier is claiming ignorance and it is discussed elsewhere Id Android Apps .. does anyone out there have any ideas?
BTW: Yes I've checked around for a similar question, but if I've missed something - happy to be corrected.
Because of Android fagmentation there is no Unique ID in Android at all.
If You really need it for backend use, you should create at backend side new ID while app first start and store it ex. in SharedPreferences.
If You want this key to persist between instalations problem is more complicated. You may store this key out of /data/data/ directory but it's a bit hacky method.
Another solution is to generate potential unique ID by getting as many id's from Your phone as You can get. WiFi mac address, Bluetooth mac address, device ID etc. and combine them but you can never be sure it will be unique globally.
I'm building an android app about something.
I want that my app cannot be copied.
in WINDOWS I can do like this:
get cpu id from this cmd line:
wmic cpu get processorid
encrypt this code and save it into database
every time software opened it will checks the cpu code and the code in database. so when software copied to another PC it will say:
encrypted code and your cpu code does not match.
I was searching for this command in android and OOPS, there isn't any thing that work 100%.
really I don't need to use only this way(get device ID and save it and..) and if you know another way to do this work(I want that my app cannot be copied) say that.
maybe it is good to say my idea that isn't completed:
create a form for buy this app with unique username in my site.
after a user bought this app it will be download for him.
every time that user want's to open the app it connect to server and see if user is available app will work for him and make his user unavailable for next time that it will be opened in another device (NOPE.I can't do this because it isn't a different between tow android device and I haven't a unique ID);else it can not be worked.
UPD1: can this
works?
You should generate your own uuid.
Google's blog post says IMEI, mac address, serial number, ANDROID_ID, all of them has a problem.
Use java.util.UUID instead.
String android_id = Secure.getString(this.getContentResolver(),Secure.ANDROID_ID);
Hello I am working on an application in which we are tracking our app installation using device unique ID.
We are doing right now like this as https://stackoverflow.com/a/2785493/2455259
private String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
I got to know that from android 4.2 it can have different for different users https://stackoverflow.com/a/27013749/2455259.
Now I can't take mac address of wifi or bluetooth because it requires to make it turn on then fetch. Even I can't take IMEI because some tables don't have call feature so they don't have IMEI.
Now what are the option to uniquely identify android device ?
Now what are the option to uniquely identify android device ?
I am afraid assigning own unique number is most effective approach, because ANDROID_ID is broken (the answer you link to is incorrect - see comments there too), relying on it is quite futile as it can sometimes be the same for many devices or null, so anything but unique, therefore using it is pointless as it adds more troubles than helps. There's post on Android blog about this topic "Identifying App Installations" that you may want to get thru as well.
I know this is old and the OP might have already moved on but with the introduction of Instance ID, we can use it to identify a unique installation.
The associated code is pretty straightforward too.
String iid = InstanceID.getInstance(context).getId();
The benefits include not having to specify permissions for Android Marshmallow and above. This seems to be a plus for developers who would need a unique id at the outset and cannot rely on user provided permission model for the same.
Following scenario:
I want to create an wifi hotspot on a public place (e.g. train station). Therefore i want to write an mobile application (iOS and/or Android) which works as a portal page. As I would be providing internet access via my wifi hotspot I need to make sure that people who want to log in verify their identity properly (responsibility). First I thought i could do something like a facebook login but I guess that would not be enough as people can create fake accounts.
Then I got the idea that I could maybe access their telephone number via their smartphones.
I googled alot and came to the conclusion that it is pretty tough on both platforms.
The iOS method seems to be deprecated and apps wont make it to the app store with that version. Android can read the phone number from the sim card, but not all providers store the number on the sim card.
Question
Is there any possibility to get the phone number? Or is there any other way to uniquely identify a person in a wifi network?
Of course I dont want to do any of that without asking for users permission etc...
Greetings and thanks in advance
Peter
Choosing the MAC address is a good choice, it is not the safest, but it is the more easy to do.
The IMEI is not always provided, and the SERIAL is not uniq.
But actually, I don't know how to do this with iOS.
What is about the MAC address of the phone? This should be unique enough and you can get is easily from android and from iOS.
Android: http://developer.android.com/reference/android/net/wifi/WifiInfo.html#getMacAddress%28%29
iOS: How can I programmatically get the MAC address of an iphone
Using IMEI number
Android Does provide functions/method to access device IMEI number
First Set <uses-permission android:name="android.permission.READ_PHONE_STATE" />
in android manifest
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
// get IMEI
String imei = tm.getDeviceId();
Hope it helps
For NON CDMA or GSM devices like Tablet
Use
import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
This would generate a unique code for the device..how ever it would change on when user reset the device ie factory reset it .. and it works for device having os > 2.2(froyo)
This really depends on who you are trying to identify. That may seem like an odd response, but usually, we are trying to identify two, not one, sets of credential elements.
First, we want ot identify the device itself -- is this the deivce we expect to see and can we trust that this device has not been tampered with. Second, we usually want to know if the user of this device at the moment is one we expect to be using this, now validated, device. (If I take your phone, without step #2, I just became you.)
This is why we have things like 802.1x. It lets me validate the user of a network, not just the device. For your case, consider something like:
For device validation, the combination of hte MAC address and the IMEI. TUrn those into a unique hash with some data from the user. For example.
ID = SHA1(IMEI+MAC(Wifi)+user password)
Now that we're pretty sure the device and user are correct, if you need to, you can go one step further and use that hash a key to encrypt a user validation step in your app. Even if the user is correct, if they're on the wrong device, their key won't decrypt.
I would like input in deciding what API-accessible field in Android is the best equivalent to an iPhone's "device name" (it will be used as non-essential login data passed to a server). By device name, I do not mean "model", or any hardware- or software-related identifier, but more to do with the owner.
See How do you get an iPhone's device name for exactly what I'm referencing.
As an additional example, when faced with the same problem in BlackBerry, it was decided that the owner name was the best equivalent. (See answer in Get Blackberry Owner details (eg name/number) through API )
So far, it looks to me like the best android-equivalent is using an AccountManager to return someone's google account email; see How can you get an Android user's email address?. This seems to me like a pretty rough approximation, though; and would require adding another whole permission to the app just for some non-essential login data. Does anyone know of a better equivalent, and how to grab it?
Many thanks!
If you look in Settings -> Wireless & Network Setting -> Bluetooth Settings There is an option to set the device name. If the device name has not been set then I think it uses the persons account. You can access it through the BluetoothDevice.getName() method. Not sure if that helps.
BluetoothAdapter.getDefaultAdapter.getName() is also returning null if the user has switched off BT e.g. for saving battery or for security reasons. So it's not reliable, I'd say.