Hi,
I am trying to send a pdf in files folder thru WhatsApp as below but it shows "No app can perform this action" .
In starter I have only declared
Dim Provider as FileProvider
In Manifest
In btnSend_Click
I think i am missing something. Erel has mentioned files-path=File.DirInternal. I am not using that folder.
Can someone pls give some clue.
Thanks
Juzer
I am trying to send a pdf in files folder thru WhatsApp as below but it shows "No app can perform this action" .
In starter I have only declared
Dim Provider as FileProvider
In Manifest
B4X:
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,
<files-path name="name" path="shared" />
)
In btnSend_Click
B4X:
Sub SendPDF(sNumber As String)
Starter.provider.Initialize
File.Copy(File.dirassets,"document.pdf",Starter.Provider.SharedFolder,"document.pdf")
Dim sendIntent As Intent
sendIntent.Initialize(sendIntent.ACTION_MAIN,"")
sendIntent.Action=sendIntent.ACTION_SEND
sendIntent.SetPackage("com.whatsapp")
sendIntent.SetComponent("android/com.android.internal.app.ResolverActivity")
sendIntent.putExtra("jid", sNumber & "@s.whatsapp.net")
sendIntent.PutExtra("android.intent.extra.STREAM", Starter.Provider.GetFileUri("document.pdf"))
sendIntent.PutExtra("android.intent.extra.TEXT","")
sendIntent.SetType("application/pdf")
sendIntent.Flags=1
StartActivity(sendIntent)
End Sub
I think i am missing something. Erel has mentioned files-path=File.DirInternal. I am not using that folder.
Can someone pls give some clue.
Thanks
Juzer