android - External application is stopped when using FileProvider for opening file from internal storage -


i have files in custom folder in internal storage. need open files using external application adobe. planned open using fileprovider. third party application stopped when trying open the document. don't know mistake did in code.

package name = "com.example.doc"

activities in package = "com.example.doc.activities"

manifest

<provider      android:name="android.support.v4.content.fileprovider"      android:authorities="com.example.doc.fileprovider"      android:exported="false"      android:granturipermissions="true"       android:readpermission="com.example.doc.fileprovider.read">      <meta-data          android:name="android.support.file_provider_paths"          android:resource="@xml/filepath" />   </provider> 

res/xml/filepath.xml

<?xml version="1.0" encoding="utf-8"?> <paths xmlns:android="http://schemas.android.com/apk/res/android">     <files-path name="files" path="." /> </paths> 

activity

//tempfilepath = /data/data/com.example.doc/files/rbc/sample.docx  file file = new file(tempfilepath);          uri exporturi = fileprovider.geturiforfile (this, "com.example.doc.fileprovider", file);  intent docviewintent = new intent(); docviewintent.setaction(intent.action_view); docviewintent.setdataandtype(exporturi , extensiontype); docviewintent.addflags(intent.flag_grant_read_uri_permission | intent.flag_grant_write_uri_permission); docviewintent.addflags(intent.flag_activity_new_task); startactivity(docviewintent); 

do need specify permission in manifest?

any appreciated..

thanks jomia


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -