2016-09-22 20 views
2

AndroidManifest.xml中父功能(对于uses-feature标记)的使用是否与所有启用的子功能相同?Parent uses-feature android.hardware.location

例如,是以下的块

<uses-feature android:name="android.hardware.location" android:required="false" /> 

等于

<uses-feature android:name="android.hardware.location.gps" android:required="false" /> 
<uses-feature android:name="android.hardware.location.network" android:required="false" /> 

回答

2

是否父特征的在AndroidManifest.xml的用途(用途-特征标签)的意思相同所有启用的子功能?

它没有。你展示的两个街区并不相同。事实恰恰相反但是:如果你声明android.hardware.location.gps,它会自动意味着你还声明android.hardware.location

更多信息,请参见the documentation。我复制相关部分,并强调以粗体:

android.hardware.location
该应用程序使用一个或多个特征在设备上用于确定位置,诸如GPS位置,网络位置或小区位置。


android.hardware.location.gps
该应用程序使用的精确位置坐标从全球定位系统(GPS)在设备上接收器获得的。

通过使用此功能,应用程序意味着它也使用android.hardware.location功能,除非此父功能是使用属性android:required =“false”声明的。


android.hardware.location.network
该应用程序使用粗略位置坐标从支撑装置上的基于网络的地理定位系统获得。

通过使用此功能,应用程序意味着它也使用android.hardware.location功能,除非此父功能是使用属性android:required =“false”声明的。