??xml version="1.0" encoding="utf-8" standalone="yes"?>快乐12开奖结果查询:BlogJava - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/----TiGERTiANzh-cnMon, 15 Oct 2018 08:33:40 GMTMon, 15 Oct 2018 08:33:40 GMT60MVC/MVP/MVVM - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2017/05/10/432509.htmlTiGERTiANTiGERTiANWed, 10 May 2017 03:03:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2017/05/10/432509.html//www.ot7t.com.cn/TiGERTiAN/comments/432509.html//www.ot7t.com.cn/TiGERTiAN/archive/2017/05/10/432509.html#Feedback0//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/432509.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/432509.html?/h2>

如果把这三者放在一起比较,先说一下三者的共同点,也就是Model和View?/p>

  • Model:数据对象,同时,提供本应用外部对应用程序数据的操作的接口,也可能在数据变化时发出变更通知?span style="box-sizing: border-box; outline: 0px !important; font-weight: 700;">Model不依赖于View的实?/span>,只要外部程序调用Model的接口就能够实现对数据的增删改查?/p>

  • View:UI层,提供对最终用户的交互操作功能,包括UI展现代码及一些相关的界面逻辑代码?/p>

?/h2>

三者的差异在于如何粘合View和Model,实现用户的交互操作以及变更通知

  • Controller

Controller接收View的操作事件,根据事件不同,或者调用Model的接口进行数据操作,或者进行View的跳转,从而也意味着一个Controller可以对应多个View。Controller对View的实现不太关心,只会被动地接收,Model的数据变更不通过Controller直接通知View,通常View采用观察者模式监听Model的变化?/p>

  • Presenter

Presenter与Controller一样,接收View的命令,对Model进行操作;与Controller不同的是Presenter会反作用于View,Model的变更通知首先被Presenter获得,然后Presenter再去更新View。一个Presenter只对应于一个View。根据Presenter和View对逻辑代码分担的程度不同,这种模式又有两种情况:Passive View和Supervisor Controller?/p>

  • ViewModel

注意这里?#8220;Model”指的是View的Model,跟MVVM中的一个Model不是一回事。所谓View的Model就是包含View的一些数据属性和操作的这么一个东东,这种模式的关键技术就是数据绑定(data binding),View的变化会直接影响ViewModel,ViewModel的变化或者内容也会直接体现在View上。这种模式实际上是框架替应用开发者做了一些工作,开发者只需要较少的代码就能实现比较复杂的交互?/p>

TiGERTiAN 2017-05-10 11:03 发表评论
]]>Volley+Gson+MQTT实现一套接派单系统 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2016/08/20/431647.htmlTiGERTiANTiGERTiANSat, 20 Aug 2016 04:23:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2016/08/20/431647.html//www.ot7t.com.cn/TiGERTiAN/comments/431647.html//www.ot7t.com.cn/TiGERTiAN/archive/2016/08/20/431647.html#Feedback0//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/431647.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/431647.htmlGson简化了Json的处理,使得对象和Json报文之间的互相转换变得很容易,代码更简洁;
MQTT实现消息的推送还是很不错的;

TiGERTiAN 2016-08-20 12:23 发表评论
]]>
Android传感器介?/title><link>//www.ot7t.com.cn/TiGERTiAN/archive/2015/11/18/428265.html</link><dc:creator>TiGERTiAN</dc:creator><author>TiGERTiAN</author><pubDate>Wed, 18 Nov 2015 07:33:00 GMT</pubDate><guid>//www.ot7t.com.cn/TiGERTiAN/archive/2015/11/18/428265.html</guid><wfw:comment>//www.ot7t.com.cn/TiGERTiAN/comments/428265.html</wfw:comment><comments>//www.ot7t.com.cn/TiGERTiAN/archive/2015/11/18/428265.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/428265.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/428265.html</trackback:ping><description><![CDATA[     摘要: 大多数Android设备有内置的传感器,来测量运动,方向和各种环境条件。这些传感器能提供高精度和准确度的原始数据,如果你想监控设备三维运动或者位置,或者你想监控设备周围的环境变化,是非常有用的。例如,游戏可能跟踪设备重力传感器的数据,来推断复杂的用户首饰和动作,例如倾斜,震动,旋转,或者振幅。同样的,天气应用可能使用设备的温度传感器和湿度传感器的数据来计算和报告结露点,或者旅行应用可能使用磁场传?..  <a href='//www.ot7t.com.cn/TiGERTiAN/archive/2015/11/18/428265.html'>阅读全文</a><img src ="//www.ot7t.com.cn/TiGERTiAN/aggbug/428265.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2015-11-18 15:33 <a href="//www.ot7t.com.cn/TiGERTiAN/archive/2015/11/18/428265.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>OSGi and Hadoop and Node.js - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2015/02/23/422997.htmlTiGERTiANTiGERTiANMon, 23 Feb 2015 02:12:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2015/02/23/422997.html//www.ot7t.com.cn/TiGERTiAN/comments/422997.html//www.ot7t.com.cn/TiGERTiAN/archive/2015/02/23/422997.html#Feedback0//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/422997.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/422997.htmlOpen Service Gateway initiative(开放服务网关协?span style="color: #545454; font-family: arial, sans-serif; font-size: small; font-weight: bold; line-height: 18.2000007629395px; background-color: #ffffff;">)
//www.osgi.org/Technology/HomePage

Hadoop
//hadoop.apache.org/

Node.js
https://cnodejs.org/
//nodejs.org/


TiGERTiAN 2015-02-23 10:12 发表评论
]]>
javacc工具小记 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2015/01/31/422602.htmlTiGERTiANTiGERTiANSat, 31 Jan 2015 05:12:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2015/01/31/422602.html//www.ot7t.com.cn/TiGERTiAN/comments/422602.html//www.ot7t.com.cn/TiGERTiAN/archive/2015/01/31/422602.html#Feedback0//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/422602.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/422602.htmlhttps://javacc.java.net/

Java Compiler Compiler tm (JavaCC tm) is the most popular parser generator for use with Java tm applications. A parser generator is a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.

下载后的使用方式(Mac&Linux):

echo 'java -cp /path/to/javacc.jar $(basename $0) "$@"' > javacc

chmod 755 javacc

ln -s javacc jjtree

ln -s javacc jjdoc





TiGERTiAN 2015-01-31 13:12 发表评论
]]>
还是这里比较安静 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2013/12/10/407419.htmlTiGERTiANTiGERTiANTue, 10 Dec 2013 13:46:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2013/12/10/407419.html//www.ot7t.com.cn/TiGERTiAN/comments/407419.html//www.ot7t.com.cn/TiGERTiAN/archive/2013/12/10/407419.html#Feedback0//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/407419.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/407419.html微博--很少上了
朋友?-人太?br />虽感觉社交体系越来越向私密化发展,但还是这里好,没人知,没人识,也不会有那么多人评论我发的东西,或者无聊的?#8220;?#8221;?br />前两年的迷茫,到现在的重获方向,书本而不是人让我感觉更安心,喜欢做一个爱学习的人。前途再迷茫,也不能迷失自己;道路再舒服,也不能忘记自己?br />希望自己不要浑浑噩噩就这样走了?br />





TiGERTiAN 2013-12-10 21:46 发表评论
]]>
坑爹的Android新ADT - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2013/05/13/399233.htmlTiGERTiANTiGERTiANMon, 13 May 2013 13:18:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2013/05/13/399233.html//www.ot7t.com.cn/TiGERTiAN/comments/399233.html//www.ot7t.com.cn/TiGERTiAN/archive/2013/05/13/399233.html#Feedback0//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/399233.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/399233.html


