1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
private void SendEmail(string emailAddress, string emailTitle, string emailBody)
{
using (var intentClass = new AndroidJavaClass("android.content.Intent"))
{
using (var intentObject = new AndroidJavaObject("android.content.Intent", intentClass.GetStatic<string>("ACTION_SENDTO")))
{
var uriClass = new AndroidJavaClass("android.net.Uri");
var uriObject = uriClass.CallStatic<AndroidJavaObject>("parse", "mailto:");
intentObject.Call<AndroidJavaObject>("setData", uriObject);
intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_SUBJECT"), emailTitle);
string[] email = { emailAddress };
intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_EMAIL"), email);
intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_TEXT"), emailBody);
using (var unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"))
{
using (var currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity"))
{
currentActivity.Call("startActivity", intentObject);
}
}
}
}
}
|
cs |
'개발 > Unity' 카테고리의 다른 글
[Unity] Inspector의 속성 on/off (0) | 2021.01.11 |
---|---|
[Unity] open android app intent (0) | 2020.12.15 |
[Unity] 3D 오브젝트를 캔버스에 위치시키기 (0) | 2020.10.13 |
[Unity] set screen orientation (0) | 2019.05.24 |
[Unity] cannot click button (0) | 2019.05.23 |