I am using ..
ASP.net MVC 4
51Degrees.mobi
jQuery Mobile
By the helping of these technologies, I can make my web application's UI designs look good not only at Desktop based browsers but also at mobile based browsers without requiring me to create projects separately.
But when it comes to more specific mobile devices, I would like to call specific view file.
So I use below code at Global.asax
file.
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
//The Android view
DisplayModes.Modes.Insert(0, new DefaultDisplayMode("android")
{
ContextCondition = Context => Context.Request.Browser.Platform == "Android"
});
//The iPhone view
DisplayModes.Modes.Insert(0, new DefaultDisplayMode("iphone")
{
ContextCondition = Context => Context.Request.Browser.MobileDeviceModel == "iPhone"
});
//The mobile view
//This has a lower priority than the other two so will only be used by a mobile device
//that isn't Android or iPhone
DisplayModes.Modes.Insert(1, new DefaultDisplayMode("mobile")
{
ContextCondition = Context => Context.Request.Browser.IsMobileDevice
});
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
Unfortunately, Android and IPhone specific view
do not load whenever I call pages from IPhone Emulator and Opera Mobile Emulator.
_Layout.cshtml [loaded from desktop based browser]
_Layout.Android.cshtml [never loaded]
_Layout.iPhone.cshtml [never loaded]
_Layout.Mobile.cshtml [loaded from mobile based any browser including iphone, opera]
What I assume that something wrong is I get only two files when I downloaded from 51Degrees.mobi by using NuGet package.
FiftyOne.Foundation.dll
51Degrees.mobi.config
Even though I think I should get App_Data/Devices.dat
but I still only get these two files from 51Degrees.mobi.
Could anyone please give suggestion to me how I could call specific view for IPhone and Android? Every suggestion will be appreciated.