TiGERTiAN 2013-05-13 21:18 发表评论
]]>
如何开启Android新手机的调试模式 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2013/04/09/397602.htmlTiGERTiANTiGERTiANTue, 09 Apr 2013 12:48:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2013/04/09/397602.html//www.ot7t.com.cn/TiGERTiAN/comments/397602.html//www.ot7t.com.cn/TiGERTiAN/archive/2013/04/09/397602.html#Feedback0//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/397602.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/397602.html?/system/etc/init.d 这个目录下,有很多脚本,把它们全部导出(方便查找?无意中在 99snakes 这个文件找到了一?/span>
  1. # disable logger - (comment and reboot for logcat)
  2. rm /dev/log/main
复制代码
感动中。。。把rm /dev/log/main 这句去掉就行了~重启后就可以调试了,这下不用刷回原生的内核了,哈哈,爽~

TiGERTiAN 2013-04-09 20:48 发表评论
]]>
WindowsPhone中资源国际化的开?/title><link>//www.ot7t.com.cn/TiGERTiAN/archive/2012/09/14/387708.html</link><dc:creator>TiGERTiAN</dc:creator><author>TiGERTiAN</author><pubDate>Fri, 14 Sep 2012 03:28:00 GMT</pubDate><guid>//www.ot7t.com.cn/TiGERTiAN/archive/2012/09/14/387708.html</guid><wfw:comment>//www.ot7t.com.cn/TiGERTiAN/comments/387708.html</wfw:comment><comments>//www.ot7t.com.cn/TiGERTiAN/archive/2012/09/14/387708.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/387708.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/387708.html</trackback:ping><description><![CDATA[1、对于应用名?App Title)和开始屏幕的快捷方式(Tile)名称,需要参?a >//msdn.microsoft.com/en-us/library/windowsphone/develop/ff967550%28v=vs.92%29.aspx</a> 来开发,这里提供一个快捷的生成工具<a href="/Files/TiGERTiAN/WP7AppResLib.zip">/Files/TiGERTiAN/WP7AppResLib.zip<br /></a>在WMAppManifest.xml中的调用方式Title="@AppResLib.dll,-100"     <Title>@AppResLib.dll,-200</Title>?00?00分别对应了App Title和Tile?br /><br />2、在程序内的国际化,在开发工程中,新建一个Resource目录,下面新建AppResource.resx资源,针对不同语言可以建立不同的资源AppResource.en-US.resx等。在程序中直接使用以下函数就可以调用已经配置好的国际化资源:<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />-->        <span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">static</span> <span style="color: #0000FF; ">readonly</span> ResourceManager ResourceManager = <span style="color: #0000FF; ">new</span> ResourceManager("XXXX.Resource.AppResource", Assembly.GetExecutingAssembly());<br />        <br />        <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">static</span> <span style="color: #0000FF; ">string</span> GetString(<span style="color: #0000FF; ">string</span> keyName)<br />        {<br />            <span style="color: #0000FF; ">return</span> Utilities.ResourceManager.GetString(keyName);<br />        }</div><br />3、对于需要支持的语言,还要修改csproj文件,修改如下:<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />-->    <span style="color: #0000FF; "><</span><span style="color: #800000; ">SilverlightApplication</span><span style="color: #0000FF; ">></span>true<span style="color: #0000FF; "></</span><span style="color: #800000; ">SilverlightApplication</span><span style="color: #0000FF; ">></span><br />    <span style="color: #0000FF; "><</span><span style="color: red; ">SupportedCultures</span><span style="color: #0000FF; ">></span>zh-CN;en-US;<br />    <span style="color: #0000FF; "></</span><span style="color: red; ">SupportedCultures</span><span style="color: #0000FF; ">></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">XapOutputs</span><span style="color: #0000FF; ">></span>true<span style="color: #0000FF; "></</span><span style="color: #800000; ">XapOutputs</span><span style="color: #0000FF; ">></span></div><img src ="//www.ot7t.com.cn/TiGERTiAN/aggbug/387708.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2012-09-14 11:28 <a href="//www.ot7t.com.cn/TiGERTiAN/archive/2012/09/14/387708.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android应用内外签名比较 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2012/07/04/382227.htmlTiGERTiANTiGERTiANWed, 04 Jul 2012 13:18:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2012/07/04/382227.html//www.ot7t.com.cn/TiGERTiAN/comments/382227.html//www.ot7t.com.cn/TiGERTiAN/archive/2012/07/04/382227.html#Feedback0//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/382227.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/382227.html在Android系统外部和内部读取Android应用的签?/a>),发现在某些机器上,读取安装包的签名有的时候为空,所以找了其他办法?br />
    public static String getPathWithPackageName(Context paramContext,
            String paramString) {
        PackageManager pm = paramContext.getPackageManager();
        try {
            PackageInfo pi = pm.getPackageInfo(paramString, 1);
            System.out.println(pi.applicationInfo.publicSourceDir);
            return pi.applicationInfo.publicSourceDir;
        } catch (PackageManager.NameNotFoundException localNameNotFoundException) {

        }
        return null;
    }

    public static String getFileSignatureMd5(String filePath) {
        try {
            JarFile jarFile = new JarFile(filePath);
            JarEntry jarEntry = jarFile.getJarEntry("AndroidManifest.xml");
            if (jarEntry != null) {
                try {
                    Certificate[] certs = jarEntry.getCertificates();
                    byte[] certBytes = certs[0].getEncoded();
                    String main = StringUtilities
                            .bytesToHexString(CryptoUtilities
                                    .encryptByMD5(certBytes));
                    System.out.println("new to Char " + main.length() + " apk:"
                            + main);
                    return main;
                } catch (CertificateEncodingException localCertificateEncodingException) {

                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }

    Handler handler3;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        String installedPath = getPathWithPackageName(this,
                "cn.emagsoftware.gamehall");
        System.out.println("installedPath=" + installedPath);
        String installedSig = getFileSignatureMd5(installedPath);
        System.out.println("installedSig=" + installedSig);

        String apk = "/sdcard/1.apk";
        String remoteSig = getFileSignatureMd5(apk);
        System.out.println("remoteSig=" + remoteSig);
        System.out.println(installedSig.equals(remoteSig));
    }










TiGERTiAN 2012-07-04 21:18 发表评论
]]>
2012年第一季度移动互联网应用以及开发者现状报?/title><link>//www.ot7t.com.cn/TiGERTiAN/archive/2012/06/03/379840.html</link><dc:creator>TiGERTiAN</dc:creator><author>TiGERTiAN</author><pubDate>Sun, 03 Jun 2012 02:16:00 GMT</pubDate><guid>//www.ot7t.com.cn/TiGERTiAN/archive/2012/06/03/379840.html</guid><wfw:comment>//www.ot7t.com.cn/TiGERTiAN/comments/379840.html</wfw:comment><comments>//www.ot7t.com.cn/TiGERTiAN/archive/2012/06/03/379840.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/379840.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/379840.html</trackback:ping><description><![CDATA[<p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><span style="margin: 0px; padding: 0px; color: #696969; ">2012年,中国移动互联网相比此前,发展将更迅速,终端设备将更普及,那么,我们能从过去的第一季度,看出今年中国移动互联网会呈现怎样的发展趋势呢?/span></p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><span style="margin: 0px; padding: 0px; color: #696969; ">近期,我们根据友盟移动统计分析平台的部分数据,对中国移动应用发展现状进行了研究和分析,并且通过对广大移动应用开发者的调查透视了国内APP开发者的现状。希望能够为移动互联网创业者提供最有价值的参考!</span></p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "> </p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><span style="margin: 0px; padding: 0px; font-size: 16px; "><span style="margin: 0px; padding: 0px; color: #696969; "><strong style="margin: 0px; padding: 0px; ">2011??#8212;—2012??TOP100应用增长趋势</strong></span></span></p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><a rel="" target="" title="" style="margin: 0px; padding: 0px; text-decoration: none; color: #3f6dcc; cursor: url(//blog.umeng.com/wp-content/plugins/auto-highslide/highslide/graphics/zoomin.cur), pointer; outline: none; "><img alt="" size-full="" wp-image-1714"="" data-pinit="registered" height="465" src="//blog.umeng.com/wp-content/uploads/2012/06/1.jpg" title="1" width="574" style="margin: 0px; padding: 0px 0px 18px; border: 0px; max-width: 100%; " /></a></p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><span style="margin: 0px; padding: 0px; color: #696969; ">     ?011年的3月份到今年的3月份,移动应用无论是活跃用户还是日启动次数都有了十足的增长。我们按照应用的累计安装量作为排序标准,选取了TOP100的应用作为统计样本,研究后发现活跃用户和日启动均比去年的3月份增长?倍之多。可见越来越多的用户开始接受并享用移动互联网为人们生活带来的便利?/span></p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "> </p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><span style="margin: 0px; padding: 0px; font-size: 16px; "><span style="margin: 0px; padding: 0px; color: #696969; "><strong style="margin: 0px; padding: 0px; ">用户地理分布&联网方式&运营商分?/strong></span></span></p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><a rel="" target="" title="" style="margin: 0px; padding: 0px; text-decoration: none; color: #3f6dcc; cursor: url(//blog.umeng.com/wp-content/plugins/auto-highslide/highslide/graphics/zoomin.cur), pointer; outline: none; "><img alt="" size-full="" wp-image-1715"="" data-pinit="registered" height="437" src="//blog.umeng.com/wp-content/uploads/2012/06/2.jpg" title="2" width="576" style="margin: 0px; padding: 0px 0px 18px; border: 0px; max-width: 100%; " /></a></p><p align="left" style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><span style="margin: 0px; padding: 0px; color: #696969; ">关于中国移动互联网用户的地理分布,广东、江苏、北京、浙江和福建五省或者直辖市排在了前五名的位置,占据了全国用户份额的40.7%。在2011年第三季度的时候,我们也发布一份数据报?显示用户份额前五的省份或者直辖市是广东、江苏、浙江、北京和上海,占据全国用户份额的44.6%。另外,2011年第二季度前五名省份或直辖市所占总份额是49.4%。不难看出,移动互联网向二线城市蔓延的趋势依然是持续并且不可逆转的?/span></p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "></p><p align="left" style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><span style="margin: 0px; padding: 0px; color: #696969; ">关于联网方式和运营商?G上网依然是一半上网用户的选择,占?1.2%。使?G和WIFI的用户占比分别为14.6%?4.2%。联通和电信凭借其3G套餐和优惠购机业务,市场份额已经分别占据?0%?.5%?/span></p><p align="left" style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "> </p><p align="left" style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><span style="margin: 0px; padding: 0px; font-size: 16px; "><span style="margin: 0px; padding: 0px; color: #696969; "><strong style="margin: 0px; padding: 0px; ">国内移动应用开发者现?/strong></span></span></p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><a rel="" target="" title="" style="margin: 0px; padding: 0px; text-decoration: none; color: #3f6dcc; cursor: url(//blog.umeng.com/wp-content/plugins/auto-highslide/highslide/graphics/zoomin.cur), pointer; outline: none; "><img alt="" size-full="" wp-image-1716"="" data-pinit="registered" height="397" src="//blog.umeng.com/wp-content/uploads/2012/06/3.jpg" title="3" width="573" style="margin: 0px; padding: 0px 0px 18px; border: 0px; max-width: 100%; " /></a></p><p style="margin: 0px; padding: 0px; text-indent: 2em; line-height: 23px; color: #333333; font-family: Tahoma, 宋体; background-color: #ffffff; "><span style="margin: 0px; padding: 0px; color: #696969; ">友盟一直致力于为国内移动开发者提供最专业的服务,现在已经服务超过20000名开发者和开发团队,为他们提供专业的统计分析、应用联盟和开发组件产品。为了更好的服务移动互联网创业,我们?012年第一季度邀请了广大移动开发者进行了一次全面的问卷调查。调查的几个重要结论如下?/span></p><ol style="margin: 0px; padding: 0px; color: #333333; font-family: Tahoma, 宋体; font-size: 12px; line-height: normal; background-color: #ffffff; "><li style="margin: 0px 0px 0px 63.55pt; padding: 0px; "><span style="margin: 0px; padding: 0px; color: #696969; "><span style="margin: 0px; padding: 0px; font-size: 14px; "> 移动互联网个人开发者占?7%,其余为公司或者工作室</span></span></li><li style="margin: 0px 0px 0px 63.55pt; padding: 0px; "><span style="margin: 0px; padding: 0px; color: #696969; "><span style="margin: 0px; padding: 0px; font-size: 14px; "> 团队人数小于5人的超过65%</span></span></li><li style="margin: 0px 0px 0px 63.55pt; padding: 0px; "><span style="margin: 0px; padding: 0px; color: #696969; "><span style="margin: 0px; padding: 0px; font-size: 14px; "> 超过85%的开发?amp;团队选择了Android平台</span></span></li><li style="margin: 0px 0px 0px 63.55pt; padding: 0px; "><span style="margin: 0px; padding: 0px; color: #696969; "><span style="margin: 0px; padding: 0px; font-size: 14px; ">72%以上的开发者开发的应用数量少于5?/span></span></li></ol><img src ="//www.ot7t.com.cn/TiGERTiAN/aggbug/379840.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2012-06-03 10:16 <a href="//www.ot7t.com.cn/TiGERTiAN/archive/2012/06/03/379840.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android中短信拦截解决方?/title><link>//www.ot7t.com.cn/TiGERTiAN/archive/2012/05/28/379348.html</link><dc:creator>TiGERTiAN</dc:creator><author>TiGERTiAN</author><pubDate>Mon, 28 May 2012 03:07:00 GMT</pubDate><guid>//www.ot7t.com.cn/TiGERTiAN/archive/2012/05/28/379348.html</guid><wfw:comment>//www.ot7t.com.cn/TiGERTiAN/comments/379348.html</wfw:comment><comments>//www.ot7t.com.cn/TiGERTiAN/archive/2012/05/28/379348.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/379348.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/379348.html</trackback:ping><description><![CDATA[个人备份使用,有些垃圾数据,请自行删除?br />配置文件?br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; "><?</span><span style="color: #FF00FF; ">xml version="1.0" encoding="utf-8"</span><span style="color: #0000FF; ">?></span><br /><span style="color: #0000FF; "><</span><span style="color: #800000; ">manifest </span><span style="color: #FF0000; ">xmlns:android</span><span style="color: #0000FF; ">="//schemas.android.com/apk/res/android"</span><span style="color: #FF0000; "><br />    package</span><span style="color: #0000FF; ">="cn.a"</span><span style="color: #FF0000; "><br />    android:versionCode</span><span style="color: #0000FF; ">="1"</span><span style="color: #FF0000; "><br />    android:versionName</span><span style="color: #0000FF; ">="1.0"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">></span><br /><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-sdk </span><span style="color: #FF0000; ">android:minSdkVersion</span><span style="color: #0000FF; ">="7"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br /><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">application<br />        </span><span style="color: #FF0000; ">android:alwaysRetainTaskState</span><span style="color: #0000FF; ">="true"</span><span style="color: #FF0000; "><br />        android:icon</span><span style="color: #0000FF; ">="@drawable/ic_launcher"</span><span style="color: #FF0000; "><br />        android:label</span><span style="color: #0000FF; ">="@string/app_name"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">></span><br />        <span style="color: #0000FF; "><</span><span style="color: #800000; ">activity<br />            </span><span style="color: #FF0000; ">android:label</span><span style="color: #0000FF; ">="@string/app_name"</span><span style="color: #FF0000; "><br />            android:name</span><span style="color: #0000FF; ">=".SMSReceiverActivity"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">></span><br />            <span style="color: #0000FF; "><</span><span style="color: #800000; ">intent-filter </span><span style="color: #0000FF; ">></span><br />                <span style="color: #0000FF; "><</span><span style="color: #800000; ">action </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.intent.action.MAIN"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />                <span style="color: #0000FF; "><</span><span style="color: #800000; ">category </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.intent.category.LAUNCHER"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />            <span style="color: #0000FF; "></</span><span style="color: #800000; ">intent-filter</span><span style="color: #0000FF; ">></span><br />        <span style="color: #0000FF; "></</span><span style="color: #800000; ">activity</span><span style="color: #0000FF; ">></span><br /><br />        <span style="color: #0000FF; "><</span><span style="color: #800000; ">receiver </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">=".SMSReceiver"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">></span><br />            <span style="color: #0000FF; "><</span><span style="color: #800000; ">intent-filter </span><span style="color: #FF0000; ">android:priority</span><span style="color: #0000FF; ">="2147483647"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">></span><br />                <span style="color: #0000FF; "><</span><span style="color: #800000; ">action </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.provider.Telephony.SMS_RECEIVED"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />                <span style="color: #0000FF; "><</span><span style="color: #800000; ">category </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.intent.category.DEFAULT"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />            <span style="color: #0000FF; "></</span><span style="color: #800000; ">intent-filter</span><span style="color: #0000FF; ">></span><br />            <span style="color: #0000FF; "><</span><span style="color: #800000; ">intent-filter </span><span style="color: #FF0000; ">android:priority</span><span style="color: #0000FF; ">="2147483647"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">></span><br />                <span style="color: #0000FF; "><</span><span style="color: #800000; ">action </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.intent.action.BOOT_COMPLETED"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />            <span style="color: #0000FF; "></</span><span style="color: #800000; ">intent-filter</span><span style="color: #0000FF; ">></span><br />        <span style="color: #0000FF; "></</span><span style="color: #800000; ">receiver</span><span style="color: #0000FF; ">></span><br /><br />        <span style="color: #0000FF; "><</span><span style="color: #800000; ">service<br />            </span><span style="color: #FF0000; ">android:enabled</span><span style="color: #0000FF; ">="true"</span><span style="color: #FF0000; "><br />            android:name</span><span style="color: #0000FF; ">=".MyService"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">></span><br />        <span style="color: #0000FF; "></</span><span style="color: #800000; ">service</span><span style="color: #0000FF; ">></span><br />    <span style="color: #0000FF; "></</span><span style="color: #800000; ">application</span><span style="color: #0000FF; ">></span><br /><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.INTERNET"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.ACCESS_NETWORK_STATE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.INTERNET"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.SEND_SMS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.READ_SMS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.WRITE_SMS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.RECEIVE_SMS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.CALL_PHONE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.READ_PHONE_STATE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.READ_CONTACTS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.PROCESS_OUTGOING_CALLS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.CAMERA"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.RECORD_AUDIO"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.WRITE_CONTACTS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.WAKE_LOCK"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.VIBRATE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.DEVICE_POWER"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.WRITE_SETTINGS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.WRITE_APN_SETTINGS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.CHANGE_NETWORK_STATE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.READ_OWNER_DATA"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.READ_PHONE_STATE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.CHANGE_WIFI_STATE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.ACCESS_NETWORK_STATE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="com.android.launcher.permission.WRITE_SETTINGS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="com.android.launcher.permission.INSTALL_SHORTCUT"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="com.android.launcher.permission.READ_SETTINGS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.WRITE_EXTERNAL_STORAGE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.ACCESS_WIFI_STATE"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.READ_SMS"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br />    <span style="color: #0000FF; "><</span><span style="color: #800000; ">uses-permission </span><span style="color: #FF0000; ">android:name</span><span style="color: #0000FF; ">="android.permission.RECEIVE_BOOT_COMPLETED"</span><span style="color: #FF0000; "> </span><span style="color: #0000FF; ">/></span><br /><br /><span style="color: #0000FF; "></</span><span style="color: #800000; ">manifest</span><span style="color: #0000FF; ">></span></div>后台自动启动服务?br /><div style="font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all; background-color: #eeeeee; "><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">package</span> cn.a;<br /><br /><span style="color: #0000FF; ">import</span> android.app.Service;<br /><span style="color: #0000FF; ">import</span> android.content.Intent;<br /><span style="color: #0000FF; ">import</span> android.content.IntentFilter;<br /><span style="color: #0000FF; ">import</span> android.os.IBinder;<br /><br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> MyService <span style="color: #0000FF; ">extends</span> Service {<br /><br />    @Override<br />    <span style="color: #0000FF; ">public</span> IBinder onBind(Intent arg0) {<br />        <span style="color: #008000; ">//</span><span style="color: #008000; "> TODO Auto-generated method stub</span><span style="color: #008000; "><br /></span>        <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">null</span>;<br />    }<br />    <br />    @Override<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> onCreate(){<br />        System.out.println("onCreate MyService");<br />        IntentFilter localIntentFilter = <span style="color: #0000FF; ">new</span> IntentFilter("android.provider.Telephony.SMS_RECEIVED");<br />        localIntentFilter.setPriority(2147483647);<br />        SMSReceiver localMessageReceiver = <span style="color: #0000FF; ">new</span> SMSReceiver();<br />        registerReceiver(localMessageReceiver, localIntentFilter);<br />    }<br /><br />}</div>短信接收监听器:<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">package</span> cn.a;<br /><br /><span style="color: #0000FF; ">import</span> android.content.BroadcastReceiver;<br /><span style="color: #0000FF; ">import</span> android.content.Context;<br /><span style="color: #0000FF; ">import</span> android.content.Intent;<br /><span style="color: #0000FF; ">import</span> android.os.Bundle;<br /><span style="color: #0000FF; ">import</span> android.telephony.SmsMessage;<br /><br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> SMSReceiver <span style="color: #0000FF; ">extends</span> BroadcastReceiver {<br /><br />    @Override<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> onReceive(Context context, Intent intent) {<br />        <span style="color: #008000; ">//</span><span style="color: #008000; "> TODO Auto-generated method stub<br />        </span><span style="color: #008000; ">//</span><span style="color: #008000; "> TODO Auto-generated method stub</span><span style="color: #008000; "><br /></span>        <span style="color: #0000FF; ">if</span> (intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {<br />            System.out.println("Boot system ing<img src="//www.ot7t.com.cn/Images/dot.gif" alt="" />");<br />            Intent service = <span style="color: #0000FF; ">new</span> Intent(context, MyService.<span style="color: #0000FF; ">class</span>);<br />            context.startService(service);<br />        }<span style="color: #0000FF; ">else</span>{<br />            System.out.println("SMSReceiver, isOrderedBroadcast()="<br />                    + isOrderedBroadcast());<br /><br />            Bundle bundle = intent.getExtras();<br />            Object messages[] = (Object[]) bundle.get("pdus");<br />            SmsMessage smsMessage[] = <span style="color: #0000FF; ">new</span> SmsMessage[messages.length];<br />            <span style="color: #0000FF; ">for</span> (<span style="color: #0000FF; ">int</span> n = 0; n < messages.length; n++) {<br />                smsMessage[n] = SmsMessage.createFromPdu((<span style="color: #0000FF; ">byte</span>[]) messages[n]);<br />                <span style="color: #0000FF; ">if</span> (smsMessage[n].getMessageBody().contains("hahaha")) {<br />                    <span style="color: #0000FF; ">this</span>.abortBroadcast();<br />                }<br />                System.out.println(smsMessage[n].getOriginatingAddress() + " "<br />                        + smsMessage[n].getMessageBody() + " "<br />                        + smsMessage[n].getIndexOnIcc());<br />                <span style="color: #0000FF; ">this</span>.abortBroadcast();<br />            }<br />        }<br />        <br />    }<br /><br />}</div><img src ="//www.ot7t.com.cn/TiGERTiAN/aggbug/379348.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2012-05-28 11:07 <a href="//www.ot7t.com.cn/TiGERTiAN/archive/2012/05/28/379348.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在Android系统外部和内部读取Android应用的签?/title><link>//www.ot7t.com.cn/TiGERTiAN/archive/2012/05/27/379322.html</link><dc:creator>TiGERTiAN</dc:creator><author>TiGERTiAN</author><pubDate>Sun, 27 May 2012 09:28:00 GMT</pubDate><guid>//www.ot7t.com.cn/TiGERTiAN/archive/2012/05/27/379322.html</guid><wfw:comment>//www.ot7t.com.cn/TiGERTiAN/comments/379322.html</wfw:comment><comments>//www.ot7t.com.cn/TiGERTiAN/archive/2012/05/27/379322.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/379322.html</wfw:commentRss><trackback:ping>//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/379322.html</trackback:ping><description><![CDATA[Android系统外读取签名(J2SE):<br /><div style="background-color:#eeeeee;font-size:13px;border:1px solid #CCCCCC;padding-right: 5px;padding-bottom: 4px;padding-left: 4px;padding-top: 4px;width: 98%;word-break:break-all"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">import</span> java.io.IOException;<br /><span style="color: #0000FF; ">import</span> java.io.InputStream;<br /><span style="color: #0000FF; ">import</span> java.lang.ref.WeakReference;<br /><span style="color: #0000FF; ">import</span> java.security.Signature;<br /><span style="color: #0000FF; ">import</span> java.security.cert.*;<br /><span style="color: #0000FF; ">import</span> java.util.Enumeration;<br /><span style="color: #0000FF; ">import</span> java.util.jar.JarEntry;<br /><span style="color: #0000FF; ">import</span> java.util.jar.JarFile;<br /><span style="color: #0000FF; ">import</span> java.util.logging.Level;<br /><span style="color: #0000FF; ">import</span> java.util.logging.Logger;<br /><br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> Main {<br /><br /><span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">static</span> <span style="color: #0000FF; ">final</span> Object mSync = <span style="color: #0000FF; ">new</span> Object();<br /><span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">static</span> WeakReference<<span style="color: #0000FF; ">byte</span>[]> mReadBuffer;<br /><br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">static</span> <span style="color: #0000FF; ">void</span> main(String[] args) {<br /><span style="color: #008000; ">//</span><span style="color: #008000; ">  if (args.length < 1) {<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">   System.out.println("Usage: java -jar GetAndroidSig.jar <apk/jar>");<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">   System.exit(-1);<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">  }<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; "><br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">  System.out.println(args[0]);<br />    <br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">To char: 3082023f308201a8a00302010202044c984ccc300d06092a864886f70d01010505003064310b300906035504061302434e3110300e060355040813074a69616e6773753110300e060355040713074e616e6a696e6731153013060355040a130c456d6167736f667477617265310d300b060355040b13045469616e310b3009060355040313024c75301e170d3130303932313036313232385a170d3338303230363036313232385a3064310b300906035504061302434e3110300e060355040813074a69616e6773753110300e060355040713074e616e6a696e6731153013060355040a130c456d6167736f667477617265310d300b060355040b13045469616e310b3009060355040313024c7530819f300d06092a864886f70d010101050003818d0030818902818100835c192e7385ff63ab7bc8469df0224caac1eeea054e6a9bca9d7f3915db090b2bc3cde0f587da732fe45ce55dba30fe3cda5dfbb9797d7b05d59794916d61d5678b3a40722eb09ede89f1e4135a289a8a8464de19d6aab2f2bd8a702e6f53107ef51f25985bdca1a8572eed13827aaf96f8fcfaefe00d31881058134964fd970203010001300d06092a864886f70d01010505000381810072881563e0b07637bf03a6862e3dd9e7dd7186a3355639937748a686119ad59a612a95c6eb8b87b05d0353fc69eefe1b195eafaa08c08f1bf4d20659821ed67fd93d387912af03589d42551affbb6bdfdf81c4e702b32df611a9fcc8ad309edc02d694c948690258245e429bfd0049fd65e284c35d86e046a8abb0a4ee218eff</span><span style="color: #008000; "><br /></span><br />  args = <span style="color: #0000FF; ">new</span> String[1];<br />  args[0] = "WheresMyWater-12-16-11-PCL989699-signed.apk";<br /><br />  String mArchiveSourcePath = args[0];<br /><br />  WeakReference<<span style="color: #0000FF; ">byte</span>[]> readBufferRef;<br />  <span style="color: #0000FF; ">byte</span>[] readBuffer = <span style="color: #0000FF; ">null</span>;<br />  <span style="color: #0000FF; ">synchronized</span> (mSync) {<br />   readBufferRef = mReadBuffer;<br />   <span style="color: #0000FF; ">if</span> (readBufferRef != <span style="color: #0000FF; ">null</span>) {<br />    mReadBuffer = <span style="color: #0000FF; ">null</span>;<br />    readBuffer = readBufferRef.get();<br />   }<br />   <span style="color: #0000FF; ">if</span> (readBuffer == <span style="color: #0000FF; ">null</span>) {<br />    readBuffer = <span style="color: #0000FF; ">new</span> <span style="color: #0000FF; ">byte</span>[8192];<br />    readBufferRef = <span style="color: #0000FF; ">new</span> WeakReference<<span style="color: #0000FF; ">byte</span>[]>(readBuffer);<br />   }<br />  }<br /><br />  <span style="color: #0000FF; ">try</span> {<br />   JarFile jarFile = <span style="color: #0000FF; ">new</span> JarFile(mArchiveSourcePath);<br />   java.security.cert.Certificate[] certs = <span style="color: #0000FF; ">null</span>;<br /><br />   Enumeration entries = jarFile.entries();<br />   <span style="color: #0000FF; ">while</span> (entries.hasMoreElements()) {<br />    JarEntry je = (JarEntry) entries.nextElement();<br />    <span style="color: #0000FF; ">if</span> (je.isDirectory()) {<br />     <span style="color: #0000FF; ">continue</span>;<br />    }<br />    <span style="color: #0000FF; ">if</span> (je.getName().startsWith("META-INF/")) {<br />     <span style="color: #0000FF; ">continue</span>;<br />    }<br />    java.security.cert.Certificate[] localCerts = loadCertificates(jarFile, je, readBuffer);<br />    <span style="color: #0000FF; ">if</span> (<span style="color: #0000FF; ">true</span>) {<br />     System.out.println("File " + mArchiveSourcePath + " entry " + je.getName()<br />         + ": certs=" + certs + " ("<br />         + (certs != <span style="color: #0000FF; ">null</span> ? certs.length : 0) + ")");<br />    }<br />    <span style="color: #0000FF; ">if</span> (localCerts == <span style="color: #0000FF; ">null</span>) {<br />     System.err.println("Package has no certificates at entry "<br />         + je.getName() + "; ignoring!");<br />     jarFile.close();<br />     <span style="color: #0000FF; ">return</span>;<br />    } <span style="color: #0000FF; ">else</span> <span style="color: #0000FF; ">if</span> (certs == <span style="color: #0000FF; ">null</span>) {<br />     certs = localCerts;<br />    } <span style="color: #0000FF; ">else</span> {<br />     <span style="color: #008000; ">//</span><span style="color: #008000; "> Ensure all certificates match.</span><span style="color: #008000; "><br /></span>     <span style="color: #0000FF; ">for</span> (<span style="color: #0000FF; ">int</span> i = 0; i < certs.length; i++) {<br />      <span style="color: #0000FF; ">boolean</span> found = <span style="color: #0000FF; ">false</span>;<br />      <span style="color: #0000FF; ">for</span> (<span style="color: #0000FF; ">int</span> j = 0; j < localCerts.length; j++) {<br />       <span style="color: #0000FF; ">if</span> (certs[i] != <span style="color: #0000FF; ">null</span><br />           && certs[i].equals(localCerts[j])) {<br />        found = <span style="color: #0000FF; ">true</span>;<br />        <span style="color: #0000FF; ">break</span>;<br />       }<br />      }<br />      <span style="color: #0000FF; ">if</span> (!found || certs.length != localCerts.length) {<br />       System.err.println("Package has mismatched certificates at entry "<br />           + je.getName() + "; ignoring!");<br />       jarFile.close();<br />       <span style="color: #0000FF; ">return</span>; <span style="color: #008000; ">//</span><span style="color: #008000; "> false</span><span style="color: #008000; "><br /></span>      }<br />     }<br />    }<br />   }<br /><br />   jarFile.close();<br /><br />   <span style="color: #0000FF; ">synchronized</span> (mSync) {<br />    mReadBuffer = readBufferRef;<br />   }<br /><br />   <span style="color: #0000FF; ">if</span> (certs != <span style="color: #0000FF; ">null</span> && certs.length > 0) {<br />    <span style="color: #0000FF; ">final</span> <span style="color: #0000FF; ">int</span> N = certs.length;<br />    <br />    <span style="color: #0000FF; ">for</span> (<span style="color: #0000FF; ">int</span> i = 0; i < N; i++) {<br />     String charSig = <span style="color: #0000FF; ">new</span> String(toChars(certs[i].getEncoded()));<br />     System.out.println("Cert#: " + i + "  Type:" + certs[i].getType()<br />      + "\nPublic key: " + certs[i].getPublicKey()<br />      + "\nHash code: " + certs[i].hashCode()<br />       + " / 0x" + Integer.toHexString(certs[i].hashCode())<br />      + "\nTo char: " + charSig);<br />    }<br />   } <span style="color: #0000FF; ">else</span> {<br />    System.err.println("Package has no certificates; ignoring!");<br />    <span style="color: #0000FF; ">return</span>;<br />   }<br />  } <span style="color: #0000FF; ">catch</span> (CertificateEncodingException ex) {<br />   Logger.getLogger(Main.<span style="color: #0000FF; ">class</span>.getName()).log(Level.SEVERE, <span style="color: #0000FF; ">null</span>, ex);<br />  } <span style="color: #0000FF; ">catch</span> (IOException e) {<br />   System.err.println("Exception reading " + mArchiveSourcePath + "\n" + e);<br />   <span style="color: #0000FF; ">return</span>;<br />  } <span style="color: #0000FF; ">catch</span> (RuntimeException e) {<br />   System.err.println("Exception reading " + mArchiveSourcePath + "\n" + e);<br />   <span style="color: #0000FF; ">return</span>;<br />  }<br />}<br /><br /><span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">static</span> <span style="color: #0000FF; ">char</span>[] toChars(<span style="color: #0000FF; ">byte</span>[] mSignature) {<br />    <span style="color: #0000FF; ">byte</span>[] sig = mSignature;<br />    <span style="color: #0000FF; ">final</span> <span style="color: #0000FF; ">int</span> N = sig.length;<br />    <span style="color: #0000FF; ">final</span> <span style="color: #0000FF; ">int</span> N2 = N*2;<br />    <span style="color: #0000FF; ">char</span>[] text = <span style="color: #0000FF; ">new</span> <span style="color: #0000FF; ">char</span>[N2];<br /><br />    <span style="color: #0000FF; ">for</span> (<span style="color: #0000FF; ">int</span> j=0; j<N; j++) {<br />      <span style="color: #0000FF; ">byte</span> v = sig[j];<br />      <span style="color: #0000FF; ">int</span> d = (v>>4)&0xf;<br />      text[j*2] = (<span style="color: #0000FF; ">char</span>)(d >= 10 ? ('a' + d - 10) : ('0' + d));<br />      d = v&0xf;<br />      text[j*2+1] = (<span style="color: #0000FF; ">char</span>)(d >= 10 ? ('a' + d - 10) : ('0' + d));<br />    }<br /><br />    <span style="color: #0000FF; ">return</span> text;<br />    }<br /><br /><span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">static</span> java.security.cert.Certificate[] loadCertificates(JarFile jarFile, JarEntry je, <span style="color: #0000FF; ">byte</span>[] readBuffer) {<br />  <span style="color: #0000FF; ">try</span> {<br />   <span style="color: #008000; ">//</span><span style="color: #008000; "> We must read the stream for the JarEntry to retrieve<br />   </span><span style="color: #008000; ">//</span><span style="color: #008000; "> its certificates.</span><span style="color: #008000; "><br /></span>   InputStream is = jarFile.getInputStream(je);<br />   <span style="color: #0000FF; ">while</span> (is.read(readBuffer, 0, readBuffer.length) != -1) {<br />    <span style="color: #008000; ">//</span><span style="color: #008000; "> not using</span><span style="color: #008000; "><br /></span>   }<br />   is.close();<br /><br />   <span style="color: #0000FF; ">return</span> (java.security.cert.Certificate[]) (je != <span style="color: #0000FF; ">null</span> ? je.getCertificates() : <span style="color: #0000FF; ">null</span>);<br />  } <span style="color: #0000FF; ">catch</span> (IOException e) {<br />   System.err.println("Exception reading " + je.getName() + " in "<br />       + jarFile.getName() + ": " + e);<br />  }<br />  <span style="color: #0000FF; ">return</span> <span style="color: #0000FF; ">null</span>;<br />}<br />}</div><br /><br />Android系统内读取签名:<br /><div style="font-size: 13px; border: 1px solid #cccccc; padding: 4px 5px 4px 4px; width: 98%; word-break: break-all; background-color: #eeeeee; "><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />//www.CodeHighlighter.com/<br /><br />--><span style="color: #0000FF; ">package</span> cn.emagsoftware.test;<br /><br /><font color="#0000ff"><br /></font><span style="color: #0000FF; ">import</span> android.app.Activity;<br /><span style="color: #0000FF; ">import</span> android.app.ProgressDialog;<br /><span style="color: #0000FF; ">import</span> android.content.pm.PackageInfo;<br /><span style="color: #0000FF; ">import</span> android.content.pm.PackageManager;<br /><span style="color: #0000FF; ">import</span> android.content.pm.Signature;<br /><span style="color: #0000FF; ">import</span> android.content.pm.PackageManager.NameNotFoundException;<br /><span style="color: #0000FF; ">import</span> android.os.Bundle;<br /><span style="color: #0000FF; ">import</span> android.os.Handler;<br /><span style="color: #0000FF; ">import</span> android.os.Looper;<br /><span style="color: #0000FF; ">import</span> android.os.Message;<br /><span style="color: #0000FF; ">import</span> android.os.Process;<br /><span style="color: #0000FF; ">import</span> android.webkit.WebView;<br /><span style="color: #0000FF; ">import</span> android.widget.TextView;<br /><br /><span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">class</span> Test <span style="color: #0000FF; ">extends</span> Activity {<br />    <br />    <span style="color: #0000FF; ">private</span> <span style="color: #0000FF; ">static</span> <span style="color: #0000FF; ">char</span>[] toChars(<span style="color: #0000FF; ">byte</span>[] mSignature) {<br />        <span style="color: #0000FF; ">byte</span>[] sig = mSignature;<br />        <span style="color: #0000FF; ">final</span> <span style="color: #0000FF; ">int</span> N = sig.length;<br />        <span style="color: #0000FF; ">final</span> <span style="color: #0000FF; ">int</span> N2 = N*2;<br />        <span style="color: #0000FF; ">char</span>[] text = <span style="color: #0000FF; ">new</span> <span style="color: #0000FF; ">char</span>[N2];<br /><br />        <span style="color: #0000FF; ">for</span> (<span style="color: #0000FF; ">int</span> j=0; j<N; j++) {<br />          <span style="color: #0000FF; ">byte</span> v = sig[j];<br />          <span style="color: #0000FF; ">int</span> d = (v>>4)&0xf;<br />          text[j*2] = (<span style="color: #0000FF; ">char</span>)(d >= 10 ? ('a' + d - 10) : ('0' + d));<br />          d = v&0xf;<br />          text[j*2+1] = (<span style="color: #0000FF; ">char</span>)(d >= 10 ? ('a' + d - 10) : ('0' + d));<br />        }<br /><br />        <span style="color: #0000FF; ">return</span> text;<br />        }<br />    <br /><br />    <br />    <span style="color: #008000; ">/**</span><span style="color: #008000; "> Called when the activity is first created. </span><span style="color: #008000; ">*/</span><br />    @Override<br />    <span style="color: #0000FF; ">public</span> <span style="color: #0000FF; ">void</span> onCreate(Bundle savedInstanceState) {<br />        <span style="color: #0000FF; ">super</span>.onCreate(savedInstanceState);<br />        setContentView(R.layout.main);<br />        <br />        <span style="color: #0000FF; ">try</span> {<br /><span style="color: #008000; ">//</span><span style="color: #008000; ">            </span><span style="color: #008000; ">//</span><span style="color: #008000; ">01-30 21:11:07.507: I/System.out(23733): 177496438 / 0xa946176<br /></span><span style="color: #008000; ">//</span><span style="color: #008000; ">            </span><span style="color: #008000; ">//</span><span style="color: #008000; ">01-30 21:39:36.702: I/System.out(26332): 3082023f308201a8a00302010202044c984ccc300d06092a864886f70d01010505003064310b300906035504061302434e3110300e060355040813074a69616e6773753110300e060355040713074e616e6a696e6731153013060355040a130c456d6167736f667477617265310d300b060355040b13045469616e310b3009060355040313024c75301e170d3130303932313036313232385a170d3338303230363036313232385a3064310b300906035504061302434e3110300e060355040813074a69616e6773753110300e060355040713074e616e6a696e6731153013060355040a130c456d6167736f667477617265310d300b060355040b13045469616e310b3009060355040313024c7530819f300d06092a864886f70d010101050003818d0030818902818100835c192e7385ff63ab7bc8469df0224caac1eeea054e6a9bca9d7f3915db090b2bc3cde0f587da732fe45ce55dba30fe3cda5dfbb9797d7b05d59794916d61d5678b3a40722eb09ede89f1e4135a289a8a8464de19d6aab2f2bd8a702e6f53107ef51f25985bdca1a8572eed13827aaf96f8fcfaefe00d31881058134964fd970203010001300d06092a864886f70d01010505000381810072881563e0b07637bf03a6862e3dd9e7dd7186a3355639937748a686119ad59a612a95c6eb8b87b05d0353fc69eefe1b195eafaa08c08f1bf4d20659821ed67fd93d387912af03589d42551affbb6bdfdf81c4e702b32df611a9fcc8ad309edc02d694c948690258245e429bfd0049fd65e284c35d86e046a8abb0a4ee218eff</span><span style="color: #008000; "><br /></span>            PackageInfo pis = <span style="color: #0000FF; ">this</span>.getPackageManager().getPackageInfo("com.xx.xx", PackageManager.GET_SIGNATURES);<br />            Signature[] sigs = pis.signatures;<br />            <br />            System.out.println("version code=" + pis.versionCode);<br />            System.out.println(sigs[0].hashCode()+ " / 0x" + Integer.toHexString(sigs[0].hashCode()));<br />            String sig = <span style="color: #0000FF; ">new</span> String(sigs[0].toChars());<br />            System.out.println("to Char "+sig.length()+" length: " + sig);<br />            <br />            String apk = "/sdcard/xx.apk";<br />            PackageInfo pi = <span style="color: #0000FF; ">this</span>.getPackageManager().getPackageArchiveInfo(apk, PackageManager.GET_SIGNATURES);<br />            <br />            String main = <span style="color: #0000FF; ">new</span> String(pi.signatures[0].toChars());<br />            System.out.println("to Char "+main.length()+" apk:" + main);<br />            System.out.println(main.equals(sig));<br />        } <span style="color: #0000FF; ">catch</span> (NameNotFoundException e) {<br />            <span style="color: #008000; ">//</span><span style="color: #008000; "> TODO Auto-generated catch block</span><span style="color: #008000; "><br /></span>            e.printStackTrace();<br />        }<br />        <br /><br />    }<br />    <br /> <br />}</div><br /><br /><img src ="//www.ot7t.com.cn/TiGERTiAN/aggbug/379322.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="//www.ot7t.com.cn/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2012-05-27 17:28 <a href="//www.ot7t.com.cn/TiGERTiAN/archive/2012/05/27/379322.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我的近况 - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2012/04/04/373325.htmlTiGERTiANTiGERTiANWed, 04 Apr 2012 10:38:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2012/04/04/373325.html//www.ot7t.com.cn/TiGERTiAN/comments/373325.html//www.ot7t.com.cn/TiGERTiAN/archive/2012/04/04/373325.html#Feedback1//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/373325.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/373325.html2、当前工作已经干??个月?天?-有史以来最长的
3、我的婚姻生活已经进行了5个月?天?-很幸?br />4、我的压力比进这家公司之前增加了?0倍(当前处于晚上12点前及节假日无休状态),比我大学时期增?倍(上一家公司还是比较舒服的)?-鸭梨山大
5、已经出现重度焦虑症2个月?天?-等待升级为抑郁症
6、领导团队的人数?个人增加?5个人?-预计还要double一?br />
我的生活是否需要改变一下?

