??xml version="1.0" encoding="utf-8" standalone="yes"?>BlogJava-Enjoy yourself,and don't care about others' thinking!http://www.qpkxbc.shop/TiGERTiAN/----TiGERTiANzh-cnSat, 24 Aug 2019 00:52:00 GMTSat, 24 Aug 2019 00:52:00 GMT60MVC/MVP/MVVMhttp://www.qpkxbc.shop/TiGERTiAN/archive/2017/05/10/432509.htmlTiGERTiANTiGERTiANWed, 10 May 2017 03:03:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2017/05/10/432509.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/432509.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2017/05/10/432509.html#Feedback0http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/432509.htmlhttp://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/432509.html?/h2>

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

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

  • ViewQUI层,提供Ҏl用L交互操作功能Q包括UI展现代码及一些相关的界面逻辑代码?/p>

?/h2>

三者的差异在于如何_合View和ModelQ实现用L交互操作以及变更通知

  • Controller

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

  • Presenter

Presenter与Controller一P接收View的命令,对Modelq行操作Q与Controller不同的是Presenter会反作用于ViewQModel的变更通知首先被Presenter获得Q然后Presenter再去更新View。一个Presenter只对应于一个View。根据Presenter和View寚w辑代码分担的程度不同,q种模式又有两种情况QPassive View和Supervisor Controller?/p>

  • ViewModel

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

TiGERTiAN 2017-05-10 11:03 发表评论
]]>Volley+Gson+MQTT实现一套接z֍pȝhttp://www.qpkxbc.shop/TiGERTiAN/archive/2016/08/20/431647.htmlTiGERTiANTiGERTiANSat, 20 Aug 2016 04:23:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2016/08/20/431647.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/431647.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2016/08/20/431647.html#Feedback0http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/431647.htmlhttp://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/431647.htmlGson化了Json的处理,使得对象和Json报文之间的互相{换变得很ҎQ代码更z;
MQTT实现消息的推送还是很不错的;

TiGERTiAN 2016-08-20 12:23 发表评论
]]>
Android传感器介l?/title><link>http://www.qpkxbc.shop/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>http://www.qpkxbc.shop/TiGERTiAN/archive/2015/11/18/428265.html</guid><wfw:comment>http://www.qpkxbc.shop/TiGERTiAN/comments/428265.html</wfw:comment><comments>http://www.qpkxbc.shop/TiGERTiAN/archive/2015/11/18/428265.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/428265.html</wfw:commentRss><trackback:ping>http://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/428265.html</trackback:ping><description><![CDATA[     摘要: 大多数Android讑֤有内|的传感器,来测量运动,方向和各U环境条件。这些传感器能提供高_ֺ和准度的原始数据,如果你想监控讑֤三维q动或者位|,或者你想监控设备周围的环境变化Q是非常有用的。例如,游戏可能跟踪讑֤重力传感器的数据Q来推断复杂的用户首饰和动作Q例如倾斜Q震动,旋{Q或者振q。同LQ天气应用可能用设备的温度传感器和湿度传感器的数据来计和报告l露点,或者旅行应用可能用磁Z?..  <a href='http://www.qpkxbc.shop/TiGERTiAN/archive/2015/11/18/428265.html'>阅读全文</a><img src ="http://www.qpkxbc.shop/TiGERTiAN/aggbug/428265.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.qpkxbc.shop/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2015-11-18 15:33 <a href="http://www.qpkxbc.shop/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.jshttp://www.qpkxbc.shop/TiGERTiAN/archive/2015/02/23/422997.htmlTiGERTiANTiGERTiANMon, 23 Feb 2015 02:12:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2015/02/23/422997.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/422997.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2015/02/23/422997.html#Feedback0http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/422997.htmlhttp://www.qpkxbc.shop/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;">)
http://www.osgi.org/Technology/HomePage

Hadoop
http://hadoop.apache.org/

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


TiGERTiAN 2015-02-23 10:12 发表评论
]]>
javacc工具记http://www.qpkxbc.shop/TiGERTiAN/archive/2015/01/31/422602.htmlTiGERTiANTiGERTiANSat, 31 Jan 2015 05:12:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2015/01/31/422602.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/422602.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2015/01/31/422602.html#Feedback0http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/422602.htmlhttp://www.qpkxbc.shop/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.

下蝲后的使用方式QMac&LinuxQ:

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 发表评论
]]>
q是q里比较安静http://www.qpkxbc.shop/TiGERTiAN/archive/2013/12/10/407419.htmlTiGERTiANTiGERTiANTue, 10 Dec 2013 13:46:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2013/12/10/407419.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/407419.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2013/12/10/407419.html#Feedback0http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/407419.htmlhttp://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/407419.html微博--很少上了
朋友?-人太?br />虽感觉社交体p越来越向私密化发展Q但q是q里好,没h知,没h识,也不会有那么多h评论我发的东西,或者无聊的?#8220;?#8221;?br />前两q的qQ到现在的重h向,书本而不是h让我感觉更安心,喜欢做一个爱学习的h。前途再qQ也不能q失自己Q道路再舒服Q也不能忘记自己?br />希望自己不要浑噩噩p栯了?br />





TiGERTiAN 2013-12-10 21:46 发表评论
]]>
坑爹的Android新ADThttp://www.qpkxbc.shop/TiGERTiAN/archive/2013/05/13/399233.htmlTiGERTiANTiGERTiANMon, 13 May 2013 13:18:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2013/05/13/399233.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/399233.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2013/05/13/399233.html#Feedback0http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/399233.htmlhttp://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/399233.html


TiGERTiAN 2013-05-13 21:18 发表评论
]]>
如何开启Android新手机的调试模式http://www.qpkxbc.shop/TiGERTiAN/archive/2013/04/09/397602.htmlTiGERTiANTiGERTiANTue, 09 Apr 2013 12:48:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2013/04/09/397602.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/397602.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2013/04/09/397602.html#Feedback0http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/397602.htmlhttp://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/397602.html?/system/etc/init.d q个目录下,有很多脚本,把它们全部导出(方便查找Q?无意中在 99snakes q个文g扑ֈ了一?/span>
  1. # disable logger - (comment and reboot for logcat)
  2. rm /dev/log/main
复制代码
感动中。。。把rm /dev/log/main q句Lp了~重启后就可以调试了,q下不用刷回原生的内怺Q哈哈,爽~

TiGERTiAN 2013-04-09 20:48 发表评论
]]>
WindowsPhone中资源国际化的开?/title><link>http://www.qpkxbc.shop/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>http://www.qpkxbc.shop/TiGERTiAN/archive/2012/09/14/387708.html</guid><wfw:comment>http://www.qpkxbc.shop/TiGERTiAN/comments/387708.html</wfw:comment><comments>http://www.qpkxbc.shop/TiGERTiAN/archive/2012/09/14/387708.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/387708.html</wfw:commentRss><trackback:ping>http://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/387708.html</trackback:ping><description><![CDATA[1、对于应用名U?App Title)和开始屏q的快捷方式(Tile)名称Q需要参?a href="http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff967550%28v=vs.92%29.aspx">http://msdn.microsoft.com/en-us/library/windowsphone/develop/ff967550%28v=vs.92%29.aspx</a> 来开发,q里提供一个快L生成工具<a href="/Files/TiGERTiAN/WP7AppResLib.zip">/Files/TiGERTiAN/WP7AppResLib.zip<br /></a>在WMAppManifest.xml中的调用方式Title="@AppResLib.dll,-100"     <Title>@AppResLib.dll,-200</Title>Q?00?00分别对应了App Title和Tile?br /><br />2、在E序内的国际化,在开发工E中Q新Z个Resource目录Q下面新建AppResource.resx资源Q针对不同语a可以建立不同的资源AppResource.en-US.resx{。在E序中直接用以下函数就可以调用已经配置好的国际化资源:<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 />http://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、对于需要支持的语言Q还要修改csproj文gQ修改如下:<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 />http://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 ="http://www.qpkxbc.shop/TiGERTiAN/aggbug/387708.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.qpkxbc.shop/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2012-09-14 11:28 <a href="http://www.qpkxbc.shop/TiGERTiAN/archive/2012/09/14/387708.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android应用内外{֐比较http://www.qpkxbc.shop/TiGERTiAN/archive/2012/07/04/382227.htmlTiGERTiANTiGERTiANWed, 04 Jul 2012 13:18:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2012/07/04/382227.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/382227.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2012/07/04/382227.html#Feedback0http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/382227.htmlhttp://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/382227.html在Androidpȝ外部和内部读取Android应用的签?/a>Q,发现在某些机器上Q读取安装包的签名有的时候ؓI,所以找了其他办法?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 发表评论
]]>
2012q第一季度Ud互联|应用以及开发者现状报?/title><link>http://www.qpkxbc.shop/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>http://www.qpkxbc.shop/TiGERTiAN/archive/2012/06/03/379840.html</guid><wfw:comment>http://www.qpkxbc.shop/TiGERTiAN/comments/379840.html</wfw:comment><comments>http://www.qpkxbc.shop/TiGERTiAN/archive/2012/06/03/379840.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/379840.html</wfw:commentRss><trackback:ping>http://www.qpkxbc.shop/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; ">2012q_中国Ud互联|相比此前,发展更q速,l端讑֤更普及Q那么,我们能从q去的第一季度Q看Zq中国移动互联网会呈现怎样的发展趋势呢Q?/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; ">q期Q我们根据友盟移动统计分析^台的部分数据Q对中国Ud应用发展现状q行了研I和分析Qƈ且通过对广大移动应用开发者的调查透视了国内APP开发者的现状。希望能够ؓUd互联|创业者提供最有h值的参考!</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; ">2011q??#8212;—2012q??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 href="http://blog.umeng.com/wp-content/uploads/2012/06/1.jpg" rel="" target="" title="" style="margin: 0px; padding: 0px; text-decoration: none; color: #3f6dcc; cursor: url(http://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="http://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; ">     ?011q的3月䆾Cq的3月䆾Q移动应用无论是z跃用户q是日启动次数都有了十的增ѝ我们按照应用的累计安装量作为排序标准,选取了TOP100的应用作为统计样本,研究后发现活跃用户和日启动均比去q的3月䆾增长?倍之多。可见越来越多的用户开始接受ƈ享用Ud互联|ؓZ生活带来的便利?/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; ">用户地理分布&联网方式&q营商分?/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 href="http://blog.umeng.com/wp-content/uploads/2012/06/2.jpg" rel="" target="" title="" style="margin: 0px; padding: 0px; text-decoration: none; color: #3f6dcc; cursor: url(http://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="http://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; ">关于中国Ud互联|用L地理分布Q广东、江苏、北京、浙江和徏五省或者直辖市排在了前五名的位|,占据了全国用户䆾额的40.7%。在2011q第三季度的时候,我们也发布一份数据报?昄用户份额前五的省份或者直辖市是广东、江苏、浙江、北京和上vQ占据全国用户䆾额的44.6%。另外,2011q第二季度前五名省䆾或直辖市所占M额是49.4%。不隄出,Ud互联|向二线城市蔓g的趋势依然是持箋q且不可逆{的?/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; ">关于联网方式和运营商Q?G上网依然是一半上|用L选择Q占?1.2%。?G和WIFI的用户占比分别ؓ14.6%?4.2%。联通和电信凭借其3G套餐和优惠购Z务,市场份额已经分别占据?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; ">国内Ud应用开发者现?/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 href="http://blog.umeng.com/wp-content/uploads/2012/06/3.jpg" rel="" target="" title="" style="margin: 0px; padding: 0px; text-decoration: none; color: #3f6dcc; cursor: url(http://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="http://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名开发者和开发团队,Z们提供专业的l计分析、应用联盟和开发组件品。ؓ了更好的服务Ud互联|创业,我们?012q第一季度邀请了q大Ud开发者进行了一ơ全面的问卷调查。调查的几个重要l论如下Q?/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; "> Ud互联|个人开发者占?7%Q其余ؓ公司或者工作室</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;团队选择了Androidq_</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 ="http://www.qpkxbc.shop/TiGERTiAN/aggbug/379840.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.qpkxbc.shop/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2012-06-03 10:16 <a href="http://www.qpkxbc.shop/TiGERTiAN/archive/2012/06/03/379840.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Android中短信拦截解x?/title><link>http://www.qpkxbc.shop/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>http://www.qpkxbc.shop/TiGERTiAN/archive/2012/05/28/379348.html</guid><wfw:comment>http://www.qpkxbc.shop/TiGERTiAN/comments/379348.html</wfw:comment><comments>http://www.qpkxbc.shop/TiGERTiAN/archive/2012/05/28/379348.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/379348.html</wfw:commentRss><trackback:ping>http://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/379348.html</trackback:ping><description><![CDATA[个h备䆾使用Q有些垃圾数据,误行删除?br />配置文gQ?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 />http://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; ">="http://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>后台自动启动服务Q?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 />http://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 />http://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="http://www.qpkxbc.shop/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 ="http://www.qpkxbc.shop/TiGERTiAN/aggbug/379348.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.qpkxbc.shop/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2012-05-28 11:07 <a href="http://www.qpkxbc.shop/TiGERTiAN/archive/2012/05/28/379348.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>在Androidpȝ外部和内部读取Android应用的签?/title><link>http://www.qpkxbc.shop/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>http://www.qpkxbc.shop/TiGERTiAN/archive/2012/05/27/379322.html</guid><wfw:comment>http://www.qpkxbc.shop/TiGERTiAN/comments/379322.html</wfw:comment><comments>http://www.qpkxbc.shop/TiGERTiAN/archive/2012/05/27/379322.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/379322.html</wfw:commentRss><trackback:ping>http://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/379322.html</trackback:ping><description><![CDATA[Androidpȝ外读取签名(J2SEQ:<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 />http://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 />Androidpȝ内读取签名:<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 />http://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 ="http://www.qpkxbc.shop/TiGERTiAN/aggbug/379322.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.qpkxbc.shop/TiGERTiAN/" target="_blank">TiGERTiAN</a> 2012-05-27 17:28 <a href="http://www.qpkxbc.shop/TiGERTiAN/archive/2012/05/27/379322.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>我的q况http://www.qpkxbc.shop/TiGERTiAN/archive/2012/04/04/373325.htmlTiGERTiANTiGERTiANWed, 04 Apr 2012 10:38:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2012/04/04/373325.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/373325.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2012/04/04/373325.html#Feedback1http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/373325.htmlhttp://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/373325.html2、当前工作已l干?q?个月~?天?-有史以来最长的
3、我的婚ȝzdl进行了5个月~?天?-很幸?br />4、我的压力比q这家公怹前增加了U?0倍(当前处于晚上12点前及节假日无休状态)Q比我大学时期增?倍(上一家公司还是比较舒服的Q?-鸭梨山大
5、已l出现重度焦虑症2个月?天?-{待升为抑郁症
6、领导团队的人数?个h增加?5个h?-预计q要double一?br />
我的生活是否需要改变一下?

TiGERTiAN 2012-04-04 18:38 发表评论
]]>
Windows Phone 7中的Background Agenthttp://www.qpkxbc.shop/TiGERTiAN/archive/2012/02/05/369413.htmlTiGERTiANTiGERTiANSun, 05 Feb 2012 11:43:00 GMThttp://www.qpkxbc.shop/TiGERTiAN/archive/2012/02/05/369413.htmlhttp://www.qpkxbc.shop/TiGERTiAN/comments/369413.htmlhttp://www.qpkxbc.shop/TiGERTiAN/archive/2012/02/05/369413.html#Feedback0http://www.qpkxbc.shop/TiGERTiAN/comments/commentRss/369413.htmlhttp://www.qpkxbc.shop/TiGERTiAN/services/trackbacks/369413.html

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

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

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

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

  因此Q在设计一个支援Background Agent(ScheduledTaskAgent)的ApplicationӞ我个Z有几个考量Q?/p>

  1. 背景执行的逻辑独立成一个类别或模组Q由该模l完成所有背景的d;

  2. 使用讑֮?config)的方式,参数或执行l果独立于档案,提供Application与Agent均可以取?

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

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

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

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

  ‧Schedule TaskQ重点在于指定「週期?延迟性」执行Q务,透过讑֮Schedule的时间频率重覆地L行Q?

  ‧Background AgentQ根据不同的Agent可在l分使用重点Q但较属性一ơ性Q务或接收外部事g所触发的Q?

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

  然而,在Scheulde Task的用上有几个重要元pM定要M解的Q以下将详细说明Q?/p>

  A. ScheduledActionServiceQ?/p>

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

名称说明
Add向作业系l註册一个Scheduled Action。主要透过Scheduled Action的Name做ؓ识别倹{?/td>
Find透过特定的Name扑ևScheduled Action?/td>
GetActions(Of T)回传pȝ中所有特定类型的Scheduled Actions?/td>
LaunchForTest指定特定的gq时间与ScheduledTask后,要求Background Agent执行该ScheduledTask?/td>
Remove从Scheduled Action Service指定的名称的Scheduled ActionU除?/td>
Replace通常会配合Find扑և指定Name的Scheduled ActionQƈ加以取代它?/td>

  B. PeriodicTaskQ?/p>

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

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

  B-1. 使用Periodic Task的约束与旉週期

U束/说明
排程旉间隔Q?0?/td>通常?0分执行一ơ,在电力状况不错的情Ş下可以配合其他background process使用Ӟ也可以设定接q上下差?0U的使用?/td>
排程持箋旉通常支援持箋执行25U,但也可能因ؓ其他塬因造成该agent被提早结束?/td>
甉|U模式时Q能防止Exception׃甉|是否要用节U模式是q戯行选择。如果该模式被选择Ӟ当电池进入节U模式时Qperiodic task有可能无法使用?/td>
每一个设备在Periodic Task的限?/td>Z让电池最大化使用Q不同的讑֤对电池的使用有一定的控制围Q因此,可能限制一个设备最多有几个Agent可以被执行,如果过Q它会自动被turn off?/td>

  C. ResourceIntensiveTaskQ?/p>

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

  常见的用情境,例如Q同步大量的资料(如App需要下载大量的资料x机端才能让Appq行)…{?/p>

  C-1. 使用ResourceIntensiveTask的约束与旉週期

U束/说明
持箋旉Q?0分鐘通常resource-intensive agent一般执行持l约10分鐘Q如果有其他如下方的限制Q将会提早停止agent的执行?/td>
外部电力需?/td>除非讑֤已连接外部的电力来源Q否则无法执行?/td>
无行动网路能U能?/td>除非讑֤已通过Wi-Fi、行动网路或q接到PCQ否则无法执行?/td>
最电力需?/td>除非电力过90%的情形,否则无法执行resource-intensive agent?/td>
讑֤萤幕被锁定状?/td>除非电话处于锁定的状态,否则无法执行resource-intensive agent?/td>
通话中无法?/td>当手机处于通中状态时Qresource-intensive agent无法使用?/td>
不能改变|\状态ؓ行动|\如果resource-intensive agent企图d叫AssociateToNetworkInterface(Socket, NetworkInterfaceInfo)来指定Q何一U行动网?GSM或CDMA)Q则会失败?/td>

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

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

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

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

名称说明
Description讑֮/取得有关该Scheduled Task的描q。该描述的内容将会出C手机「Settings/Applications/Background Tasks Settings」的画面中?nbsp;
如下图:以Background Scheulde为程式名Uͼ 
0000 0001
ExpirationTime讑֮/取得Scheduled Task到期的时间?/td>
IsScheduled取得Scheduled Task状态是否ؓ启动?/td>
LastExitReason取得Agent执行最q一ơTask被结束的理由?/td>
LastScheduledTime取得Agent执行最q一ơTask的时_以手机时间ؓ丅R?/td>
Name取得Scheduled Action的名U?/td>

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

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

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

  2. Background Agent(ScheduledTaskAgent)Q?/p>

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

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

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

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

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

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

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

  3-3. 在Debug模式下则不限Ӟ但可以透过APIL询在每一个部分用记体忆的状c?/p>

  4. 预设AgentZ个星期后需要重新安排ScheduledQ?/p>

  虽然可以透过ScheduledTask中的LastScheduledTimeȝ认究竟最q一ơ执行的DatetimeZQƈ且用ExpirationTimeL定Task

  可运行的旉长度。但是用ScheduledTask可能因ؓ条g限制(例如遇到执行Task时没|\能力Q自动要求Agent延后执行)Q造成Task

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

  在每一ơ执行Application于前景状冉|Q进行判断与讑֮?/p>

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

  ׃使用Periodic agents与resource-intensive agetns是交由AgentLӞ因此Q当Agentq箋出现二次以上的Crash或无法预期的错误Q?/p>

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

TiGERTiAN 2012-02-05 19:43 发表评论
]]>
1һ152ͼ