locked
How to dedect Motorola MC2180 handheld computer as mobile device RRS feed

  • Question

  • User-1262787652 posted

    In ASP.NET MVC4 application

        HttpContext.Current.Request.Browser.IsMobileDevice

    is used to dedect mobile devices. It also contains views with .Mobile as part on view name for mobile devices. Application is browser application which renders different views in browser on mobile and non-mobile devices.

    51 degrees mobi module from  http://51degrees.codeplex.com/ free version is also installed. If Motorola MC2180 mobile computer/handheld scanner  is used to log on to application, is is not dedected as mobile device: .Mobile views are not executed, usual views appears.

    How to force it to be recognized as mobile device ? Device is running Windows CE 6.0 and it contains Motorola Rhoelements RHOS custom browser which returns version string as

        Mozilla/5.0 (Windows CE 6.0) AppleWebKit/534.51 (KHTML, like Gecko) MotorolaWebKit/2.1.8.7 Safari/534.51

    Application should in Mono and in ASP.NET 4. jquery is used. jqueryy-mobile is used in mobile views.

    Tuesday, October 22, 2013 9:00 AM

All replies

  • User1508394307 posted

    If you know that Request.Browser.IsMobileDevice is not reliable in your case and you particulary interesting in Motorola, then why not to do something like this

    var useragent = Request.UserAgent;
    var isMotorola = false;
     
    if (useragent != null)
    {
        if (useragent.Contains("MotorolaWebKit"))
        {
            isMotorola = true;
        }           
    }
     
    if (Request.Browser.IsMobileDevice || isMotorola )
    {
    ... 

    http://dbarrowstechblog.blogspot.hk/2011/02/requestbrowserismobiledevice.html

    Tuesday, October 22, 2013 3:55 PM
  • User-1262787652 posted

    Thank you.

     

    MVC4 uses  *.Mobile.cshtml views automatically for mobile devices.

    How to force it to use those views for this device also ?

    51degrees.mobi does this is some way and it sets also IsMoblieDevice true if it dedects it.

    Wednesday, October 23, 2013 1:26 AM