Android Question Using intent to send text to whatsapp, viber, skype, facebook, SMS default app?

AlbertMHaim

New Member
Licensed User
Longtime User
How do you open the following apps (using intents) to a specific contact in whatsapp, viber, skype, facebook, SMS default app? I want to open those apps to the specific contact I set, so that those apps are ready to send a message when I write it into them. But want the contact to appear in the message automatically before I send the message. What is the code for this? Thanks.
 

AlbertMHaim

New Member
Licensed User
Longtime User
I found this code on the internet but it's not for b4A. Can anyone translate it into B4A?

This code opens welcome screen for specified contact

String sphone ="12345678";Uri uri =Uri.parse("tel:"+Uri.encode(sphone));Intent intent =newIntent("android.intent.action.VIEW");
intent.setClassName("com.viber.voip","com.viber.voip.WelcomeActivity");
intent.setData(uri);
context.startActivity(intent);
but user should click button "free call" to start call.
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Try this:
B4X:
Dim i As Intent

i.Initialize(i.ACTION_VIEW, "tel:1231231234")
i.SetComponent("com.viber.voip/.WelcomeActivity")

StartActivity(i)
I don't have Viber, so, the code is untested.
 
Last edited:
Upvote 0

AlbertMHaim

New Member
Licensed User
Longtime User
Try this:
B4X:
Dim i As Intent

i.Initialize(i.ACTION_VIEW, "tel:1231231234")
i.SetComponent("com.viber.voip/.WelcomeActivity")

StartActivity(i)
I don't have Viber, so, the code is untested.


Unfortunately, it crashes the program.
 
Upvote 0
Top