2016-09-22 66 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」聲明的。