Starting with version 3.0.7 (for DNN 5.x) and 2.0.6 (for DNN 4.x) mobiNuke is exposing a rich set of mobile device capabilities available to be used by module or skin developers.
It is possible now to know for example, dimension of the screen, maximum colors accepted, if JavaScript or video streams are supported.
To get these capabilities in your code, include a reference to DataQ.mobiNukeLibrary in your project and follow the example in this sample code:
Dim context As System.Web.HttpContext = HttpContext.Current
'get the capabilitiesGetter from the context scope.
'if this device is not mobile device, it will not be present
If context.Items.Contains("wurlf") Then
Dim wurlf As DataQ.Modules.mobiNuke.capabilitiesGetter = Nothing
wurlf = context.Items("wurlf")
'write a set of most usefull capabilities
Label_SelectedCapabilities.Text = "<h3>Selected Set of<br> Device Capabilities</h3>"
Label_SelectedCapabilities.Text &= "model_name=" & wurlf.getCapability("model_name") & "<br>" Label_SelectedCapabilities.Text &= "mobile_browser=" & wurlf.getCapability("mobile_browser") & "<br>" Label_SelectedCapabilities.Text &= "has_qwerty_keyboard=" & wurlf.getCapability("has_qwerty_keyboard") & "<br>" Label_SelectedCapabilities.Text &= "ajax_support_javascript=" & wurlf.getCapability("ajax_support_javascript") & "<br>" Label_SelectedCapabilities.Text &= "cookie_support=" & wurlf.getCapability("cookie_support") & "<br>" Label_SelectedCapabilities.Text &= "resolution_width=" & wurlf.getCapability("resolution_width") & "<br>" Label_SelectedCapabilities.Text &= "resolution_height=" & wurlf.getCapability("resolution_height") & "<br>" Label_SelectedCapabilities.Text &= "colors=" & wurlf.getCapability("colors") & "<br>"
'write all capabilities
Label_AllCapabilities.Text = "<h3>All Device Capabilities</h3>"
Dim is_wireless_device As Boolean
is_wireless_device = wurlf.getCapability("is_wireless_device") Dim deviceCapabilities As Hashtable = wurlf.getAllCapabilities()
For Each capName As String In deviceCapabilities.Keys
Label_AllCapabilities.Text &= capName & "=" & deviceCapabilities(capName) & "<br>"
Next
End If
To illustrate this new feature, I created a very simple module that displays these capabilities. You must have mobiNuke installed in order for this to work. You can download the sample code from here.
For the complete list of capabilities, click here.