2
我想檢查設備是否具有電話功能。但在模擬器中,它總是返回false。爲什麼這樣?難道我做錯了什麼。pm.hasSystemFeature(PackageManager.FEATURE TELEPHONY);總是返回假
我想檢查設備是否具有電話功能。但在模擬器中,它總是返回false。爲什麼這樣?難道我做錯了什麼。pm.hasSystemFeature(PackageManager.FEATURE TELEPHONY);總是返回假
你可以把你的代碼包裝在try/catch中。它適用於所有情況,即使是關於短信發送的最後api更改。
try{
// code that use telephony features
}
catch(Exception e){
// code that doesn't use telephony features
}
這是你的代碼? pm.hasSystemFeature(PackageManager.FEATURE TELEPHONY);返回假?它總是返回假。 –
我這樣做:boolean hasTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);併爲模擬器返回false – Rookie
http://stackoverflow.com/q/6465125/1012284 –