如何检测该相机已捕获新视频。我已经更新了我的代码
更新代码:
public class Video extends BroadcastReceiver
{
@Override
public void onReceive(Context context, Intent intent)
{
// TODO Auto-generated method stub
Log.d("SCAN_FILE", "VIDEOOOOOOOOOOOOOOOOOOO");
String action = intent.getAction();
Uri uri = intent.getData();
String externalStoragePath = Environment.getExternalStorageDirectory().getPath();
if (uri.getScheme().equals("file"))
{
String path = uri.getPath();
if (action.equals(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE) &&
path != null && path.startsWith(externalStoragePath + "/"))
{
String newFileURL = intent.getDataString();
scanFile(context, path, newFileURL);
}
}
}
private void scanFile(Context context, String path, String URL)
{
Log.d("SCAN_FILE", path);
Log.d("SCAN_URL", URL);
}
}
显现 :
<receiver android:name=".Video" >
<intent-filter>
<action android:name="android.intent.action.MEDIA_SCANNER_SCAN_FILE" />
</intent-filter>
</receiver>
等待您的专家建议。
更新:这个广播没有火