Skip to main content
se añadieron 5196 caracteres en el cuerpo
Origen Enlace

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

muchas gracias

Mi 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

Origen Enlace

No abre pdf con Lector de PDF de Drive en android 10

estoy realizando una app donde se generan archivos de tipo .pdf y .doc.

Si utilizo un móvil con android 10, cuando intento abrir desde la app los doc generados no hay problema, la app me muestra aquellas aplicaciones que se pueden usar y con cualquiera puedo abrir los archivos, pero cuando se trata de tipo pdf, puedo abrir los archivos con cualquier app excepto si elijo la aplicación Lector de PDF de Drive.

Sin embargo si ejecuto mi aplicación en un móvil con android 9 no tengo ningún problema en abrir los .pdf con el Lector de PDF de Drive

Sé que android 10, por defecto, no se deja ver el almacenamiento completo y hay que poner en Manifest:

android:requestLegacyExternalStorage="true" esto ya lo tengo, no me dejaba crear los directorios y esta es la solución que encontré.

Me pregunto so no habrá alguna otra instrucción que incluir en Manifest para conseguir que la app por defecto de lector de pdf funcione en Android 10.

Llevo tiempo buscando una solución pero no encuentro nada. Os agradecería cualquier ayuda o pista para poder solucionar mi problema.

muchas gracias