I need to validate IMEI number, is their any mechanism for validating the input IMEI? Can we get status of validation in true or false ?
You cannot, Third-party apps can not use IMEI nor the serial number of a phone and other non-resettable device identifiers.
Restriction on non-resettable device identifiers
Starting in Android10, apps must have the READ_PRIVILEGED_PHONE_STATE
privileged permission in order to access the device's non-resettable
identifiers, which include both IMEI and serial number.
read more
You can still get the non-resettable device identifiers in older android versions by calling android.telephony.TelephonyManager.getDeviceId().
Alternatively, If you can get a unique id use this code
Secure.getString(getContext().getContentResolver(),Secure.ANDROID_ID);
No, you cannot get IMEI after Android 10,
Use This Approach will do the same purpose, but beware it's not the same for debugging and release also it contains both Numbers and Letters.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
imei = Settings.Secure.getString(Objects.requireNonNull(getContext()).getContentResolver(), Settings.Secure.ANDROID_ID);
}
Related
Im currently working on a Mobile application which connects to a Ble peripheral and reads data from it. In order to test if the connection is working. I have written a small C# application that utilizes the RaspberryPi4 bluetooth via DBus with BlueZ.
Everything works except that when connecting to iOS a pairing request is issued by the raspberry, eventhough I do not have any encrypted characteristics.
I have read on the Apple forum that this is because bluetoothd is automaticly trying to read the battery level of the phone. But sadly even after the fix suggested there I get the pairing requests.
Does anyone have an idea how I could fix this?
Thanks in advance
I believe disabling this bluez config option in /etc/bluetooth/main.conf would prevent the pi from trying to read characteristics from the iOS device, if that is the issue:
# Do reverse service discovery for previously unknown devices that connect to
# us. For BR/EDR this option is really only needed for qualification since the
# BITE tester doesn't like us doing reverse SDP for some test cases, for LE
# this disables the GATT client functionally so it can be used in system which
# can only operate as peripheral.
# Defaults to 'true'.
#ReverseServiceDiscovery = true
Check the connection min and max intervals, they shall be compliant with the iOS guidelines: https://developer.apple.com/accessories/Accessory-Design-Guidelines.pdf (page 180 - 40.6 Connection Parameters).
You can tune them like this:
echo "30" > /sys/kernel/debug/bluetooth/hci0/conn_min_interval
echo "45" > /sys/kernel/debug/bluetooth/hci0/conn_min_interval
The default values worked for me: [24,40]
We have a uwp windows 10 store app and its licensed per device. we throw an error when that license is already applied on any device. user may uninstall the app and install it again on the same device and same license key works fine.
But for every few days i noticed the HWID(hardwareId ) generated by the following is not unique which fails license key when user uninstalls app and installs on the same device.
private static string GetId()
{
var token = HardwareIdentification.GetPackageSpecificToken(null);
var hardwareId = token.Id;
var dataReader = DataReader.FromBuffer(hardwareId);
var bytes = new byte[hardwareId.Length];
dataReader.ReadBytes(bytes);
return BitConverter.ToString(bytes).Replace("-", string.Empty);
}
From my analysis i feel that the hwid changed for our customers when there were restarts in their computers. though in terms of hardware itself nothing has changed. so device name ,device model, operating systems everything is same always for those users and only HWID has changed.
Is there a better way to handle one license per one device or generate this hwid uniquely? Is it sensitive to OS build number changes or any other software or firmware updates?
The ASHWID provides a strong binding between the app/packag, which is not affected by OS re-installs and version updates for an app. But sometimes there are also other reasons can affect it, it is difficult to know which causes the change of the ASHWID.
Therefore, if you want to get the unique id to distinguish the device, maybe you could use SystemIdentification.GetSystemIdForPublisher method, the identifier returned by this method is specific to the app publisher on the current device. In other words, all apps by the same publisher will get the same value for this ID (for all users).
What device information can I access from the Hololens at run time using MRTK?
Can MRTK determine a unique identifier for each Hololens device that runs my program? Ideally this would be a serial code, but any other unique identifier from the device would be useful.
I am trying to determine ways to track how many unique devices are running my program, as well as how often they run it.
I am aware that using a managed device might be one way to do this, but I am curious if there is any way to get such information without needing to set up ID Management.
You can use the instance of the EasClientDeviceInformation to get device information from the local device. The property Id provides the identifier of the local device. you can use the following code:
using Windows.Security.ExchangeActiveSyncProvisioning;
. . .
EasClientDeviceInformation deviceInfo = new EasClientDeviceInformation();
var deviceIdentifier = deviceInfo.Id;
In addition, you can retrieve more device information through other properties of the instance, a specific sample is provided here: Client Device Information sample.
I'm making a game which have a hightscore table (on my server), now I need to get a unique information of the player (email, MS accout name, Live ID...) or any other way to define people to add to the highscore, so is there anyway to get that information ?
Take a look at the ANID2. It is an identifier that is unique to the Windows Live ID of the user and the publisher ID of the app.
string anid2 = (string)Microsoft.Phone.Info.UserExtendedProperties.GetValue("ANID2");
To use this Api you have to add the "ID_CAP_IDENTITY_USER" capability in the app manifest. You may also find this blogpost helpful.
I'm trying to write simple app, which sends short text message to cellphones in bluetooth adapter range.
My first try is sending files: I can send file from PC to cellphone, but i must enter PIN on cellphone, and on PC.
I would rather to send text messages (something like push message) - is it possible to send it without paring devices?
If isn't possible to send push messages, maybe I can send simple file without requesting PIN ?
I use 32feet library.
Sample code (used to send files to selected device)
static int BTSendFile(string adres, string FileName)
{
Uri uri = new Uri("obex://" + adres + '/' + Path.GetFileName(FileName));
ObexWebRequest req = new ObexWebRequest(uri);
req.ReadFile(FileName);
ObexWebResponse rsp = (ObexWebResponse)req.GetResponse();
return (int)rsp.StatusCode;
}
A quick answer would be; NO, you will ALWAYS need some kind of pairing.
But if you take a look at the different kinds of pairing out there, you would see that BT 2.1 supports Secure Simple Pairing (SSP) with the Just Works-mode. This allows you to pair devices (almost) without any user interaction. From Wikipedia:
Just works: As implied by the name, this method just works. No user interaction is required; however, a device may prompt the user to confirm the pairing process. This method is typically used by headsets with very limited IO capabilities, and is more secure than the fixed PIN mechanism which is typically used for legacy pairing by this set of limited devices. This method provides no man in the middle protection.
However, since "This method is typically used by headsets with very limited IO capabilities", it would probably not apply to the cellphones you are talking about, but I thought you should know :)
According to the offical Bluetooth Message Access Profile, i.e. the specific Bluetooth profile that deals with accessing SMS/MMS systems on phones via a remote device:
'The MCE device shall use the services of the MSE device only after successfully creating a secure connection. This includes exchanging of security initialization messages, creation of link keys, and enabling encryption'
From: https://developer.bluetooth.org/TechnologyOverview/Pages/MAP.aspx
There is also a link to the full spec there if you are interested.
This certtainly suggests that secure pairing is required, which I'd assume to involve the passkey. My experience is that once a device has been paired a connection can be made without repeating the pairing as long as that pairing is remembered by the devices (i.e. I've paired a device once and not had to do it again). As to simpler, non-keyed pairing mentioned by khellang above, I've not seen anything about this - if it is purely for devices like headsets then the security requirements may be lower due to their not likely wanting write access to a device?