• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# UnityEngine.AndroidJavaClass类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中UnityEngine.AndroidJavaClass的典型用法代码示例。如果您正苦于以下问题:C# AndroidJavaClass类的具体用法?C# AndroidJavaClass怎么用?C# AndroidJavaClass使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



AndroidJavaClass类属于UnityEngine命名空间,在下文中一共展示了AndroidJavaClass类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Init

        public static void Init()
        {
            AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            if (jc == null)
            return;

            AndroidJavaObject joactivety = jc.GetStatic<AndroidJavaObject>("currentActivity");
            if (joactivety == null)
            return;
            AndroidJavaObject context = joactivety.Call<AndroidJavaObject>("getApplicationContext");
            // 初始化HttpDns
            AndroidJavaObject joDnsClass = new AndroidJavaObject("com.tencent.msdk.dns.MSDKDnsResolver");
            Debug.Log(" WGGetHostByName ===========" + joDnsClass);
            if (joDnsClass == null)
            return;
            m_dnsJo = joDnsClass.CallStatic<AndroidJavaObject>("getInstance");
            Debug.Log(" WGGetHostByName ===========" + m_dnsJo);
            if (m_dnsJo == null)
            return;
            m_dnsJo.Call("init", context);
            // 初始化灯塔
            AndroidJavaObject joBeaconClass = new AndroidJavaObject("com.tencent.beacon.event.UserAction");
            if (joBeaconClass == null)
            return;
            m_dnsJo.Call("initUserAction", context);
        }
开发者ID:XClouded,项目名称:httpdns-android-sdk,代码行数:26,代码来源:HttpDns.cs


示例2: Share

    public void Share(string shareText, string imagePath, string url, string subject = "")
    {
        #if UNITY_ANDROID
        AndroidJavaClass intentClass = new AndroidJavaClass("android.content.Intent");
        AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent");

        intentObject.Call<AndroidJavaObject>("setAction", intentClass.GetStatic<string>("ACTION_SEND"));
        AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri");
        AndroidJavaObject uriObject = uriClass.CallStatic<AndroidJavaObject>("parse", "file://" + imagePath);
        intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_STREAM"), uriObject);
        intentObject.Call<AndroidJavaObject>("setType", "image/png");

        intentObject.Call<AndroidJavaObject>("putExtra", intentClass.GetStatic<string>("EXTRA_TEXT"), shareText);

        AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject currentActivity = unity.GetStatic<AndroidJavaObject>("currentActivity");

        AndroidJavaObject jChooser = intentClass.CallStatic<AndroidJavaObject>("createChooser", intentObject, subject);
        currentActivity.Call("startActivity", jChooser);
        #elif UNITY_IOS
        CallSocialShareAdvanced(shareText, subject, url, imagePath);
        #else
        Debug.Log("No sharing set up for this platform.");
        #endif
    }
开发者ID:sebit0nic,项目名称:Sunday-Driver,代码行数:25,代码来源:ShareImageCanvas.cs


示例3: Initialize

		public static void Initialize() {
			SoomlaUtils.LogDebug(TAG, "Initializing CoreEvents and Soomla Core ...");
#if UNITY_ANDROID && !UNITY_EDITOR
			AndroidJNI.PushLocalFrame(100);

			using(AndroidJavaClass jniStoreConfigClass = new AndroidJavaClass("com.soomla.SoomlaConfig")) {
				jniStoreConfigClass.SetStatic("logDebug", CoreSettings.DebugMessages);
			}

			// Initializing SoomlaEventHandler
			using(AndroidJavaClass jniEventHandler = new AndroidJavaClass("com.soomla.core.unity.SoomlaEventHandler")) {
				jniEventHandler.CallStatic("initialize");
			}

			// Initializing Soomla Secret
			using(AndroidJavaClass jniSoomlaClass = new AndroidJavaClass("com.soomla.Soomla")) {
				jniSoomlaClass.CallStatic("initialize", CoreSettings.SoomlaSecret);
			}
			AndroidJNI.PopLocalFrame(IntPtr.Zero);
#elif UNITY_IOS && !UNITY_EDITOR
			soomlaCore_Init(CoreSettings.SoomlaSecret, CoreSettings.DebugMessages);
#elif UNITY_WP8 && !UNITY_EDITOR
            SoomlaWpCore.SoomlaConfig.logDebug = CoreSettings.DebugMessages;
            SoomlaWpCore.Soomla.initialize(CoreSettings.SoomlaSecret);
            BusProvider.Instance.Register(CoreEvents.instance);
#endif

        }
