[펌] Unity 런타임 중 AndroidManifest.xml에서 meta-data 정보 읽어오기.
Unity3D/Script / 2019. 12. 4. 20:23
// AndroidManifext.xml
// <meta-data android:name="aa.bb.channelid" android:value="D4LW023" />
// <meta-data android:name="aa.bb.subchannelid" android:value="1" />
AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
string packageName = activity.Call<string>("getPackageName");
AndroidJavaObject manager = activity.Call<AndroidJavaObject>("getPackageManager");
AndroidJavaObject packageInfo = manager.Call<AndroidJavaObject>("getApplicationInfo", packageName, manager.GetStatic<int>("GET_META_DATA"));
AndroidJavaObject aBundle = packageInfo.Get<AndroidJavaObject>("metaData");
string strChannelId = aBundle.Call<string>("getString", "aa.bb.channelid"); // string
int iSubChannelId = aBundle.Call<int>("getInt", "aa.bb.subchannelid"); // int
[정보제공] 게임코디-선후님
반응형
'Unity3D > Script' 카테고리의 다른 글
[링크] Unity 자이로 & 가속도 센서 관련 (0) | 2020.06.09 |
---|---|
[Unity] 회전 없이 유도(Guided/Homing) 이동 로직 (0) | 2020.05.26 |
[펌] Is there an isPlaying() type function for Animator (0) | 2019.11.13 |
[펌] PostProcessing iOS Activate Background Mode for Push Notifications (0) | 2019.06.04 |
XCode-Capabilities-Push Notifications를 기본 ON 하는 방법 (0) | 2019.06.04 |