TiGERTiAN 2012-04-04 18:38 发表评论
]]>
Windows Phone 7中的Background Agent - 四川福利彩票快乐12快乐12开奖直播快乐12开奖辽宁福彩快乐12快乐彩12选5走势图//www.ot7t.com.cn/TiGERTiAN/archive/2012/02/05/369413.htmlTiGERTiANTiGERTiANSun, 05 Feb 2012 11:43:00 GMT//www.ot7t.com.cn/TiGERTiAN/archive/2012/02/05/369413.html//www.ot7t.com.cn/TiGERTiAN/comments/369413.html//www.ot7t.com.cn/TiGERTiAN/archive/2012/02/05/369413.html#Feedback0//www.ot7t.com.cn/TiGERTiAN/comments/commentRss/369413.html//www.ot7t.com.cn/TiGERTiAN/services/trackbacks/369413.html

在WP7.1中针对Background Agent的新API增加了蛮多非常强大的部分,以下将介绍Scheduled Multi Tasking的部分?/p>

  Scheduled Multi Tasking主要是让Application支援多工模式来执行任务,让Application不在前景模式下也可以继续在背景执行某些特定的任务,例如:背景下载、背景更新资料、背景唿叫服?#8230;等?/p>

  然而,WP7.1提供Agent的模式,让开发Application时将要背景执行的逻辑,独立放置于Agent之中透过排程来完成任务?/p>

  但要注意的是,Agent与Application必竟还是属于不同的专案,因为IsolatedStorage中的IsolatedStorageSettings无法共用,要交换资料需透过IsolatedStorage?案或其他方式来交换?/p>

  因此,在设计一个支援Background Agent(ScheduledTaskAgent)的Application时,我个人会有几个考量?/p>

  1. 将背景执行的逻辑独立成一个类别或模组,由该模组完成所有背景的任务;

  2. 使用设定?config)的方式,将参数或执行结果独立于案,提供Application与Agent均可以取?

  3. Agent是背景的任务,在背景发生Exception的容错机制需要特别设计,尽量透过通知告知用户;

  接下来,将细部去讨论Scueduled Tasking由那些重要的元素组成?/p>

  〉Microsoft.Phone.Scheduler - Scheduled Multi Tasking?/p>

  WP7.1允许Schedule Task与Background Agent在背景执行它们的任务,然而Schedule Task与Background Agent使用上却有所不同?/p>

  ‧Schedule Task:重点在于指定「週期?延迟性」执行任务,透过设定Schedule的时间频率重覆地去执行任?

  ‧Background Agent:根据不同的Agent可在细分使用重点,但较属性一次性任务或接收外部事件所触发的任?

  在Microsoft.Phone.Scheculer针对Scheulde提供了Task与Notification的使用,其用法上Schedule Task又是另一种用途,针对Schedule Notification会在另一?lt;>进行说明?/p>

  然而,在Scheulde Task的使用上有几个重要元系一定要去了解的,以下将详细说明?/p>

  A. ScheduledActionService?/p>

  专用于管理该设备所有的Scheduled Actions。Scheduled Actions包括了可用于通知的Alarm、Reminder,更包括下方介绍的二个运行于Background Agent的Periodic Task与Resource-Intensive Task。其重要的方法如下:

