Search code examples
mobileasp.net-mvc-4samsung-mobile

galaxy s iii web browser DisplayModeProvider "MVC4"


my application is MVC4, it works great with iPhone and Windows Phone, but did not work with Samsung Galaxy S III, it displays Desktop user interface! I tried several InexOf, for example:

 DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Mobile")
            {
                ContextCondition = (context => context.GetOverriddenUserAgent()
                    .IndexOf("Linux", StringComparison.OrdinalIgnoreCase) >= 0)
            });

I also tried:

DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Mobile")
{
    ContextCondition = (context => context.GetOverriddenUserAgent()
        .IndexOf("Opera Mobi", StringComparison.OrdinalIgnoreCase) >= 0)
});

I checked the Samsung III browser, using an older MVC3 application that I have developed, here are the borwser Information: User Agent: Mozilla/5.0(Linux, U; Android 4.0.4 .... Browser: Safari Model SGH-1747M

I would appreciate your suggestions. Thanks in advance


Solution

  • Just in case someone has the same problem. I stared a new project in MVC4 (I was using the Beta version of MVC4 before) Install-Package jQuery.Mobile.MVC; It works now. The problem was not related to Samsung, becasue I tried the application on LG Android and had the same issue. Also I added in Global file the following:

       DisplayModeProvider.Instance.Modes.Insert(0, new DefaultDisplayMode("Linux")
               {
                   ContextCondition = (context => context.GetOverriddenUserAgent().IndexOf
                       ("Linux", StringComparison.OrdinalIgnoreCase) >= 0)
               });