android studio for android learning (二)

1.为什么要考虑设备的兼容性?

android可以用在不同的设备上,如手机,手表,电视等,不同的设备有不同的尺寸,需要我们去适用。你可以用一个静态的xml文件来设置设备的配置,这样你就可以用一个APK来通过android来配置不同的尺寸,用来支持不同的平台。

2. 兼容性包括两类,1是设备兼容,2是软件兼容(APP)。

3. 你写的APP要放到google play store上必需要满足下面几点

1. Device features

2. Platform version

3. Screen configuration

例如:你的APP需要的compass,如果没有,google play store 将会阻止它的安装。

<manifest ... >
    <uses-feature android:name="android.hardware.sensor.compass"
                  android:required="true" />
    ...
</manifest>

4. 平台兼容性,这里是指google平台,如果android4.0 和android4.4 不同的平台有不同的API,新的平台中的API可能是旧版本中没有的,所以,在平台兼容性上可以设置最低兼容平台,其中android1.0的API level=1,而android 4.4 is api level 14,minSdkVersion是指最小的兼容等级,targetSdkVersion指你会优化支持的等级。

<manifest ... >
    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19" />
    ...
</manifest>

5.系统权限(权限许可组和相应权限)

Permission GroupPermissions
CALENDARREAD_CALENDAR ,WRITE_CALENDAR
CAMERACAMERA
CONTACTSREAD_CONTACTS,WRITE_CONTACTS,GET_ACCOUNTS
LOCATIONACCESS_FINE_LOCATION,ACCESS_COARSE_LOCATION
MICROPHONERECORD_AUDIO
PHONEREAD_PHONE_STATE……
SMSSEND_SMS, RECEIVE_SMS,READ_SMS,RECEIVE_WAP_PUSH,RECEIVE_MMS
STORAGEREAD_EXTERNAL_STORAGE,WRITE_EXTERNAL_STORAGE

6. 消息对像:intents and intent filters,主要的应用组件在activity,service,broadcast,包括显式的消息对像(explicit intents),隐式的消息对象(implicit intents),隐式的就是没有指定Intent的组件名字,需要Android根据Intent中的Action、data、Category等来解析匹配。而目标组件(Activity、Service、Broadcast Receiver)怎通过设置他们的Intent Filter来界定其处理的Intent。如果一个组件没有定义Intent Filter,那么它只能接受处理显示的Intent,只有定义了Intent Filter的组件才能同时处理隐式和显示的Intent。

6.1为了确保你的APP安全,总是用一个显式的消息对象来启动一个服务,而且不声明intent filters。

6.2 if you want your activity to receive implicit intents, it must include a category for “android.intent.category.DEFAULT

6.3 URI(Uniform Resource Identifier)

For example:

格式:< scheme >://< host >:< port >/< path >

content://com.example.project:200/folder/subfolder/etc

In this URI, the scheme is content, the host is com.example.project, the port is 200, and the path is folder/subfolder/etc

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值