I am having a use case in which a user can log in from only a specific device. Prior to android 10
it was easy as the device identifier like IMEI,serial number was accessible. Each user ID'S were mapped against one IMEI(one to one mapping).
But in android 10 these identifiers are not accessible. Hence unable to uniquely identify the device.
How can we access the IMEI number in android 10 or any alternate identifier which can uniquely identify a device.
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.
Related
I want to use an USB HID from a website. The website will only be accessed by Chrome browsers. The solution should require a minimum amount of extra software and setup for the website user to work.
The USB device presents itself as USB HID to the OS and I need to write and read byte arrays to and from it in order to implement the manufacturers specification for some of the device's features.
My current solution consists of two parts:
A Chrome App that uses the chrome.hid API to talk to the device. This App exposes a Chrome Cross-Extension messaging port to provide and interface for "service calls".
JavaScript code on the website that sends requests to the Chrome App, which then talks to the USB device to process the request.
In order to make it easier for the user I want to get rid of the App, so the user can just surf to the website, grant access to the device if necessary and then be able to use the device.
To be clear, I want the user to be able to use the website without installing any dependency first.
I already tried using the WebUSB navigator.usb API but Chrome blocks access to USB HID devices. Is there another way to accomplish this?
WebHID is being developed for this use case. It has been available behind a feature flag since Chrome 78, with an original trial expected in Chrome 84 (probably later due to current Covid-19 situation), estimated stable August 2020 .
For more details: https://github.com/robatwilliams/awesome-webhid
Previous iterations of Windows 10 have the HardwareToken API (aka ASHWID) to get a unique identifier for the device, but it had several drawbacks:
It was only available on Desktop and Mobile platforms, which required you to add an Extension SDK to your project (and wasn't available on HoloLens or other platforms)
On the PC, the value could "drift" as hardware changed (even just plugging a laptop into a docking station would change the ID), so you needed complex backend logic to correlate device IDs
The value was specific to a single app, and couldn't be shared across apps by the same publisher
Is there a new way in the Anniversary Update to get a more useful / stable ID that's consistent across all Windows 10 platforms? I want to use the ID in my apps to correlate telemetry from the same device for purposes of usage metrics and advertising. I will not use the value for identifying the user, creating anonymous accounts, encrypting data, or anything else like that. It will only be used for telemetry purposes.
I want to do something like:
var id = Windows.Something.GetDeviceId(); // hypothetical OS function
var telemetry = MyApp.GetUsageTelemetry(); // my own function
// Use (eg) HttpClient to send both id and telemetry to my
// cloud infrastructure for processing and correlation
SendDataToCloudForProcessing(id, telemetry)
Updated Nov 3rd 2017 (new Registry value, below)
The Windows 10 Anniversary Update introduced the new SystemIdentification type which does exactly what you want. It has several benefits over the old ASHWID:
It is available on all Windows 10 platforms
Note: The ASHWID is now also available on all platforms, but still has the other drawbacks listed above
It returns a stable value (even on PCs) that will not change due to hardware upgrades or re-installations of the OS
It returns a value that is the same for all apps by the same publisher, allowing correlation across your portfolio of apps
It can also return a value that is the same across all apps, for a specific user, if you have the userSystemInfo Restricted Capability
Note: This is most useful for Enterprise scenarios; you are unlikely to have an app approved for the Windows Store that uses this feature without a very good justification, since it represents a privacy concern
There is one minor drawback to the API: it won't work on some old PCs, since it requires either UEFI or a TPM. Most PCs built in the last 5+ years should have this hardware, and all other non-PC devices (phone, Xbox, HoloLens, etc.) have the correct hardware. If you find a PC that doesn't have the hardware, you will need to fall back to the ASHWID or some other mechanism.
Update Nov 3 2017
Starting with the Windows Fall Creator's Update (aka 1709 or RS3 or Universal API Contract 5) there is a new Registry identification source which provides a relatively stable ID in case the user doesn't have appropriate hardware. It will change if the user does a fresh re-install of the OS (not an upgrade, but a new install) or if the user changes the registry, but otherwise has the same benefits as Uefi or Tmp.
End update Nov 3 2017
Using the API is simple; there is no need for complex parsing or accounting for drift on the back-end:
using Windows.System.Profile;
IBuffer GetSystemId()
{
// This sample gets the publisher ID which is the same for all apps
// by this publisher on this device.
// Use GetSystemIdForUser if you have the userSystemId capability
// and need the same ID across all apps for this user (not
// really applicable for apps in the Windows Store)
var systemId = SystemIdentification.GetSystemIdForPublisher();
// Make sure this device can generate the IDs
if (systemId.Source != SystemIdentificationSource.None)
{
// The Id property has a buffer with the unique ID
return systemId.Id;
}
// This is a very old PC without the correct hardware. Use
// another mechanism to generate an ID (or perhaps just give
// up due to the small number of people that won't have the ID;
// depends on your business needs).
return GetIdFromAshwidOrSomethingElse();
}
As noted in the question, this ID should only be used for purposes of correlation in a back-end service (eg, for telemetry, advertising, usage metrics, etc.). It should never be used to create anonymous user accounts, to identify or track users, to encrypt user data, etc. This is because different users can share the same device, or the same user can roam across different devices, so the ID doesn't map 1:1 with a user or their data.
This API is available in the Universal API Contract v3, and can be found in the Windows Universal SDK version 10.0.14393.0 (remember that if you're doing multi-version apps and want to light-up usage of this API, you should not do runtime version check; instead you should just query the OS to see if the API is available).
I have 2 Windows Phone 8.1 devices connected by usb cable to my computer. I can use isetool.exe successfully with each phone individually when it is the only one connected. I know I need to use deviceindex:n but EnumerateDevices only returns one device (index 0) when both are connected.
I cannot find any specific examples online nor in the documentation that specify that 2 devices physically connected to the computer will be returned, the same line "Lists the valid device targets and the device index for each device" from Microsoft documentation (https://msdn.microsoft.com/en-us/library/windows/apps/hh286408%28v=vs.105%29.aspx?f=255&MSPPError=-2147217396#BKMK_Syntax) but that could include one device and multiple emulators.
I do not have any emulators set up to confirm if EnumerateDevices only helps in the case of multiple emulators and has a max of 1 device.
Can anyone confirm one way or the other, or shed any insight why i only get one device returned?
Only one physical device at a time is supported; the others would all be emulators.
I'm trying to get information from a HID supporting device in a windows 8.1 app. My app is capable of finding the device, when I do a DeviceInformation.FindAllAsync(deviceSelector) the device is in the list.
But when I try to get a handle to the device using HidDevice.FromIdAsync, it returns null
How do I debug this issue to hopefully find the reason for getting a null reference back and not a HidDevice instance?
I've validated the following things already
The device supports HID as I'm capable of connecting and reading from
it using a winforms application and a generic hid driver
VendorId, ProductId, UsageId and UsagePage are correct otherwise it
could not be listed in the find all I assume
The same values have also been specified in the app manifest
capabilities
The device is using built in drivers (I'm aware that 8.1 can't do
supplier provided drivers)
There are no warning or error entries in the operational logs
I get the same behavior when using the devicewatcher, it finds the
device but I can't get a reference to it
Any thoughts?
Just by sheer luck we found the issue.. apparantly usagepage and usage were inverted in the app manifest.
I am wondering if someone knows the best method for storing data in a global DB against a mobile device (iOS and Android)?
I am building an app that writes/retrieves information based on a query however I need to know if any of the records returned were sent from that device.
Basically the idea is that if a user submits some information (which is stored in the DB) they gain access to additional features of the app. When the app is launched, I will check the DB to see if they submitted information in the past and allow access to other areas.
I use local storage for the information they submitted but also store remotely so if the local storage becomes corrupted for any reason there is still a record of the information the user submitted.
The ID needs to be unique to the device as there could be 100 of users (hoping for millions) so the ID needs to be unique enough that it will never conflict with another device. Any information submitted will be available for retrieval by all other users.
Thanks :)
There are three options as I see it:
1. User
You can create a typical username + password user scheme and use this to verify the user. A possible advantage of this method would be that the user can log in from any of their devices (for instance, under your method a user using the app from their iPhone and iPad would have two different views - which you may not want). Of course, this means forcing every user of the app to register within your system, which is not ideal.
2. App Install
You can uniquely identify an app install by having your app generate a UUID the first time that the app is run (you can use an AS3 helper library to generate the UUID). You can store this UUID locally and send it along with every request the app makes. The downside to this approach is that it doesn't uniquely identify the device - only a specific app install. For instance, if the user deletes the app and then reinstalls it at a later point, it will now count as a new unique device, even though the user is on the same device.
3. Device
AIR does not have a built-in way of reading device identifying info. However, you can retrieve device info through AIR Native Extensions, for example this one can get the MAC address and some other things. There are privacy concerns and other issues involved in reading and storing device info such as these, so you are probably best served trying to implement the OpenUDID project as an AIR Native Extension, since they have already dealt with all such issues. Unfortunately, I have never looked too far into developing ANE's so I am not sure how complicated or feasible it will be to turn OpenUDID into an ANE.
Summary: I would recommend the app install method due to the ease of implementation. If you really need the unique device and are worried about the multiple app installs case, you will have to work out how to use native extensions to get the info you need. If you decide that you would rather identify by user rather than device, use the user method.
As of now I don't think its possible to get the hardware devices guid using air mobile. However you do have a couple of options.
If the MAC address is good enough for you there is an ANE that will let you grab it on both iOS and Android.
http://www.adobe.com/devnet/air/native-extensions-for-air/extensions/networkinfo.html
and an example of how to use it
http://cookbooks.adobe.com/post_Getting_NetworkInfo_from_both_Android_and_iOS-19473.html
You could also write your own ANE, it should be pretty simple to wrap both Android and iOS implementations.
Objective-c: [[UIDevice currentDevice] uniqueIdentifier]
Android: TelephonyManager.getDeviceId()
If your app requires any kind of user account or login the best option would be to store this setting in the remote db.