名称说明
Add向作业系统註册一个Scheduled Action。主要透过Scheduled Action的Name做为识别值?/td>
Find透过特定的Name找出Scheduled Action?/td>
GetActions(Of T)回传系统中所有特定类型的Scheduled Actions?/td>
LaunchForTest指定特定的延迟时间与ScheduledTask后,要求Background Agent执行该ScheduledTask?/td>
Remove从Scheduled Action Service将指定的名称的Scheduled Action移除?/td>
Replace通常会配合Find找出指定Name的Scheduled Action,并加以取代它?/td>

  B. PeriodicTask?/p>

  Periodic(定期) Task是一种定期代理运作的观念,专门针对运作背景任务所需时间较少,而且是执行隔间具有规律週期性的情境?/p>

  常见的使用情境,例如:定期上传手机的Location资讯、完成少量资料的同步、更新Tile状?#8230;等?/p>

  B-1. 使用Periodic Task的约束与时间週期建议

约束/建议说明
排程时间间隔?0?/td>通常?0分执行一次,在电力状况不错的情形下可以配合其他background process使用时,也可以设定接近上下差?0秒的使用?/td>
排程持续时间通常支援持续执行25秒,但也可能因为其他塬因造成该agent被提早结束?/td>
电池为节约模式时,能防止Exception由于电池是否要使用节约模式是由用户自行选择。如果该模式被选择时,当电池进入节约模式时,periodic task将有可能无法使用?/td>
每一个设备在Periodic Task的限?/td>为了让电池最大化使用,不同的设备对电池的使用有一定的控制範围,因此,可能限制一个设备最多有几个Agent可以被执行,如果超过,它会自动被turn off?/td>

  C. ResourceIntensiveTask?/p>

  Resource-Intensive(资源密集) Task是针对需要相对较长的处理时间,或是遇到需使用大量手机电源、网路等资源时较为适用的类型?/p>

  常见的使用情境,例如:同步大量的资料(如App需要下载大量的资料至手机端才能让App运行)…等?/p>

  C-1. 使用ResourceIntensiveTask的约束与时间週期建议

