does anyone know how I can predict the next id on my android device. Because every time I go over the reader, I get a different id.
It's random by design for security purposes because the design of NFC is that the ID only has to be different if multiple Tags are presented at the same time (NFC != RFID)
Related
i want to get the ID of my android device.i use RFID to read that ID. but it shows something random each time.it means my hardware is generating a random code each time.
I attached the image to complete understanding of my question.
Image of Build Number of my android device
I have pointed out the build number of my android device.
Here is my 2 question.
1) Is it unique for every device or it can be same?
2) if it is unique how we can get it programmatically?
In order to uniquely identify a device you can use the Secure class in which is part of the Android's Settings package. which returns the Android ID as n unique 64-bit hex string. This way:
import android.provider.Settings.Secure;
private String android_id = Secure.getString(getContext().getContentResolver(),
Secure.ANDROID_ID);
However, this is non to be null sometimes. An all perfect complete solution to uniquely identify a device is yet to come up. There are various factors to be considered while acquiring the unique id of a device. Also see this Answer
I'm currently developing an android app for a weight scale I received that transmits data through bluetooth low energy.
I was looking at documentation and if I got the information correctly, there are specific UUIDs for data. I received a BLE scale with a Chinese protocol document found here: http://www.anj.fyi/protocol.pdf
I found and was able to get a functioning scanner working that lists the device name and the UUIDs it broadcasts.
Lets say I want just the weight data to show up in the UI, nothing else and nothing more.
I don't know what UUID they used for the weight data, and there are a lot of UUIDs. Probably 20+. I checked a UUID compilation and the usual weight data UUID does not show up.
How do I get the data from those UUIDs?
I'm thinking it might be the ones that are notifications, indications or read properties.
Looking at the UUID for example, f000ffc2.
How would I get data from that characteristic? Would anyone have an example code to grab the data from those UUIDs, or tutorials because I'm terribly lost right now.
I really appreciate it.
There are no weight information on the document you list http://www.anj.fyi/protocol.pdf, it is only shows the BLE module hardware interface spec, i.e. it does not specify the detailed service and characteristic.(I an a native Chinese speaker).
Regarding to the UUID you want to know which is the one to represent the weight, yes you are right it should be the read/notification feature without write permission. Can you use the apps e.g. lightblue on iOS to receive the notification(meanwhile change the value on your device) to test it? this will help you to understand which characteristic is the one you want.
I was just wondering if it was possible to force a scan for NFC tags on Android and how to do it. I want to know if I can call something like nfc.scan() and have it return the tag info if there is any tag detected. I am kinda new to this Android thing and so far I have only seen it done with intents.
No, Android does not allow you to trigger a scan for NFC tags/devices in range.
In fact, Android continuously polls1 for tags while the screen is on (and unlocked) and there is no currently detected tag. Thus, you can register your app to be informed when a new tag is detected -> this is done through intents.
1) Most Android devices employ some energy saving mode that prevents the device from continuously polling for all kinds of tags. Instead, these devices detect tags by sending a short impulse and measuring detuning effects from inductive coupling.
I want to know if I can rely on the telephony values like country, MCC, etc on Android for my app. Can I change them on the run using setprop? I tried changing using setprop it didn't seem to work. From my understanding telephony manager is a class/interface which represents Hardware configuration of GSM or CDMA. In case of GSM this could be sim and in case of CDMA it cud be a hardware. My questions are:
Who update these values in both the cases for the first time?
Are these values are saved by OS as read only?
What if a user travels to different country or zone will some of the values like country code and MCC values updated automatically?
Can I reset these values?
I have no intention of changing any of these values but want to understand its working! I would appreciate if someone can help me on this.
According to android documentation
Provides access to information about the telephony services on the
device. Applications can use the methods in this class to determine
telephony services and states, as well as to access some types of
subscriber information. Applications can also register a listener to
receive notification of telephony state changes.
TelephonyManager is used for reading phone information. Regarding your question about MCC & MNC codes: yes, they will change when phone will be in other country. You can subscribe to receive those events and determine that user now in different country.
#Bo
The way CDMA works is different from GSM. CDMA has always got one home base and many visitor base location. and you can always get to know about visitor Operator using TelephonyManager methods which is considered as unreliable for CDMA.
I decided to add it as answer as well...
I found a way to tackle this problem on CDMA phone.. if it is a CDMA phone , then the phone always has an ICC hardware comparable to SIM cards in GSM. All you gotta do is use the system properties associated with the hard ware . Programmatically you can use Java reflection to get this information . This is not changeable even system is rooted unlike GSM device. Class c=Class.forName("android.os.SystemProperties"); Method get = c.getMethod("get", String.class); String homeOperator = ((String) get.invoke(c, "ro.cdma.home.operator.numeric"));