Retrieve user agent from device model, os or browser version - user-agent

I have a need to determine the User-Agent given the device model, os or browser versions. Is there any WURFL api which can be readily used for this purpose? Any other library? Please point me to the respective code snippets.
Thanks,

I was able to find the solution finally. There getUserAgent method defined in Device interface.
WURFLUtils utils = wurflEngine.getWURFLUtils();
Set<ModelDevice> mds = utils.getAllModelDevices();
for (ModelDevice md : mds){
System.out.println(md.getUserAgent());
}

Related

Xamarin iOS External Accessory: check whether hands free device (car) is available

I want my app to detect the Hands-Free built in the car. I don't need to communicate with the device, I just need to check if it is available.
Ex: I want to send a notification when an Hands-Free is available on the vehicle.
I got this working with CoreBluetooth but it only works with BT4/BLE. Do I need to use EAAccessoryManager for old Bluetooth devices (version 2.0)? How can I implement this? I did try the code below but does not work:
var _accessoryList = EAAccessoryManager.SharedAccessoryManager.ConnectedAccessories;
foreach (EAAccessory acc in _accessoryList)
{
// devices
}
The list _accessoryList is always empty.
The info.plist contains the background mode External accessory communication and the key UISupportedExternalAccessoryProtocols which I am not sure what should be the value to put in.
Any help? what am I missing? Thanks

Is there any way to get a non-iOS tablet's geolocation using FileMaker?

FileMaker Go has Location and LocationValues functions available for getting geolocation data. I have a client who is using FileMaker Pro on Microsoft Surface tablets, and would like to find some way to get this same data, basically latitude and longitude, into FileMaker.
I've looked for plugins without success, but perhaps someone else here knows of one that will do the job. Other solutions I've thought of but not yet found specifics for include using Java via the ScriptMaster plugin or using a website via the Insert from URL script step.
HTML5 has built in support for geolocation, so you could get this with a web viewer and return the result to FileMaker via an FMP url.
The geolocation function is documented here:
http://www.w3schools.com/html/html5_geolocation.asp

switch the cameratype in Windows Phone7

all, as we know, the CameraType property indicates the location of the camera on the device. But when I try to swich the cameratype from Primary to FrontFacing by using the following code, it does not work. After reviewing the MSDN document, I found it was a protected set method. And obviously I have no access permition. Is there any way to do that?
Could any one help me?
Thanks in advance!
camera.CameraType = CameraType.FrontFacing;
It seems like you can't force the camera to a different mode after you initialize it.
Use the constructor of the implementation.
For ex: Constructor of PhotoCamera class
I assume you're trying to create a custom camera app ? or something similar ?
If you just want to capture a picture, use Camera Capture Task instead of this. Otherwise your app will fail certification.
If photo capture is not a core feature of your application, consider using the Camera Capture Task to capture photos instead of using the camera APIs directly. Memory allocated for the Camera Capture Task does not count toward total application memory use. This helps minimize your application’s memory use, which is particularly important when your application runs on a 256-MB device. For more information, see Developing for 256-MB Devices and How to: Use the Camera Capture Task for Windows Phone.

How do I access the Request object from RazorViewEngine?

I have subclassed RazorViewEngine so I can check for Request.Browser.IsMobileDevice and add a special mobile identifier to the view file name for it to grab. However I can't access the Request object. What should I do?
You can use either the HttpContext.Current.Request or Context.Request. Although understand how that IsMobileDevice works. It uses a browser file which contains a list of known user agents. As soon as a new device is built, that list is outdated, but in some cases may still identify the device to be mobile correctly. The recommended way is to use 51Degrees or to connect to the services it encompasses directly.

Making HTTP Requests in Qt

I'm new to Qt. I installed Qt for VS2008 and integrated with my VS2010. I just want to know how to make HTTP requests. I've read about QtNetwork but QtHttp is obselete.
I also know about libcurl and curlpp, but I have problems installing it, and making it work with Qt.
What do you recommend, QtNetwork or curlpp? If QtNetwork, can you please give me a sample function or piece of code (and what class to use). If curlpp(libcurl), can you please point me to somewhere where I can find the steps to install it for Qt (or kindly explain)?
Thank you very much.
libcurl and curlpp are great libraries, but using them adds a dependency to your project that probably you can avoid.
Recent versions of Qt recommend to use QNetworkAccessManager to make network requests (included http requests) and receive replies.
The simplest possible way to download a file is:
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*)));
manager->get(QNetworkRequest(QUrl("http://stackoverflow.com")));
When the replyFinished slot is called, the QNetworkReply object that it takes as parameter will contain the downloaded data as well as meta-data (headers, etc.).
A more complete example can be found in the Qt examples, you can read here its source code.
Giuseppe is right, you don't need to use libcurl, curlpp and similar libraries.
There is no need for that, Qt has a simple and working class on it own.
Keep in mind that the standard way of sending request and retrieving reply is asynchronous.
You always have to connect the manager finished(QNetworkReply*) signal to a slot.
If you send multiple requests and don't want to add a slot for each reply, you can always run an event loop, and connect the managers signal to event loops quit() slot.
Something like this:
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
QEventLoop *eventLoop = new QEventLoop();
QObject::connect(manager, SIGNAL(finished(QNetworkReply*)), eventLoop, SLOT(quit());
manager->get(QNetworkRequest(QUrl("http://stackoverflow.com")));
eventLoop->exec(QEventLoop::ExcludeUserInputEvents);
QByteArray replyData = reply->readAll();
... //do what you want with the data your receive from reply
Btw. don't know what are you doing. But if its a mobile app, I would recommend you switch from VS to QtCreator IDE. It has a nice simulator and a complete toolchain for mobile device testing.

Resources