- Home /
Question by
AwesomeAlexx · Dec 27, 2016 at 04:21 AM ·
androidshaderiossend message
Set default number/emails in a new text message/email sent via unity
Hello all,
Here the code I'm using to send message :
using UnityEngine;
using System.Collections;
public class ShareApp : MonoBehaviour {
string subject = "eg. subject";
string body = "eg. body text";
string numbers = "0600000000,060000001";
string emails = "emailOne, emailTwo";
public void shareText()
{
//execute the below lines if being run on a Android device
#if UNITY_ANDROID
//Reference of AndroidJavaClass class for intent
AndroidJavaClass intentClass = new AndroidJavaClass ("android.content.Intent");
//Reference of AndroidJavaObject class for intent
AndroidJavaObject intentObject = new AndroidJavaObject ("android.content.Intent");
//call setAction method of the Intent object created
intentObject.Call<AndroidJavaObject>("setAction", intentClass.GetStatic<string>("ACTION_SEND"));
//set the type of sharing that is happening
intentObject.Call<AndroidJavaObject>("setType", "text/plain");
//add data to be passed to the other activity i.e., the data to be sent
intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_SUBJECT"), subject);
intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_TEXT"), body);
//get the current activity
AndroidJavaClass unity = new AndroidJavaClass ("com.unity3d.player.UnityPlayer");
AndroidJavaObject currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity");
//start the activity by sending the intent data
currentActivity.Call ("startActivity", intentObject);
#endif
}
}
My problem right now is ... I'm really not an android developer :) , I really have any idea t set the numbers in text message or emails contacts in email ...
I'm am pretty lost ! Any help will be great Tks alex
Comment
Your answer
Follow this Question
Related Questions
Transparent Detail on mobile 0 Answers
Custom shader works in Unity but broken on ios/android 0 Answers
Glass material or shader for mobile? iOS Android 1 Answer
Specular bug on iOS/Android using Standard shader 2 Answers
Fluid Shader 2 Answers