开发者ID:nickhester,项目名称:SocialNetwork,代码行数:28,代码来源:CoreEvents.cs


示例4: shareText

    public void shareText()
    {
        //execute the below lines if being run on a Android device
    #if UNITY_ANDROID
        body = "Faltan " + RolCountdownController.daysRemaining + " días, " + RolCountdownController.hoursRemaining + " horas y " + RolCountdownController.minutesRemaining + " minutos para las próxima roleada!";

        //Refernece of AndroidJavaClass class for intent
        AndroidJavaClass intentClass = new AndroidJavaClass ("android.content.Intent");
        //Refernece 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

    }
开发者ID:pravusjif,项目名称:PravusUnityTests,代码行数:25,代码来源:ShareApp.cs


示例5: _setFastestDurationMillis

		protected override void _setFastestDurationMillis(Level level, long duration) {
			AndroidJNI.PushLocalFrame(100);
			using(AndroidJavaClass jniLevelStorage = new AndroidJavaClass("com.soomla.levelup.data.LevelStorage")) {
				jniLevelStorage.CallStatic("setFastestDurationMillis", level.ID, duration);
			}
			AndroidJNI.PopLocalFrame(IntPtr.Zero);
		}
开发者ID:Ratel13,项目名称:unity3d-levelup,代码行数:7,代码来源:LevelStorageAndroid.cs


示例6: CheckReward

    public static string CheckReward()
    {
        #if UNITY_IPHONE && !UNITY_EDITOR
        return UnityShimOAD_CheckReward ();
        #endif
        #if UNITY_ANDROID
        AndroidJavaClass oadClass = new AndroidJavaClass("com.openadadapter.OpenAdAdapter");
        if (oadClass != null){

            bool b1 = oadClass.CallStatic<bool>("hasReward");

            if(!b1){
                return null;
            }

            AndroidJavaClass rwdClass = new AndroidJavaClass("com.openadadapter.Reward");
            if(rwdClass != null){
                AndroidJavaObject r1 = oadClass.CallStatic<AndroidJavaObject>("fetchReward");
                if (r1.GetRawObject().ToInt32() == 0){
                    return null;
                }
                //		float height = oadClass.CallStatic<float>("getBannerHeightInPoints");
                float amount = r1.Call<float>("getAmount");
                string network = r1.Call<string>("getNetwork");
                string currency = r1.Call<string>("getCurrency");

                return "amount\t" + amount + "\nnetwork\t" + network + "\ncurrency\t" + currency;
            }
        }
        #endif
        return null;
    }
开发者ID:OpenAdAdapter,项目名称:OAD-Unity-src,代码行数:32,代码来源:OpenAdAdapter.cs


示例7: OpenIAB_Android

        static OpenIAB_Android()
        {
            if (Application.platform != RuntimePlatform.Android)
            {
                STORE_GOOGLE = "STORE_GOOGLE";
                STORE_AMAZON = "STORE_AMAZON";
                STORE_SAMSUNG = "STORE_SAMSUNG";
                STORE_NOKIA = "STORE_NOKIA";
                STORE_YANDEX = "STORE_YANDEX";
                return;
            }

            AndroidJNI.AttachCurrentThread();

            // Find the plugin instance
            using (var pluginClass = new AndroidJavaClass("org.onepf.openiab.UnityPlugin"))
            {
                _plugin = pluginClass.CallStatic<AndroidJavaObject>("instance");
                STORE_GOOGLE = pluginClass.GetStatic<string>("STORE_GOOGLE");
                STORE_AMAZON = pluginClass.GetStatic<string>("STORE_AMAZON");
                STORE_SAMSUNG = pluginClass.GetStatic<string>("STORE_SAMSUNG");
                STORE_NOKIA = pluginClass.GetStatic<string>("STORE_NOKIA");
                STORE_YANDEX = pluginClass.GetStatic<string>("STORE_YANDEX");
            }
        }
开发者ID:Ixxy,项目名称:OpenIAB-Unity-Plugin,代码行数:25,代码来源:OpenIAB_Android.cs


示例8: NativeGetCppVersion

 public static void NativeGetCppVersion()
 {
     #if !UNITY_EDITOR && UNITY_ANDROID
     AndroidJavaClass jc = new AndroidJavaClass("com.snow.plugin.NativeBridge");
     jc.CallStatic("NativeGetCppVersion");
     #endif
 }
