• Unity 中检测Google Play 服务是否可用


    问题回答链接:https://github.com/playgameservices/play-games-plugin-for-unity/issues/715

        public static bool IsPlayServicesAvailable()
        {
            const string GoogleApiAvailability_Classname = "com.google.android.gms.common.GoogleApiAvailability";
            AndroidJavaClass clazz = new AndroidJavaClass(GoogleApiAvailability_Classname);
            AndroidJavaObject obj = clazz.CallStatic<AndroidJavaObject>("getInstance");
            var androidJC = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            var activity = androidJC.GetStatic<AndroidJavaObject>("currentActivity");
            int value = obj.Call<int>("isGooglePlayServicesAvailable", activity);
            // 0 == success
            // 1 == service_missing
            // 2 == update service required
            // 3 == service disabled
            // 18 == service updating
            // 9 == service invalid
            Debug.Log("GALogController Log IsPlayServicesAvailable value:" + value);
            return value == 0;
        }
  • 相关阅读:
    Linux下的MySQL主从同步
    人不能同时在两个地方做猪(Scrum Team)
    memcache安装
    Java开发中的Memcache原理及实现
    linux mv
    nginx
    idea 热部署
    vue watch
    vue入门
    基于vue-cli快速构建
  • 原文地址:https://www.cnblogs.com/sy-liu/p/14596949.html
Copyright © 2020-2023  润新知