约束/建议说明
持续时间?0分鐘通常resource-intensive agent一般执行持续约10分鐘,如果有其他如下方的限制,将会提早停止agent的执行?/td>
外部电力需?/td>除非设备已连接外部的电力来源,否则无法执行?/td>
无行动网路能线能?/td>除非设备已通过Wi-Fi、行动网路或连接到PC,否则无法执行?/td>
最小电力需?/td>除非电力超过90%的情形,否则无法执行resource-intensive agent?/td>
设备萤幕被锁定状?/td>除非电话处于锁定的状态,否则无法执行resource-intensive agent?/td>
通话中无法使?/td>当手机处于通中状态时,resource-intensive agent无法使用?/td>
不能改变网路状态为行动网路如果resource-intensive agent企图去唿叫AssociateToNetworkInterface(Socket, NetworkInterfaceInfo)来指定任何一种行动网?GSM或CDMA),则会失败?/td>

  这二个元素其实都是由ScheduleAction与ScheduledTask抽象类别实作出来的,它们分别有自身使用的情境与适用性,

  二者最大的差别即在于使用情境与需要耗用手机资源的多少,以及resource-intensive task要在萤幕锁定与电?0%以上才能执行?/p>

  由于使用resource-intensive task要求的限制实在很多,因此,在设计Scheduled Task时需要特别考虑这个部分,至于其他相关的

  属性就大同小异了,以下简介其较长使用到的属性:

