[英]How to check if physical sd card is removed/mounted
如何檢查是否已安裝或卸下物理SD卡?
<receiver android:name=".MyReceiver" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_REMOVED" />
<action android:name="android.intent.action.MEDIA_MOUNTED" />
</intent-filter>
使用此意圖過濾器定義廣播接收器不會對任何內容產生反應
// try this
if (!Environment.MEDIA_MOUNTED.equals(Environment.getExternalStorageState())) {
// External SD card not mounted
}else{
// External SD card mounted
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.