I require the list of fixed properties of android.os.Build class. I've obtained the list from here I bold those that I know are fixed. By fix I mean no change by firmware update, reset factory, ...
android.os.Build.VERSION.RELEASE //The current development
codename, or the string "REL" if this is a release build.
android.os.Build.BOARD //The name of the underlying board, like "goldfish".
android.os.Build.BOOTLOADER // The system bootloader
version number.
android.os.Build.BRAND //The brand (e.g., carrier) the software is customized for, if any.
android.os.Build.CPU_ABI //The name of the instruction set (CPU type + ABI convention) of native code.
android.os.Build.CPU_ABI2 // The name of the second instruction set (CPU type + ABI convention) of native code.
android.os.Build.DEVICE // The name of the industrial design.
android.os.Build.DISPLAY //A build ID string meant for displaying to the user
android.os.Build.FINGERPRINT //A string that uniquely
identifies this build.
android.os.Build.HARDWARE //The name of the hardware (from the kernel command line or /proc).
android.os.Build.HOST
android.os.Build.ID //Either a changelist number,
or a label like "M4-rc20".
android.os.Build.MANUFACTURER //The manufacturer of the product/hardware.
android.os.Build.MODEL //The end-user-visible name for the end product.
android.os.Build.PRODUCT //The name of the overall product.
android.os.Build.TAGS //Comma-separated tags
describing the build, like "unsigned,debug".
android.os.Build.TYPE //The type of build, like
"user" or "eng".
android.os.Build.USER
Please help me complete the list
If you look at the source code to Build, you will see that all of these values -- including those you have in bold -- come from system properties files. Hence, any of these values can be modified by ROM modders or the original device manufacturer as they see fit.
I'm not going to address the woes with consistencies of Build as Mark has illustrated why there isn't a guaranteed answer. Instead I want to respond to what your purpose and intent is.
If I understand correctly, you are trying to uniquely identify a single device. I point you firstly to this answer, from which you can simply conclude that a generic solution is not possible. Either resetting factory defaults or switching SIM cards (if the device has one) will change any sort of unique ID and fool your app into thinking it's a different user.
You need to rethink what you're trying to accomplish. Why do you need to uniquely identify a device? If you're trying to identify a user, then this mindset doesn't cope for multiple devices either. This is now especially the case with Jellybean 4.2, where a device may support multiple users. See also this insightful blog post on the Android Developers Blog.
Can you have the user attach his Google account? Or account for your own service? If you can identify a user, it is then trivial to identify individual devices through UUID.randomUUID().
If I understand correctly (regarding your follow-up comment) you want to identify a device without integrating some kind of registration or login mechanism.
Instead of implementing yout own ID computation algorithm I would suggest using an OpenUDID implementation for android (see https://github.com/vieux/OpenUDID).
Related
I want to be able to have different Firebase Remote Config parameter values based upon the device model.
I've set up Firebase Analytics Audiences for each device model using the "Device Model" user property (which is collected automatically Automatically collected user properties). It provides a drop down which contains the device models that have already had the app installed on, as shown in the screen shot.
Then in Remote Config, for the parameter concerned I created a "value for condition", specifying the previously created audience, as shown in the screen shot.
But having done this, the correct value for a given device model is not retrieved on the device, the device just receives the default value.
Interestingly when I create an Audience based on the user property "User ID", and use this audience to define a value for a remote config parameter it does work correctly.
Based on this I would have suspected the Device Model was not automatically collected, but the fact that device models are shown in the drop down when creating an audience appears to contradict this theory.
What am I doing wrong?
Or is there an alternative way to achieve the same goal?
Whilst it doesn't answer the question as to why using the predefined User Property "Device Model" is not working for me. One possible work-around is to define your own User Property and use this in exactly the same way to define audiences based on device model.
Of course in this case it is necessary to explicitly set the User Property on Android, e.g.
firebaseAnalytics.setUserProperty("device_model", Build.MODEL);
Where "device_model" has been created in Analytics -> User Properties.
I tested this approached and it worked fine.
Imagine an application that consists of loads of clients and one server. The clients should be able to use the application without the need to register a username for e.g. (Therefore getting the feeling of anonymously using the app)
What unique data in a smartphone could be use to identify "anonymous" users and seperate them uniquely, so that each user would have its own personal data.
Could one use the IMEI id?
Is this possible?
At I/O 15 Google announced the 'instance ID' which uniquely identifies an app installation, and can be used for a veriety of other purposes as well.
I give more detail in an answer to an existing, similar question here:
https://stackoverflow.com/a/30948111/150016
Yes You can use the IMEI, but then you need a permission...or you could give every User a Unique ID on the server side
I think a long type variable is enough so the first one that connects you give him the ID 1 the app gets the ID and so on and so forth
You can use a built in feature here:
import android.provider.Settings.Secure;
private String uniqueIdentifier = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
where Secure.ANDROID_ID is presented as "A 64-bit number (as a hex string) that is randomly generated when the user first sets up the device and should remain constant for the lifetime of the user's device."
This is exactly the use case for the new Instance ID: getting a unique ID that you can use to identify even a not logged in user to your server.
This works on both phones and tablets (something IMEI does not) and avoid issues with ANDROID_ID (such as a few manufacturers always using the same ANDROID_ID on all devices).
You don't want to use the IMEI, as it will only apply to devices that have cell phones in them. There are plenty of wifi only devices out there in the wild.
Also, to get the IMEI, you need to ask for extra permission in your manifest.
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
You'd be better off either generating your own random GUID and storing it in your app's SQLite database, or use the Android ID field.
Android ID will give you extra benefits like providing a different identifier for different user profiles within a device.
Another answer here mentioned using Instance ID, but the big caveat there is it requires Google Play Services, so your app wouldn't work on AOSP / forked devices (i.e. Amazon's tablets). I'd have just inserted this as a comment to that answer, but my rep won't let me comment yet.
In some locales, a person's full name is written out with last name (family name, surname) then first name (personal name, given name), instead of the more common first name then last name order.Is there any API in Android which can take care of this name ordering for my app depending on the locale of the phone.
I'm afraid, there's no API for that. I've been looking fot it for a while and all that i know is what #Shervin shared.
Currently:
You can try to manage that all yourself, by getting title, name, second name and last name from user. In english it's easy to order it correctly and concatenate it with space. Unfortunately - not every language use spaces.
Research:
CLDR is project providing any locale-specific data (for example in ICU), but order of name and family name is not there.
Possible solution:
Most of solutions out there can be summed up to:
If designing a form or database that will accept names from people
with a variety of backgrounds, you should ask yourself whether you
really need to have separate fields for given name and family name.
Sometimes you may opt for separate fields because you want to be able
to use part of the name to address the person directly, or refer to
them. For example, when Google+ refers to "Richard's contacts". Or
perhaps it's because you want to send them emails with their name at
the top. Note that not only may you have problems due to name syntax
here, but you also have to account for varying expectations around the
world with regards to formality (not everyone is happy for a stranger
to call them by their given name). It may be better to ask separately,
when setting up a profile for example, how that person would like you
to address them.
http://www.w3.org/International/questions/qa-personal-names#fielddesign
So you must choose if you need to ask your user separately for first name and last name (should be usefull in sorting), but even then - you need to know how they name should be displayed.
Mostly you'll see form that asks users to provide: First name, Last name and Displayed name. Check here (fourth heading) for explanation.
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.
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.