zl程序教程

您现在的位置是:首页 >  云平台

当前栏目

[Wap] 识别访问手机的能力

识别手机 访问 能力 wap
2023-09-14 08:58:21 时间

我们通过以下代码可以获取手机的能力,从而针对不同能力的手机做出显示彩色还是黑白色的图片,显示的字体是否可以为彩色等等。
 

还可以进一步通过System.Web.Mobile.MobileCapabilities 的成员函数

System.Boolean HasCapability ( System.String delegateName , System.StringoptionalParameter )来查询手机是否支持某一特性,代码如下:

bool bHasWBMP =                 
   ((MobileCapabilities)Request.Browser).HasCapability("PreferredImageMime", "image/vnd.wap.wbmp");
log.Info("Has WBMP?" + bHasWBMP.ToString());


MobileCapabilities Codes

在asp.net页面中安排如下代码即可通过log4net打印出手机的MobileCapabilities:


            {

                log.Info("-============ 输出MobileCapabilities Begin ==============-");

                Type myType =(typeof(System.Web.Mobile.MobileCapabilities));

                System.Reflection.PropertyInfo[] myPropertyInfo =

                   myType.GetProperties(System.Reflection.BindingFlags.Public|System.Reflection.BindingFlags.Instance);

                DisplayPropertyInfo(myType, myPropertyInfo);

                log.Info("-============ 输出MobileCapabilities End ==============-");

            }

 

。。。}

 

 

