Android Question WhatsApp direct message

Zeev Goldstein

Well-Known Member
Licensed User
Longtime User
hi,

i see a few apps in google paly store that can send a message directly to a whatsapp number, without openning whatsapp or selecting the contact
is it doable with B4A ?

secondly - how can i check if WhatsApp is installed on the device ?

finally, if i must go throught whatsapp app - is there a way to return the focus to my app after sending ?
alternatively and even better - how can i return my app to focus after it was gone to background ?

many thanks
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You need to know the intent that whatsapp expects. Example: https://www.b4x.com/android/forum/threads/whatsapp-send-message-to-specific-phone-number.84398/
how can i check if WhatsApp is installed on the device ?
You can use PackageManager.GetInstalledPackages. You will need to first find whatsapp package name. Should be simple to do.

Another option is to try to send the intent and catch the error if the app is not installed.

finally, if i must go throught whatsapp app - is there a way to return the focus to my app after sending ?
alternatively and even better - how can i return my app to focus after it was gone to background ?
The behavior depends on whatsapp behavior. You don't control it. You can use a service to bring your app to the foreground after x seconds.
 
Upvote 0
Top