Android Question share PDF file

Discussion in 'Android Questions' started by Kiran Raotole, Sep 21, 2018.

  1. Kiran Raotole

    Kiran Raotole Active Member Licensed User

    I have this code its open PDF file
    Code:
    Dim in As Intent
        
    in.Initialize(in.ACTION_VIEW,f1.CreateFileProviderUri(Starter.shared,"1.pdf"))
        
    in.Flags=1
        
    StartActivity(in)
    I have to share PDF file
    I try like this
    Code:
    in.Initialize(in.ACTION_SEND,f1.CreateFileProviderUri(Starter.shared,"1.pdf"))
        
    in.SetType("application/pdf")
        
    'in.Flags=1
        in.Flags=1
        
    StartActivity(in)
    Buts open app selection, I select Whatsapp app and select contant, But then its close WhatsApp
    Whats a Problem?
     
  2. DonManfred

    DonManfred Expert Licensed User

    Upload a small project which shows the problem.

    It is hard to help with this less on information.
     
    BillMeyer likes this.
  3. Kiran Raotole

    Kiran Raotole Active Member Licensed User

     

    Attached Files:

  4. asales

    asales Well-Known Member Licensed User

    My code (works fine to share with WhatsApp):
    Code:
    Sub Button2_Click
        
    If Not (File.Exists(Starter.shared,"1.pdf")) Then
            
    File.Copy(File.DirAssets,"1.pdf",Starter.shared,"1.pdf")
        
    End If

        
    Dim in As Intent
        
    in.Initialize(in.ACTION_SEND,"")
        
    in.SetType("application/pdf")
        
    in.SetComponent("")
        
    in.PutExtra("android.intent.extra.STREAM", CreateFileProviderUri(Starter.shared,"1.pdf"))

        
    in.Flags=1
        
    StartActivity(in)
    End Sub
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice