Hi , I tried to use whatsapp with an intent it works fine, but of course if whatsapp is not installed
an error is generated com.whatsapp not found etc.
I searched the internet and found this code. :
I tried the following but it didn't work .
Anyone has an idea.
Joop
an error is generated com.whatsapp not found etc.
I searched the internet and found this code. :
B4X:
Public void onClickWhatsApp(View View) {
Intent waIntent = new Intent(Intent.ACTION_SEND);
waIntent.setType("text/plain");
String text = "YOUR TEXT HERE";
waIntent.setPackage("com.whatsapp");
If (waIntent != Null) {
waIntent.putExtra(Intent.EXTRA_TEXT, text);//
StartActivity(Intent.createChooser(waIntent, "Share with"));
} Else {
Toast.makeText(this, "WhatsApp not Installed", Toast.LENGTH_SHORT)
.show();
}
}
I tried the following but it didn't work .
B4X:
Sub Share_word_pass
Dim tx As String
Dim Intent1 As Intent
tx = "TEST"
Intent1.Initialize(Intent1.ACTION_SEND ,"")
Intent1.SetType("text/plain")
Intent1.SetComponent("com.whatsapp")
If Intent1 <> Null Then ' I don't think this is right
Intent1.SetComponent("com.whatsapp/.ContactPicker") 'ContactPicker
Intent1.PutExtra("android.intent.extra.TEXT",tx)
StartActivity(Intent1)
End If
End Sub
Anyone has an idea.
Joop