Android Question Associating "pdf" to a certain software

vecino

Well-Known Member
Licensed User
Longtime User
Hello,
How do I tell him to "Android" to be opened the "PDF" files with a particular program/software?

Thanks for your help
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal & "/", "filename.pdf"))
i.SetComponent("android/com.android.internal.app.ResolverActivity")
i.SetType("application/pdf")
StartActivity(i)
Android will show all possible apps and the user needs to choose one
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Hi, thanks for your help.

Then that code, when I open a "PDF", what software will it open with?
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Thank you, I think that I don't say you well.
I have created a pdf viewer and I want that android used my pdf viewer that I have created. How do I say android that it use 'my software', solely?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
Thank you very much.
I've been watching that link, although it is very difficult for me :confused:
 
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
B4X:
Dim i As Intent
i.Initialize(i.ACTION_VIEW, "file://" & File.Combine(File.DirRootExternal & "/", "filename.pdf"))
i.SetComponent("android/com.android.internal.app.ResolverActivity")
i.SetType("application/pdf")
StartActivity(i)
Android will show all possible apps and the user needs to choose one

This is used to run another application?

Thank you
 
Last edited:
Upvote 0

vecino

Well-Known Member
Licensed User
Longtime User
I've already found.
B4X:
Dim pm As PackageManager
Dim In As Intent
In.Initialize("","")
In=pm.GetApplicationIntent("tutorial.user.com")
If In.IsInitialized Then
  StartActivity(In)
End If
 
Upvote 0
Top