I am trying to implement a way to open a PDF Reader for some files located in /Android/data/package.name/files/. I have failed at using a proper FileProvider, but I found that just added content:// did the job. But for some reason, it can't open some of them, and I can't understand why.
File file=new File("Direct path to file as string");
if(file.exists()){  ///Yes, File Exists
            try {
                Intent intent = new Intent(Intent.ACTION_VIEW);
                Log.v("Authority", context.getApplicationContext().getPackageName());
                Log.v("URI", Util.UriForFile(context, file).toString());
                intent.setDataAndType(Util.UriForFile(context, file), "application/pdf");
                intent.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
                context.startActivity(intent);
            } catch (ActivityNotFoundException e) {
                parent.alert(context.getString(R.string.error_nopdfreader));
            }
}
and the actual method Util.UriForFile:
public static Uri UriForFile(Context context, File file){
    return Uri.parse("content://"+file.getAbsolutePath());
//        if(context==null)
//            Log.v("Util", "Context is null");
//
//        if(file==null)
//            Log.v("Util", "File is null");
//
//        if(context.getApplicationInfo()==null)
//            Log.v("Util", "getApplicationInfo is null");
//
 //        return FileProvider.getUriForFile(context,  context.getApplicationInfo().packageName+".provider", file);
}