Cross Platform Native Plugins
A true cross platform tool for Unity which provides unique and unified way to access native functionality on mobile platforms.
Public Member Functions | Properties | List of all members
WhatsAppShareComposer Class Reference

Provides an interface to share contents on WhatsApp. More...

Public Member Functions

 WhatsAppShareComposer ()
 Initializes a new instance of the WhatsAppShareComposer class. More...
 
override void AttachImage (Texture2D _texture)
 Adds the specified image to the post. More...
 

Properties

string Text [get, set]
 The string holds the message to be shared on WhatsApp. More...
 
byte[] ImageData [get]
 The raw data of the image to be shared on WhatsApp. More...
 
- Properties inherited from IShareView
bool IsReadyToShowView [get]
 A bool value that indicates whether this instance is ready to present composer view. (read-only) More...
 

Detailed Description

Provides an interface to share contents on WhatsApp.

The following code example shows how to compose a text message for sharing on WhatsApp.

using System.Collections;
public class ExampleClass : MonoBehaviour
{
public void ShareViaWhatsApp ()
{
if (NPBinding.Sharing.IsWhatsAppServiceAvailable())
{
// Create new instance and populate fields
_composer.Text = "This is a test message.";
// Show composer
NPBinding.Sharing.ShowView(_composer, FinishedSharing);
}
else
{
// Device doesn't support sharing on WhatsApp
}
}
private void OnFinishedSharing (eShareResult _result)
{
// Insert your code
}
}
Note
At this point, WhatsApp allows external applications to share either text message or image, but not both.

Constructor & Destructor Documentation

Initializes a new instance of the WhatsAppShareComposer class.

Member Function Documentation

override void AttachImage ( Texture2D  _texture)

Adds the specified image to the post.

Parameters
_textureUnity texture object that has to be shared.

Property Documentation

string Text
getset

The string holds the message to be shared on WhatsApp.

byte [] ImageData
get

The raw data of the image to be shared on WhatsApp.