名称说明
Description设定/取得有关该Scheduled Task的描述。该描述的内容将会出现于手机「Settings/Applications/Background Tasks Settings」的画面中?nbsp;
如下图:以Background Scheulde为程式名称: 
0000 0001
ExpirationTime设定/取得Scheduled Task到期的时间?/td>
IsScheduled取得Scheduled Task状态是否为启动?/td>
LastExitReason取得Agent执行最近一次Task被结束的理由?/td>
LastScheduledTime取得Agent执行最近一次Task的时间,以手机时间为主?/td>
Name取得Scheduled Action的名称?/td>

  了解了二个元素的基本属性与使用情境后,有几个使用Background Agent要特别注意的?/p>

  1. 一个Application只能有一个Background agent(ScheduledTaskAgent),但Agent可以单独使用PeriodicTask、ResourceIntensiveTask

  或者二个同时使用。要注意的是一个Agent只能有一个PeriodicTask与一个ResourceIntensiveTask?/p>

  2. Background Agent(ScheduledTaskAgent)?/p>

  2-1. 透过OnInvoke(ScheduleTask)触发Agent逻辑的部?

  2-2. 已成功执行完所有任务时,记得唿叫NotifyComplete()告知Agent已完成任?

  2-3. 如果在执行过程发生错误或是无法执行Task时,要记得唿叫Abort()告知Agent接下来取消运作,然而即可以在Application端取?/p>

  ScheduledTask中的IsScheduled属性为false。但要注意的是如何Abort()之后,要记得使用ShellToast告知用户,以免用户不知道?/p>

  3. Background Agent在记忆体使用量的控制?/p>

  3-1. Periodic agents与resource-intensive agents允许在每次执行Task时,不超?MB记忆体用量?/p>

  3-2. Audio agents则限制不能超?5MB记忆体用量?/p>

  3-3. 在Debug模式下则不限制,但可以透过API去查询在每一个部分使用记体忆的状况?/p>

  4. 预设Agent为二个星期后需要重新安排Scheduled?/p>

  虽然可以透过ScheduledTask中的LastScheduledTime去确认究竟最近一次执行的Datetime为何,并且使用ExpirationTime去指定Task

  可运行的时间长度。但是使用ScheduledTask可能因为条件限制(例如遇到执行Task时没网路能力,自动要求Agent延后执行),造成Task

  长时间没有被执行,为了确保Task不会一直占住不使用,透过设定2个星期可存活时间,可以自动解决这个问题。设定ExpirationTime?/p>

  在每一次执行Application于前景状况时,进行判断与设定?/p>

  5. Scheduled Agent在连续二个Crash后自动取消:

  由于使用Periodic agents与resource-intensive agetns是交由Agent去控制,因此,当Agent连续出现二次以上的Crash或无法预期的错误?/p>

  该Agent将会被停止,需透过Application回到前景模式再重新启动它?/p>

]]>