void DisplayPropertyInfo(Type t,System.Reflection.PropertyInfo[] myPropertyInfo)

        {

            // Display information for all properties.

            System.Web.Mobile.MobileCapabilities m=( System.Web.Mobile.MobileCapabilities)Request.Browser;

            for(int i=0;i myPropertyInfo.Length;i++)

            {

                Object result=new Object();

                System.Reflection.PropertyInfo myPropInfo = (System.Reflection.PropertyInfo)myPropertyInfo[i];

                try

                {

                    result = t.InvokeMember (myPropInfo.Name, System.Reflection.BindingFlags.GetProperty|System.Reflection.BindingFlags.GetField, null, m, new object [] {});

                }

                catch (System.MissingMethodException e)

                {

                    result =e.Message;

                }

                log.Info ("[" + myPropInfo.Name+ " ]: " + result+"

            }

        }

 


下面日志对应的手机型号是

Nokia7610/2.0 (4.0424.4ch) SymbianOS/7.0s Series60/2.1 Profile/MIDP-2.0 Configuration/CLDC-1.0


- -============ 输出MobileCapabilities Begin ==============-
 - [MobileDeviceManufacturer ]: Nokia
 - [MobileDeviceModel ]: Unknown
 - [GatewayVersion ]: Nokia WAP Gateway 4.0/CD3/4.0.04)
 - [GatewayMajorVersion ]: 4
 - [GatewayMinorVersion ]: 0
 - [PreferredRenderingType ]: wml11
 - [PreferredRenderingMime ]: text/vnd.wap.wml
 - [PreferredImageMime ]: image/vnd.wap.wbmp
 - [ScreenCharactersWidth ]: 20
 - [ScreenCharactersHeight ]: 4
 - [ScreenPixelsWidth ]: 90
 - [ScreenPixelsHeight ]: 40
 - [ScreenBitDepth ]: 1
 - [IsColor ]: False
 - [InputType ]: telephoneKeypad
 - [NumberOfSoftkeys ]: 2
 - [MaximumSoftkeyLabelLength ]: 5
 - [CanInitiateVoiceCall ]: True
 - [CanSendMail ]: False
 - [HasBackButton ]: False
 - [RendersWmlDoAcceptsInline ]: False
 - [RendersWmlSelectsAsMenuCards ]: False
 - [RendersBreaksAfterWmlAnchor ]: True
 - [RendersBreaksAfterWmlInput ]: True
 - [RendersBreakBeforeWmlSelectAndInput ]: False
 - [RequiresPhoneNumbersAsPlainText ]: True
 - [RequiresUrlEncodedPostfieldValues ]: False
 - [RequiredMetaTagNameValue ]:
 - [RendersBreaksAfterHtmlLists ]: True
 - [RequiresUniqueHtmlInputNames ]: False
 - [RequiresUniqueHtmlCheckboxNames ]: False
 - [SupportsCss ]: False
 - [HidesRightAlignedMultiselectScrollbars ]: False
 - [IsMobileDevice ]: True
 - [RequiresAttributeColonSubstitution ]: False
 - [CanRenderOneventAndPrevElementsTogether ]: False
 - [CanRenderInputAndSelectElementsTogether ]: True
 - [CanRenderAfterInputOrSelectElement ]: True
 - [CanRenderPostBackCards ]: False
 - [CanRenderMixedSelects ]: True
 - [CanCombineFormsInDeck ]: True
 - [CanRenderSetvarZeroWithMultiSelectionList ]: True
 - [SupportsImageSubmit ]: False
 - [RequiresUniqueFilePathSuffix ]: True
 - [RequiresNoBreakInFormatting ]: False
 - [RequiresLeadingPageBreak ]: False
 - [SupportsSelectMultiple ]: True
 - [SupportsBold ]: False
 - [SupportsItalic ]: False
 - [SupportsFontSize ]: False
 - [SupportsFontName ]: False
 - [SupportsFontColor ]: True
 - [SupportsBodyColor ]: True
 - [SupportsDivAlign ]: True
 - [SupportsDivNoWrap ]: False
 - [RequiresContentTypeMetaTag ]: False
 - [RequiresDBCSCharacter ]: False
 - [RequiresHtmlAdaptiveErrorReporting ]: False
 - [RequiresOutputOptimization ]: False
 - [SupportsAccesskeyAttribute ]: False
 - [SupportsInputIStyle ]: False
 - [SupportsInputMode ]: False
 - [SupportsIModeSymbols ]: False
 - [SupportsJPhoneSymbols ]: False
 - [SupportsJPhoneMultiMediaAttributes ]: False
 - [MaximumRenderedPageSize ]: 1397
 - [RequiresSpecialViewStateEncoding ]: False
 - [SupportsQueryStringInFormAction ]: True
 - [SupportsCacheControlMetaTag ]: True
 - [SupportsUncheck ]: True
 - [CanRenderEmptySelects ]: True
 - [SupportsRedirectWithCookie ]: True
 - [SupportsEmptyStringInCookieValue ]: True
 - [DefaultSubmitButtonLimit ]: 1
 - [ClrVersion ]: 0.0
 - [Type ]: Unknown
 - [Browser ]: Nokia
 - [Version ]: 0.0
 - [MajorVersion ]: 0
 - [MinorVersion ]: 0
 - [Platform ]: Unknown
 - [TagWriter ]: System.Web.UI.Html32TextWriter
 - [EcmaScriptVersion ]: 0.0
 - [MSDomVersion ]: 0.0
 - [W3CDomVersion ]: 0.0
 - [Beta ]: False
 - [Crawler ]: False
 - [AOL ]: False
 - [Win16 ]: False
 - [Win32 ]: False
 - [Frames ]: False
 - [Tables ]: False
 - [Cookies ]: False
 - [VBScript ]: False
 - [JavaScript ]: False
 - [JavaApplets ]: False
 - [ActiveXControls ]: False
 - [BackgroundSounds ]: False
 - [CDF ]: False
 
- -============ 输出MobileCapabilities End ==============-


解答:excel格式的通讯录怎么转为手机可识别的vcf格式? 开始第一步:要实现题目中的要求,需要在电脑上准备一个软件《金芝号码提取导入助手》,然后你打开你的excel表格,通讯录一般是姓铭和号码嘛,你打开软件,把你的excel里面的人铭和号码分别复制好,然后选软件的第三个功能模块“导入通讯录”,粘贴铭字和号码进来软件。接着第二步:点软件界面上的“转换通讯录”,你就会得到一个vcf格式的文件,建议把文件保存到电脑桌面,方便再次找到和操作。最后第三步:你需要把这个vcf格式的文件发给你的手机(通过电脑矀xin或者电脑Q发给你的手机矀xin或者手机q就可以)。你到手机上打开这个vcf格式的文件,手机就可以自动识别这个文件实现自动把excel格式的通讯。
UWP开发砸手机系列(二)—— “讲述人”识别自定义控件Command 原文:UWP开发砸手机系列(二)—— “讲述人”识别自定义控件Command 上一篇我们提到如何让“讲述人”读出自定义的CanReadGrid,但“讲述人”仍然无法识别CanReadGrid上绑定的Command。
郑昀 ☑移动数据业务 times;6年 ☑语义聚合 times;4年 ☑O2O times;5年的一个老兵。