Hi,
Using code like this:
My manifest:
I have 2 problems to solve:
1) on my physical device, when launch the apk, after requesting the app to use to open, I can see the Adobe pdf app icone 1 second and nothing more.
My pdf file is well stored and I can open it directly via adobe reader
2) How to get adobe reader on Android emulator for my test in debug mode ?
Thanks in advance for your help
Using code like this:
B4X:
Sub Activity_Create(FirstTime As Boolean)
File.Copy(File.DirAssets,"2.pdf",Starter.Shared,"2.pdf")
Dim intent As Intent
intent.Initialize(intent.ACTION_VIEW,CreateFileProviderUri(Starter.Shared,"2.pdf"))
intent.SetType("application/pdf")
intent.WrapAsIntentChooser("Choose PDF Viewer")
StartActivity(intent)
End Sub
Sub CreateFileProviderUri (Dir As String, FileName As String) As Object
Dim FileProvider As JavaObject
Dim context As JavaObject
context.InitializeContext
FileProvider.InitializeStatic("android.support.v4.content.FileProvider")
Dim f As JavaObject
f.InitializeNewInstance("java.io.File", Array(Dir, FileName))
Return FileProvider.RunMethod("getUriForFile", Array(context, Application.PackageName & ".provider", f)) 'ERROR HERE
End Sub
My manifest:
AddManifestText(<uses-permission
android:name="android.permission.WRITE_EXTERNAL_STORAGE"
android:maxSdkVersion="18" />
)
AddApplicationText(
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="$PACKAGE$.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/provider_paths"/>
</provider>
)
CreateResource(xml, provider_paths,
<external-files-path name="name" path="" />
)
I have 2 problems to solve:
1) on my physical device, when launch the apk, after requesting the app to use to open, I can see the Adobe pdf app icone 1 second and nothing more.
My pdf file is well stored and I can open it directly via adobe reader
2) How to get adobe reader on Android emulator for my test in debug mode ?
Thanks in advance for your help