开发者ID:toxly,项目名称:unity-app,代码行数:7,代码来源:PlatformTools.cs


示例9: ForceLoadLowLevelBinary

			static public bool ForceLoadLowLevelBinary()
			{
				// This is a hack that forces Android to load the .so libraries in the correct order
#if UNITY_ANDROID && !UNITY_EDITOR
				FMOD.Studio.UnityUtil.Log("loading binaries: " + FMOD.Studio.STUDIO_VERSION.dll + " and " + FMOD.VERSION.dll);
				AndroidJavaClass jSystem = new AndroidJavaClass("java.lang.System");
				jSystem.CallStatic("loadLibrary", FMOD.VERSION.dll);
				jSystem.CallStatic("loadLibrary", FMOD.Studio.STUDIO_VERSION.dll);
#endif

				// Hack: force the low level binary to be loaded before accessing Studio API
#if !UNITY_IPHONE || UNITY_EDITOR
				FMOD.Studio.UnityUtil.Log("Attempting to call Memory_GetStats");
				int temp1, temp2;
				if (!ERRCHECK(FMOD.Memory.GetStats(out temp1, out temp2)))
				{
					FMOD.Studio.UnityUtil.LogError("Memory_GetStats returned an error");
					return false;
				}
		
				FMOD.Studio.UnityUtil.Log("Calling Memory_GetStats succeeded!");
#endif
		
				return true;
			}
开发者ID:Backman,项目名称:Hellbound,代码行数:25,代码来源:FMOD_StudioSystem.cs


示例10: Initialize

		public static void Initialize() {
			SoomlaUtils.LogDebug (TAG, "SOOMLA/UNITY Initializing Highway");
#if UNITY_ANDROID && !UNITY_EDITOR
			AndroidJNI.PushLocalFrame(100);
			using(AndroidJavaClass jniGrowHighwayClass = new AndroidJavaClass("com.soomla.highway.GrowHighway")) {

				AndroidJavaObject jniGrowHighwayInstance = jniGrowHighwayClass.CallStatic<AndroidJavaObject>("getInstance");
				jniGrowHighwayInstance.Call("initialize", HighwaySettings.HighwayGameKey, HighwaySettings.HighwayEnvKey);

				// Uncomment this and change the URL for testing
//				using(AndroidJavaClass jniConfigClass = new AndroidJavaClass("com.soomla.highway.HighwayConfig")) {
//					AndroidJavaObject jniConfigObject = jniConfigClass.CallStatic<AndroidJavaObject>("getInstance");
//					jniConfigObject.Call("setUrls", "http://example.com", "http://example.com");
//				}

				jniGrowHighwayInstance.Call("start");
			}
			AndroidJNI.PopLocalFrame(IntPtr.Zero);
#elif UNITY_IOS && !UNITY_EDITOR
			growHighway_initialize(HighwaySettings.HighwayGameKey, HighwaySettings.HighwayEnvKey);

			// Uncomment this and change the URL for testing
//			growHighway_setHighwayUrl("http://example.com");
//			growHighway_setServicesUrl("http://example.com");

			growHighway_start();
#else
			SoomlaUtils.LogError(TAG, "Highway only works on Android or iOS devices !");
		//	UnityEditor.EditorApplication.isPlaying = false;
#endif
		}
开发者ID:Bakiet,项目名称:UnityZombieCross,代码行数:31,代码来源:GrowHighway.cs


示例11: Init

    public void Init()
    {
#if UNITY_ANDROID
        jc = new AndroidJavaClass("unityplugin.phuongnd.com.androidplugin.MainActivity");
        Debug.Log("JavaClass -----------------> " + jc);
#endif
    }
开发者ID:ndp1100,项目名称:ndp1100.github.io,代码行数:7,代码来源:EJSDKManager.cs


示例12: DataManager

 public DataManager(IntPtr dataManagerPtr, AndroidJavaObject dataManagerJavaObject)
 {
     innerDataManager = dataManagerPtr;
     innerDataManagerJavaObject = dataManagerJavaObject;
     if(javaUnityApplicasaDataManager==null)
         javaUnityApplicasaDataManager = new AndroidJavaClass("com.applicasaunity.Unity.ApplicasaDataManager");
 }
