Content uri crashes camera on Android KitKat

前端 未结 2 1651
醉梦人生
醉梦人生 2021-01-03 10:36

I run into problem while using content uri and FileProvider on Android API 19 (Kitkat). Here\'s code that I use to open camera on device and record a video:

         


        
2条回答
  •  执笔经年
    2021-01-03 10:53

    maybe you can try this one.

        if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.KITKAT){
            fileUri = Uri.fromFile(mTmpFile);
        } else {
            fileUri = FileProvider.getUriForFile(getContext(),
                    getContext().getPackageName()+".provider",mTmpFile);
        }
    

提交回复
热议问题