muchas graciasMi código:
val file = File(Ruta)
val i = Intent()
i.action = android.content.Intent.ACTION_VIEW
if(Tipo.equals("pdf")){
i.setDataAndType(Uri.fromFile(file), "application/pdf")
i.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY) //incluido
val intent = Intent.createChooser(i, "Open File") // incluido
context.startActivity(intent)
}else {
i.setDataAndType(Uri.fromFile(file), "text/*")
context.startActivity(i)
}
el log que obtengo:
```2020-10-11 23:03:14.999 29690-7953/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed)
2020-10-11 23:03:15.044 29690-29690/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed)
2020-10-11 23:03:15.164 29690-30008/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-10-11 23:03:15.327 29690-7721/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-10-11 23:03:15.327 29690-7721/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-10-11 23:03:15.328 29690-7721/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
2020-10-11 23:03:15.352 29690-29690/com.martruchagr.mitraductor I/chatty: uid=10309(com.martruchagr.mitraductor) identical 1 line
2020-10-11 23:03:15.548 1525-1525/? I/chatty: uid=1000(system) com.android.systemui identical 5 lines
2020-10-11 23:03:15.622 2336-2421/? E/octvm: open /sys/class/power_supply/battery/status error, Permission denied
2020-10-11 23:03:15.618 2336-2336/? W/Binder:2336_1: type=1400 audit(0.0:4752): avc: denied { search } for name="battery" dev="sysfs" ino=14880 scontext=u:r:mcd:s0 tcontext=u:object_r:sysfs_batteryinfo:s0 tclass=dir permissive=0
2020-10-11 23:03:15.624 2336-2421/? E/octvm: open /sys/class/power_supply/battery/status error, Permission denied
2020-10-11 23:03:15.622 2336-2336/? W/Binder:2336_1: type=1400 audit(0.0:4753): avc: denied { search } for name="battery" dev="sysfs" ino=14880 scontext=u:r:mcd:s0 tcontext=u:object_r:sysfs_batteryinfo:s0 tclass=dir permissive=0
2020-10-11 23:03:15.734 8009-8009/? W/DocumentService: type=1400 audit(0.0:4754): avc: denied { search } for name="theme" dev="sdc46" ino=3112969 scontext=u:r:isolated_app:s0:c74,c291,c512,c768 tcontext=u:object_r:theme_data_file:s0 tclass=dir permissive=0
2020-10-11 23:03:15.778 8009-8009/? W/DocumentService: type=1400 audit(0.0:4758): avc: denied { search } for name="theme" dev="sdc46" ino=3112969 scontext=u:r:isolated_app:s0:c74,c291,c512,c768 tcontext=u:object_r:theme_data_file:s0 tclass=dir permissive=0
2020-10-11 23:03:15.817 8009-8009/? E/libc: Access denied finding property "ro.vendor.df.effect.conflict"
2020-10-11 23:03:15.839 30266-8008/? E/DisplayData: openFd: java.io.FileNotFoundException: open failed: EACCES (Permission denied)
2020-10-11 23:03:15.845 1687-1715/? I/chatty: uid=10068(com.miui.home) FinalizerDaemon identical 3 lines
2020-10-11 23:03:15.854 2336-2421/? E/octvm: open /sys/class/power_supply/battery/status error, Permission denied
2020-10-11 23:03:15.856 2336-2421/? E/octvm: open /sys/class/power_supply/battery/status error, Permission denied
2020-10-11 23:03:16.446 29690-7953/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed)
2020-10-11 23:03:16.463 29690-29690/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->compareAndSwapObject(Ljava/lang/Object;JLjava/lang/Object;Ljava/lang/Object;)Z (greylist, linking, allowed)
2020-10-11 23:03:16.551 29690-5641/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->putObject(Ljava/lang/Object;JLjava/lang/Object;)V (greylist, linking, allowed)
2020-10-11 23:03:16.643 29690-7799/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->getInt(Ljava/lang/Object;J)I (greylist, linking, allowed)
2020-10-11 23:03:16.643 29690-7799/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->putInt(Ljava/lang/Object;JI)V (greylist, linking, allowed)
2020-10-11 23:03:16.644 29690-7799/com.martruchagr.mitraductor W/agr.mitraducto: Accessing hidden method Lsun/misc/Unsafe;->putLong(Ljava/lang/Object;JJ)V (greylist, linking, allowed)
2020-10-11 23:03:16.703 29690-7992/com.martruchagr.mitraductor I/chatty: uid=10309(com.martruchagr.mitraductor) AdWorker(Defaul identical 1 line
muchas gracias