开发者ID:Applicasa,项目名称:Sample-App-Unity,代码行数:7,代码来源:DataManager.cs


示例13: Enable

		public static void Enable(bool enabled){
			AndroidJavaObject _plugin;
			using(var pluginClass = new AndroidJavaClass("com.zendesk.unity.ZDK_Plugin")){
				_plugin = pluginClass.CallStatic<AndroidJavaObject>("instance");
			}
			_plugin.Call("enableLogger", enabled);
		}
开发者ID:Jannizzle,项目名称:ZENDESK,代码行数:7,代码来源:ZDKLogger.cs


示例14: SendEmail

		public static void SendEmail(Email email)
		{
#if UNITY_IOS && !UNITY_EDITOR
			_opencodingConsoleBeginEmail(email.ToAddress, email.Subject, email.Message, email.IsHTML);
			foreach (var attachment in email.Attachments)
			{
				_opencodingConsoleAddAttachment(attachment.Data, attachment.Data.Length, attachment.MimeType, attachment.Filename);
			}
			_opencodingConsoleFinishEmail();
#elif UNITY_ANDROID && !UNITY_EDITOR
			AndroidJavaClass androidEmailClass = new AndroidJavaClass("net.opencoding.console.Email");
			
			androidEmailClass.CallStatic("beginEmail", email.ToAddress, email.Subject, email.Message, email.IsHTML);
			var emailAttachmentsDirectory = Path.Combine(Application.temporaryCachePath, "EmailAttachments");
			Directory.CreateDirectory(emailAttachmentsDirectory);
			foreach (var attachment in email.Attachments)
			{
				var attachmentPath = Path.Combine(emailAttachmentsDirectory, attachment.Filename);
				File.WriteAllBytes(attachmentPath, attachment.Data);
				androidEmailClass.CallStatic("addAttachment", attachmentPath);
			}

			androidEmailClass.CallStatic("finishEmail");
#else
			throw new InvalidOperationException("Emailing is not supported on this platform. Please contact [email protected] and I'll do my best to support it!");
#endif
		}
开发者ID:smclallen,项目名称:Galactic_Parcel_Service,代码行数:27,代码来源:NativeMethods.cs


示例15: OnclickButton

	// Use this for initialization
	public void OnclickButton()
    {
        using (AndroidJavaClass jc = new AndroidJavaClass("com.example.yoon.newgps.BridgeActivity"))
        {
            jc.CallStatic("SetToast", "hello world");
        }
    }
开发者ID:YoonDaewon,项目名称:cash-walk,代码行数:8,代码来源:Plugin.cs


示例16: Zip

    public static void Zip(string zipFileName, params string[] files)
    {
        #if UNITY_EDITOR || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX
        string path = Path.GetDirectoryName(zipFileName);
        Directory.CreateDirectory(path);

        using (ZipFile zip = new ZipFile())
        {
            foreach (string file in files)
            {
                zip.AddFile(file, "");
            }
            zip.Save(zipFileName);
        }
        #elif UNITY_ANDROID
        using (AndroidJavaClass zipper = new AndroidJavaClass ("com.tsw.zipper")) {
            {
                zipper.CallStatic ("zip", zipFileName, files);
            }
        }
        #elif UNITY_IPHONE
        foreach (string file in files) {
            addZipFile (file);
        }
        zip (zipFileName);
        #endif
    }
开发者ID:hybrid1969,项目名称:Polimi-OSM-City-Engine,代码行数:27,代码来源:UniZip.cs


示例17: showAlertDialog

        public static void showAlertDialog(String parameters)
        {
            AndroidJNI.AttachCurrentThread();

                AndroidJavaClass uiClass = new AndroidJavaClass("com.gamedonia.utilities.GamedoniaUI");
                uiClass.CallStatic("showAlertDialog",new object [] {parameters});
        }
开发者ID:Derojo,项目名称:Medical,代码行数:7,代码来源:GamedoniaUI.cs


示例18: Initialize

		public static void Initialize() {
			if (Instance == null) {
				Instance = GetSynchronousCodeGeneratedInstance<CoreEvents>();
				SoomlaUtils.LogDebug(TAG, "Initializing CoreEvents and Soomla Core ...");
#if UNITY_ANDROID && !UNITY_EDITOR
				AndroidJNI.PushLocalFrame(100);
				
				using(AndroidJavaClass jniStoreConfigClass = new AndroidJavaClass("com.soomla.SoomlaConfig")) {
					jniStoreConfigClass.SetStatic("logDebug", CoreSettings.DebugMessages);
				}
				
				// Initializing SoomlaEventHandler
				using(AndroidJavaClass jniEventHandler = new AndroidJavaClass("com.soomla.core.unity.SoomlaEventHandler")) {
					jniEventHandler.CallStatic("initialize");
				}
				
				// Initializing Soomla Secret
				using(AndroidJavaClass jniSoomlaClass = new AndroidJavaClass("com.soomla.Soomla")) {
					AndroidJavaClass jc = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); 
					AndroidJavaObject currentActivity = jc.GetStatic<AndroidJavaObject>("currentActivity");
					jniSoomlaClass.CallStatic("initialize", currentActivity, CoreSettings.SoomlaSecret);
				}
				AndroidJNI.PopLocalFrame(IntPtr.Zero);
#elif UNITY_IOS && !UNITY_EDITOR
				soomlaCore_Init(CoreSettings.SoomlaSecret, CoreSettings.DebugMessages);
#elif UNITY_WP8 && !UNITY_EDITOR
				SoomlaWpCore.SoomlaConfig.logDebug = CoreSettings.DebugMessages;
				SoomlaWpCore.Soomla.initialize(CoreSettings.SoomlaSecret);
				BusProvider.Instance.Register(CoreEvents.instance);
#endif
			}
        }
开发者ID:Faisalimrann,项目名称:Shop,代码行数:32,代码来源:CoreEvents.cs


示例19: GetRanking

		public static void GetRanking(string gameObjectName,
		                              string callbackMethodName,
		                              string rankingId,
		                              RankingRange type,
		                              RankingCursorOrigin origin,
		                              int cursor,
		                              int limit){
			#if UNITY_ANDROID
			AndroidJavaClass nakamapClass = new AndroidJavaClass("com.kayac.lobi.sdk.ranking.unity.LobiRankingBridge");  
			nakamapClass.CallStatic("getRanking", gameObjectName, callbackMethodName, "id", rankingId, (int)type, (int)origin, cursor, limit);
			#endif
			
			#if ((UNITY_IOS || UNITY_IPHONE) && ! UNITY_EDITOR)
			byte[] cGameObjectName     = System.Text.Encoding.UTF8.GetBytes(gameObjectName);
			byte[] cCallbackMethodName = System.Text.Encoding.UTF8.GetBytes(callbackMethodName);
			byte[] cRankingId          = System.Text.Encoding.UTF8.GetBytes(rankingId);
			LobiRanking_get_ranking_(cGameObjectName, cGameObjectName.Length,
			                         cCallbackMethodName, cCallbackMethodName.Length,
			                         cRankingId, cRankingId.Length,
			                         (int)type,
			                         (int)origin,
			                         cursor,
			                         limit);
			#endif
		}
开发者ID:3nan,项目名称:unity_practice,代码行数:25,代码来源:LobiRankingAPIBridge.cs


示例20: Unzip

    public static void Unzip(string zipFilePath, string location)
    {
        Debug.Log ("Entrando en unzip");
        #if UNITY_ANDROID
        using (AndroidJavaClass zipper = new AndroidJavaClass ("com.tsw.zipper")) {
            zipper.CallStatic ("unzip", zipFilePath, location);
        }
        #elif UNITY_IPHONE
        unzip (zipFilePath, location);
        #else
        Debug.Log ("UNZIP WINDOWS");
        Directory.CreateDirectory (location);

        Debug.Log ("DIRECTORIO CREADO");

        using (ZipFile zip = ZipFile.Read (zipFilePath)) {
            //current = zip;
            zip.ExtractAll (location, ExtractExistingFileAction.OverwriteSilently);
        }

        Debug.Log ("TERMINADO");

        /*int n;
        using(ZipFile zip = ZipFile.Read(zipFilePath))
        {
            zip.ExtractProgress += zip_ExtractProgress;
            n = 0;
            foreach (ZipEntry entry in zip)
            {
                n++;
                entry.Extract(location, ExtractExistingFileAction.OverwriteSilently);
                }
        }*/
        #endif
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:35,代码来源:Zip.cs



注:本文中的UnityEngine.AndroidJavaClass类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# UnityEngine.AndroidJavaObject类代码示例发布时间:2022-05-26
下一篇:
C# UnityEditorInternal.ReorderableList类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap