计步器manifest.xml学习详解

2015.12.22

为完成C#网络编程的作业,找了一份参考书上的代码,最近任务看懂他。加油

先来看看manifest.xml

<?xml version="1.0" encoding="utf-8"?>//版本和编码类型说明
<manifest xmlns:android="http://schemas.android.com/apk/res/android"//来源
      package="name.step"//包名,以name作为索引项
      android:versionCode="1" //只能是整数,代码版本,一半越新号越大

     android:versionName="1.0"//apk版本号,自定义

      android:installLocation="auto">     //android:installLocation=["auto" | "internalOnly" | "preferExternal"] >,是说可以安装在什么地方,auto代表可以安装在SD卡,还有可以安装在内存,和找不带SD 卡安装在内存
      
    <uses-sdk android:minSdkVersion="4" //最低API,兼容性越大,版本号越低,像支付宝类的此处值偏小
      android:targetSdkVersion="18" />//最佳版本号

    <uses-permission android:name="android.permission.WAKE_LOCK" />/*权限,代表此处有保持屏幕唤醒权限,硬件权限为  <uses-feature     android:name="android.hardware.camera" /> <!-- 使用照相机权限 -->*/
//android.permission.STOP_APP_SWITCHES  这个是否可加入,让程序始终运行,作为计步器我们可以保持计步器始终后台运行
    
    <application android:allowBackup="false"//是否允许备份,设计安全性
                 android:icon="@drawable/icon" //应用图标
                 android:label="@string/app_name">//应用名
        <activity android:name="name.step.Pedometer"
                  android:label="@string/app_name"
                  android:configChanges="orientation|screenSize">//keyboardHidden,键盘被隐藏时 安卓3.2之后版本需要加screenSize,详解引用:http://jingyan.baidu.com/article/2fb0ba4056b25700f2ec5faf.html当配置改变时会直接调用

onCreate方法中的 onConfigurationChanged方法,而不是重新执行onCreate方法

            <intent-filter>//过滤器,它指定了启动应用程序的Intent对象的动作和类型
                <action android:name="android.intent.action.MAIN" />//表示这个activity是主入口,只要启动这个应用程序,就要首先调用这个activity
                <category android:name="android.intent.category.LAUNCHER" />//表示这个activity种类,要加到LAUNCHER程序列表里。
            </intent-filter>
        </activity>
        <activity android:name="name.step.Settings"
                android:label="@string/activity_settings">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.DEFAULT" />//理论上来说,如果intent不指定category,那么无论intent filter的内容是什么都应该是匹配的。但是,如果是implicit intent,android默认给加上一个CATEGORY_DEFAULT,这样的话如果intent filter中没有android.intent.category.DEFAULT这个category的话,匹配测试就会失败  http://www.cnblogs.com/snowdrop/articles/2056706.html
            </intent-filter>
        </activity>


        <service android:name="name.step.StepService"/>


    </application>


</manifest> 


浅谈显示Intent和隐式Intenthttp://liangruijun.blog.51cto.com/3061169/655132/

理解android.intent.action.MAIN 与android.intent.category.LAUNCHER

http://blog.csdn.net/g19920917/article/details/25561169

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值