开发者

Automatic Detection of mass storage/external drive in Android

Is it possible or is there a way in Android v2.2+ to detect if there is a mass storage, external drive or micro SD inserted in the device?

My objective is, I want to create an app that will be invoked once an external storage like micro SD is inserted in the device?

I want to know if: 1) Is there a standard intent broadcasted once an SD is mounted in the device? 2) Do 开发者_StackOverflow中文版I have to deal with it in the native driver layer to achieve this?

Any thoughts are highly appreciated.

Thanks


Yes there is a standard intent broadcast, you are probably looking for the ACTION_MEDIA_MOUNTED broadcast.

ACTION_MEDIA_MOUNTED

Since: API Level 1
Broadcast Action: External media is present and mounted at its mount point. The path to the mount point for the removed media is contained in the Intent.mData field. The Intent contains an extra with name "read-only" and Boolean value to indicate if the media was mounted read only.

Source

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