B4A Library WhatsApp Library

WhatsApp Library
Version: 1.1

This is a wrapper for this Github-project.


2015-03-07 22.12.56.png




WhatsApp
Author:
Devil-App
Version: 1.1
  • Whatsapp
    Fields:
    • AUDIO_TYPE As Int
    • IMAGE_TYPE As Int
    • VIDEO_TYPE As Int
    Methods:
    • OpenChatWithNumber (phoneNumber As String)
      Open Chat with Number
      Example:<code>
      Dim whapp As WhatsApp
      whapp.OpenChatWithNumber("+39334336444")</code>
    • createPhoneNumber (displayName As String, mobileNumber As String, email As String)
      This method create a contact.
      Example:<code>
      Dim whapp As WhatsApp
      whapp.createPhoneNumber("Devil","+393343365647","[email protected]"</code>
    • existPhoneNumber (phoneNumber As String) As Boolean
      This method determines if a mobileNumber is a contact.
      Example:<code>
      Dim whapp As WhatsApp
      if whapp.existPhoneNumber("+393343365647") then MsgBox("Ok","msg")</code>
    • isInstalled As Boolean
      This method determines if Whatssap are installed.
      Example:<code>
      Dim whapp As WhatsApp
      if whapp.isInstalled then MsgBox("Installed","Msg")</code>
    • launchMarket
      This method go to Market.
      Example:<code>
      Dim whapp As WhatsApp
      whapp.launchMarket</code>
    • shareMediaWithContact (uri As Uri, mediaType As Int)
      Share Media with Contact
      Example:<code>
      Example: shareMediaWithContact(Activity.this, uriMedia, IMAGE_TYPE);
      Example: shareMediaWithContact(Activity.this, uriMedia, AUDIO_TYPE);
      Example: shareMediaWithContact(Activity.this, uriMedia, VIDEO_TYPE);
      Dim whapp As WhatsApp
      whapp.shareMediaWithContact(uriMedia, whapp.VIDEO_TYPE)</code>
    • shareTextWithContact (text As String)
      Share Text with Contact
      Example:<code>
      Dim whapp As WhatsApp
      whapp.shareTextWithContact("Hi...how are you")</code>
    Permissions:
    • android.permission.READ_CONTACTS
    • android.permission.SEND_SMS
    • android.permission.WRITE_CONTACTS

Example ( with mp4, mp3 example 3.7 Mb ) and so you can download here: Devil-App
Library in attachment
LAST REL 1.1
Bye
Marco
 

Attachments

  • WhatsApp-Library.zip
    4.2 KB · Views: 2,225
  • WhatsApp-Lib1.1.zip
    4.3 KB · Views: 2,669
  • Whatsapp-Source.zip
    6.8 KB · Views: 2,448
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
Hello Marco Rome (Italy?)
I did not understand when and how to send messages automatically without having to open the application?
Basically, I would like to send the same message to a list of contacts.
thank you
roberto
Hi Roberto.
"I would like to send the same message to a list of contacts."
For now isnt possible. But in #1 Post in attachment you have source, you work about this ;)
Bye
Marco
 

MarcoRome

Expert
Licensed User
Longtime User
Hi Rick. When i wrote this library i dont place your question. Well... said that the answer to your question may be found in the following documents.
I see in THIS DOCUMENT:
  • Sending too many messages to users who do not have your number saved in their address books. Make sure that you ask all of your WhatsApp contacts to add your current number to their address books.
  • Being blocked by too many people in a short period of time. Make sure you only communicate with people who want to receive messages from you.
  • Creating too many groups that contain users who do not list you in their address books. Make sure that you ask all of your WhatsApp contacts to add your current number to their address books.
  • Sending the same message to too many people. Use Broadcast Lists to send the same message to your contacts.
  • You may have violated our Terms of Service.

Look also TERMS OF SERVICE Whats App
in this document i read:
....You agree not to use or launch any automated system, including without limitation, "robots," "spiders," "offline readers," etc. or "load testers" such as wget, apache bench, mswebstress, httpload, blitz, Xcode Automator, Android Monkey, etc., that accesses the Service in a manner that sends more request messages to the WhatsApp servers in a given period of time than a human can reasonably produce in the same period by using a WhatsApp application, and you are forbidden from ripping the content unless specifically allowed.....


Regards
Marco
 

pesquera

Active Member
Licensed User
Longtime User
This library is a wrapper for this project Github-project. In this project isnt present this function "direct"
Unfortunately there is no "direct call" as you desire, or rather it is not documented anywhere (i haven't found the same working).
In any case, if you can find something working i can integrate it into the library.

Hi, I'm really interested on this "direct" functionality.. specially for sending messages.. does anyone have the solution?
 

MarcoRome

Expert
Licensed User
Longtime User
Me too! I tried this library today, but frankly so far I don't see much benefit from it. I want to send and receive messages via Whatsapp without Whatsapp itself popping up all the time. When sending a message, I still have to press the green Whatsapp button (or am I doing something wrong?).

Whatsapp also does not report back any errors to your library nor shows incoming messages. For example, it took me a while to figure out how to avoid the "non existing" number error by adding the "+" sign in stead of "00" in front of the (compulsary) country code.

I want to use your library in my app, such that my blind customers can use Whatsapp. Any ideas?

I still have to press the green Whatsapp button (or am I doing something wrong?).
For this the library isnt "direct" because you need to interact with whatsapp
 

asales

Expert
Licensed User
Longtime User
I don't think that direct functionality is a good option, because the user (or the app) could be banned.

See this FAQ about Whatsapp Plus:
https://www.whatsapp.com/faq/en/general/105

"WhatsApp Plus is an application that was not developed by WhatsApp, nor is it authorized by WhatsApp (...)"

If you create an app that no need to interact with Whatsapp, I think there will be a problem.

What do you think?
 
Last edited:

MarcoRome

Expert
Licensed User
Longtime User
To my opinion there is no problem of this library interacting with WhatsApp, however I believe the library will be of far more value if:
1. it can send a message (start a chat) to any Whatsapp user without the need to do anything manually in Whatsapp.
2. it can receive incoming Whatsapp messages.
3. It can handle Whatsapp error messages (like reporting of non-existing user id numbers).

In my case I want to add Whatsapp functionality to my app for blind and visually impaired users, i.e. make a wrapper.
My app uses speech recognition, so the user could speak the name (or number) of the Whatsapp user and dictate the message.
If my app could monitor incoming Whatsapp messages then the TTS voice could automatically read incoming messages aloud, just like it already does with SMS messages (Ref: http://www.artipal.com)

It wouldn't harm if Whatsapp briefly appears on the screen, as long as my app can automatically return back on the foreground within a few seconds, such that the user can touch the screen to speak a command or ask a question.

However, I have a feeling that I am asking too much and these functions are not implementable due to the limitations Whatsapp has imposed. As it stands, I don't really think the current library has much to offer, because: why type in a number and message in a B4A app if it cannot be processed by Whatsapp? One might as well directly access Whatsapp to do so. An intent to startup Whatsapp is all that is needed. If I am overlooking something then please tell me so!

...If my app could monitor incoming Whatsapp messages then the TTS voice could automatically read incoming messages aloud...
This is already possibile without problem. Look NotificationService
 

MarcoRome

Expert
Licensed User
Longtime User
You're answer is cryptic. What you mean is that these requested functions (1 and 3) are impossible to realize.
I was expecting a lot from your library, but sadly it does not fulfil any of my requirements and in fact I fail to see its use in most other circumstances. Sorry if this sounds a bit harsh, because you have done what you could. It is what it is.
Rick in #9 i write:
This library is a wrapper for this project Github-project. In this project isnt present this function "direct"
Unfortunately there is no "direct call" as you desire, or rather it is not documented anywhere (i haven't found the same working).
In any case, if you can find something working i can integrate it into the library.
I dont see nothing that is cryptic. You can try search about internet if exist "direct call". If you found this ... tell me.
Thats all.
 

MarcoRome

Expert
Licensed User
Longtime User
Do you have any more ideas on how to improve your library, i.e. to enable receiving and sending messages from/to the Whatsapp App without the need for any manual interventions by the user? I.e. it would be nice if your library can act as if an Intent is sent to Whatsapp.

already answered ( look #35 ):

You can try search about internet if exist "direct call". If you found this ... tell me.
 

luiswagnersantos

Member
Licensed User
Longtime User
Great. Good Work. Congratulations! Fantastic!
 

Ricardo Bunschoten

Active Member
Licensed User
Longtime User
If i use the function
  • OpenChatWithNumber (phoneNumber As String)
    Open Chat with Number
    Example:<code>
    Dim whapp As WhatsApp
    whapp.OpenChatWithNumber("+39334336444")</code>
And i dont have the contact in my adres list then whatsapp is giving me this message
Screenshot_2017-02-01-09-30-58.png


How to bypass this message ? without adding te contact to your adresbook ?
 

MarcoRome

Expert
Licensed User
Longtime User
If i use the function
  • OpenChatWithNumber (phoneNumber As String)
    Open Chat with Number
    Example:<code>
    Dim whapp As WhatsApp
    whapp.OpenChatWithNumber("+39334336444")</code>
And i dont have the contact in my adres list then whatsapp is giving me this message View attachment 52503

How to bypass this message ? without adding te contact to your adresbook ?
If it is not in your contact ISTN registered in Whatsapp. So is necessary
 
  • Like
Reactions: GIS
Top