android-fileprovider

Opening a PDF file using FileProvider uri opens a blank screen

独自空忆成欢 提交于 2019-12-03 12:34:15
I'm creating a PDF file on my app and writing it to the external storage, "Download" directory. Now, when I open it through my app with an intent action.VIEW using FileProvider uri, Google PDF Viewer displays a blank screen, Adobe Acrobat cannot even open the file. Here's my code to write the file and then trying to show it. Note that I'm sending a local notification and trying to open the file through the notification. try { File mypath=new File( Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DOWNLOADS),mParam1.getEmlak_id()+".pdf"); document.writeTo(new FileOutputStream

PDF file when opening in Android Nougat is showing blank screen

廉价感情. 提交于 2019-12-03 12:12:27
I am creating a PDF file and saving it in local storage. When trying to open it, it is working perfect in all devices except in Android N. I am able to open PDF file in Android N using FileProvider, but it is displaying as blank. This is my URI content://com.products.provider/external_storage_root/Android/data/com.products/in_17052017_170502_1_1001.pdf This is my code Uri path; File pdfFile = new File(Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + "Android" + "/" + "data" + "/" + "com.products" + "/" + file); if (Build.VERSION.SDK_INT >= 24) { path = FileProvider

IllegalArgumentException: Failed to find configuration root that contains xxx on FileProvider.getUriForFile

落爺英雄遲暮 提交于 2019-12-03 11:16:42
I have been trying to follow the Android tutorial on sharing files. I set up the FileProvider like this: On the main manifest xml: <provider android:name="android.support.v4.content.FileProvider" android:authorities="com.example.mysecondapp.fileprovider" android:exported="false" android:grantUriPermissions="true" > <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/filepaths" /> </provider> the res/xml/filpaths.xml file: <paths xmlns:android="http://schemas.android.com/apk/res/android"> <external-path name="myexternalimages" path="SpCars_album/" /> </paths>

Android 7.0 Notification Sound from File Provider Uri not playing

泄露秘密 提交于 2019-12-03 06:06:01
问题 I'm changing my app code for supporting Android 7, but in my NotificationCompat.Builder.setSound(Uri) passing the Uri from FileProvider the Notification don't play any sound, in Android 6 using the Uri.fromFile() worked properly. The mp3 file is in: /Animeflv/cache/.sounds/ This is my Notification Code: knf.animeflv.RequestBackground NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_not_r) .setContentTitle(NotTit) .setContentText(mess);

FileProvider error onHuawei devices

柔情痞子 提交于 2019-12-03 04:08:20
问题 I have an exception that happens only on Huawei devices in my app when using FileProvider.getUriForFile : Exception: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/<card name>/Android/data/<app package>/files/.export/2016-10-06 13-22-33.pdf at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(SourceFile:711) at android.support.v4.content.FileProvider.getUriForFile(SourceFile:400) Here is the definition of my file provider in my

Android 7.0 Notification Sound from File Provider Uri not playing

南楼画角 提交于 2019-12-02 18:38:56
I'm changing my app code for supporting Android 7, but in my NotificationCompat.Builder.setSound(Uri) passing the Uri from FileProvider the Notification don't play any sound, in Android 6 using the Uri.fromFile() worked properly. The mp3 file is in: /Animeflv/cache/.sounds/ This is my Notification Code: knf.animeflv.RequestBackground NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context) .setSmallIcon(R.drawable.ic_not_r) .setContentTitle(NotTit) .setContentText(mess); ... mBuilder.setVibrate(new long[]{100, 200, 100, 500}); mBuilder.setSound(UtilSound.getSoundUri(not));

FileProvider error “Failed to find configured root that contains /data/data/sawbodeployer.entm.illinois.edu …”

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-02 17:36:50
问题 I download video by android download manager and want to share this video, I follow through Manifas <provider android:name="android.support.v4.content.FileProvider" android:authorities="my.domain" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/paths" /> </provider> and in file path.xml add this: <paths xmlns:android="http://schemas.android.com/apk/res/android"> <files-path name="video_folder"

FileProvider error onHuawei devices

巧了我就是萌 提交于 2019-12-02 17:27:50
I have an exception that happens only on Huawei devices in my app when using FileProvider.getUriForFile : Exception: java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/<card name>/Android/data/<app package>/files/.export/2016-10-06 13-22-33.pdf at android.support.v4.content.FileProvider$SimplePathStrategy.getUriForFile(SourceFile:711) at android.support.v4.content.FileProvider.getUriForFile(SourceFile:400) Here is the definition of my file provider in my manifest: <provider android:name="android.support.v4.content.FileProvider" android:authorities="$

FileProvider error “Failed to find configured root that contains /data/data/sawbodeployer.entm.illinois.edu …”

喜你入骨 提交于 2019-12-02 10:52:10
I download video by android download manager and want to share this video, I follow through Manifas <provider android:name="android.support.v4.content.FileProvider" android:authorities="my.domain" android:exported="false" android:grantUriPermissions="true"> <meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/paths" /> </provider> and in file path.xml add this: <paths xmlns:android="http://schemas.android.com/apk/res/android"> <files-path name="video_folder" path="files/"/> </paths> and use this provider: File file = new File(getActivity().getFilesDir() ,

FileProvider.getUriForFile returns null

廉价感情. 提交于 2019-12-02 08:38:31
问题 I'm trying to take a photo in my device's camera, when I call the method that handles the image capture the app crashes because of a nullpointer exception. I don't know what information is missing with my FileProvider as the stacktrace points the nullpointer into my FileProvider.getUriForFile statement. Here's my code HomeActivity public void takePhoto(View view){ //camera stuff Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); String timeStamp = new SimpleDateFormat("yyyyMMdd