How to use USB API with any USB device? - google-chrome

I've created an app that uses the USB API to open a new tab when the USB device is connected.
But now I want to improve it a bit. Before, when I use USB API I must define its vendorID and productID in the manifest. It means my app only use exactly one USB device.
Now I want any USB to interact with my app. Anybody can give me an idea to do it?

I do believe it's impossible for security reasons. You can specify more than one PID/VID pair, but you cannot ask for arbitrary ones.
The stated reason for this is to prevent apps from fingerprinting hardware by enumerating all connected USB devices, which has a good chance to be a unique set.

Related

Can I access an USB HID in Chrome without an App?

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

Is it possible to create a Google Chrome extension that can set my computer's network settings?

I have a device that uses Chrome browser for it's front end.
I would like to add a wizard to it, but I don't want to use up any more memory or storage space on the device, especially since the wizard will likely only be used once, during the initial device setup.
So, it is possible to create a Google Chrome extension that can access and change my computer's network settings, as long as I give it permission to do so, or is that completely out of scope for a Google Chrome extension?
Basically, I want the extension to walk the customer through the initial setup process, part of which includes configuring the computer's network settings to be compatible with the device's default network settings. At the end of the wizard, the extension would put the computer's network settings back to what they originally were.
Is it possible to create a Google Chrome extension that can access and change my computer's network settings, as long as I give it permission to do so [...]
No, no Chrome API provides this level of access. So an extension cannot do it on its own.
As wOxxOm mentions in a comment, it's possible to also provide a separate program (called Native Host) that an extension can start, then talk to it to do things outside of extension APIs. However, that complicates the deployment of such an extension: you can't add the host components to a Web Store app, you need a separate installer for it.
Presumably, you're targeting multiple OSes with the browser being an interface for your device; this further complicates your hypothetical "wizard" and its installer.
Perhaps the best you can do is clear documentation + an extension/webpage that can test connectivity and suggest troubleshooting steps.
Your requirement is not still clear.
But it is understood that you want to change the ip address settings through any app.which will store a basic setting saved.
it is possible for some specific area but I don't know what is your condition.

Windows Bluetooth ON/OFF API

When I enumerate Bluetooth LE devices using WinRT API, sometimes, I needed to reset Bluetooth radio to successfully find my device. I am wondering is there an easy way to do this from code (Windows SDK, WinRT, WMI etc)?
After digging through Windows Universal samples from Microsoft, I have found a sample RadioManager which shows how to access Radios and turn ON/OFF from code at will. I was able to use the API successfully with a caveat that when used from Desktop WPF app, the app has to be built to match native architecture of the machine. Otherwise, ‘GetRadiosAsync’ method returns empty set.
I'm not totally sure, but resetting the system-wide Bluetooth radio is the sort of action highly unlikely to be available to an execution environment with non-admin privileges.
Anything able to stomp over the abilities of other processes (like turning off a radio) is not going to available in WinRT.
Edit: I stand corrected. Such an API apparently exists:
Windows.Devices.Radios.SetStateAsync

How to certificate WP8 app with HERE launcher

I have created an application which use HERE Application Launchers and my app work fine on my Nokia Lumia 720.
My problem is certification on marketplace I get the response like:
The application exhibits device specific behavior that inhibits functionality and
features. The application's main functionality
cannot be tested on non-Nokia devices because it requires Nokia Here Drive.
-Launch the application on HTC 8X.
...
-Observe the user is prompted to install the app "Here Drive".
I agree with this becouse HERE maps are only available on Lumia devices. But how to use HERE Launchers if we cannot publish it on the marketplace?
If somebody has had similar situation and know solution for it?
That's because it's better to use the ms-drive-to or ms-walk-to Uri scheme!
When you use those, the phone itself will launch HERE drive if it is present, otherwise Bing maps!
Get the needed example code and usage on MSDN here: http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj710324(v=vs.105).aspx
I think you need to clearly state in your app description for Store and in the app itself, that it works only on Nokia devices. (Or you can implement some kind of fallback behavior for non-Nokia devices as well)
This way it should pass the certification, because the behavior will be expected and not confusing.
I suppose either there were something wrong on the submission time, or the rules have changed. I at least submitted an application which is using the Uri Scheme directly, and it got accepted.
In the essense there is no requirements for any specific Application being installed, but there is a query made for applications which support the Uri scheme protocol. And if the HERE application having it is installed, then it will be launched.
And if there is no handlers available, then the market place should be opened for searching for the handlers. At least that's the way the system is designed for.

AIR 3.5 Mobile project device ID

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.