Exemplo n.º 1
0
 static bool AndroidShowVideoAd(string zone_id)
 {
     jvalue[] args = new jvalue[1];
     args[0].l = AndroidJNI.NewStringUTF(zone_id);
     AndroidJNI.CallStaticBooleanMethod(class_UnityADC, method_showVideo, args);
     return(true);
 }
Exemplo n.º 2
0
 static bool AndroidShowV4VC(bool popup_result, string zone_id)
 {
     jvalue[] args = new jvalue[2];
     args[0].z = popup_result;
     args[1].l = AndroidJNI.NewStringUTF(zone_id);
     AndroidJNI.CallStaticBooleanMethod(class_UnityADC, method_showV4VC, args);
     return(true);
 }
Exemplo n.º 3
0
        public static T StaticInvokeCall <T>(string type, string name, string sig, params object[] args)
        {
            Type   t        = typeof(T);
            IntPtr rawClass = AndroidJNI.FindClass(type);
            IntPtr method   = AndroidJNI.GetStaticMethodID(rawClass, name, sig);

            jvalue[] jArgs = ConstructArgArray(args);

            if (t == typeof(bool))
            {
                return((T)(object)AndroidJNI.CallStaticBooleanMethod(
                           rawClass, method, jArgs));
            }
            else if (t == typeof(string))
            {
                return((T)(object)AndroidJNI.CallStaticStringMethod(
                           rawClass, method, jArgs));
            }
            else if (t == typeof(int))
            {
                return((T)(object)AndroidJNI.CallStaticIntMethod(
                           rawClass, method, jArgs));
            }
            else if (t == typeof(float))
            {
                return((T)(object)AndroidJNI.CallStaticFloatMethod(
                           rawClass, method, jArgs));
            }
            else if (t == typeof(double))
            {
                return((T)(object)AndroidJNI.CallStaticDoubleMethod(
                           rawClass, method, jArgs));
            }
            else if (t == typeof(byte))
            {
                return((T)(object)AndroidJNI.CallStaticByteMethod(
                           rawClass, method, jArgs));
            }
            else if (t == typeof(char))
            {
                return((T)(object)AndroidJNI.CallStaticCharMethod(
                           rawClass, method, jArgs));
            }
            else if (t == typeof(long))
            {
                return((T)(object)AndroidJNI.CallStaticLongMethod(
                           rawClass, method, jArgs));
            }
            else if (t == typeof(short))
            {
                return((T)(object)AndroidJNI.CallStaticShortMethod(
                           rawClass, method, jArgs));
            }
            else
            {
                return(StaticInvokeObjectCall <T>(type, name, sig, args));
            }
        }
 public static bool CallStaticBooleanMethod(IntPtr clazz, IntPtr methodId, jvalue[] args)
 {
     try {
         return(AndroidJNI.CallStaticBooleanMethod(clazz, methodId, args));
     }
     finally {
         CheckException();
     }
 }
Exemplo n.º 5
0
        public static T StaticInvokeCall <T>(string type, string name, string sig, params object[] args)
        {
            T      local;
            Type   type2    = typeof(T);
            IntPtr clazz    = AndroidJNI.FindClass(type);
            IntPtr methodID = AndroidJNI.GetStaticMethodID(clazz, name, sig);

            jvalue[] jvalueArray = ConstructArgArray(args);
            try
            {
                if (type2 == typeof(bool))
                {
                    return((T)AndroidJNI.CallStaticBooleanMethod(clazz, methodID, jvalueArray));
                }
                if (type2 == typeof(string))
                {
                    return((T)AndroidJNI.CallStaticStringMethod(clazz, methodID, jvalueArray));
                }
                if (type2 == typeof(int))
                {
                    return((T)AndroidJNI.CallStaticIntMethod(clazz, methodID, jvalueArray));
                }
                if (type2 == typeof(float))
                {
                    return((T)AndroidJNI.CallStaticFloatMethod(clazz, methodID, jvalueArray));
                }
                if (type2 == typeof(double))
                {
                    return((T)AndroidJNI.CallStaticDoubleMethod(clazz, methodID, jvalueArray));
                }
                if (type2 == typeof(byte))
                {
                    return((T)AndroidJNI.CallStaticByteMethod(clazz, methodID, jvalueArray));
                }
                if (type2 == typeof(char))
                {
                    return((T)AndroidJNI.CallStaticCharMethod(clazz, methodID, jvalueArray));
                }
                if (type2 == typeof(long))
                {
                    return((T)AndroidJNI.CallStaticLongMethod(clazz, methodID, jvalueArray));
                }
                if (type2 == typeof(short))
                {
                    return((T)AndroidJNI.CallStaticShortMethod(clazz, methodID, jvalueArray));
                }
                local = StaticInvokeObjectCall <T>(type, name, sig, args);
            }
            finally
            {
                AndroidJNIHelper.DeleteJNIArgArray(args, jvalueArray);
            }
            return(local);
        }
Exemplo n.º 6
0
    /**
     * Returns true if Swarm is initialized, returns false otherwise.
     */
    public static bool isInitialized()
    {
                #if UNITY_ANDROID
                        #if !UNITY_EDITOR
        jvalue[] args = new jvalue[0];

        return(AndroidJNI.CallStaticBooleanMethod(swarmUnityInterface, isInitializedMethod, args));
                        #endif
                #endif

        return(false);
    }
Exemplo n.º 7
0
    public static bool JNICallBool(string classPath, string methodName, params object[] parameters)
    {
        string signature;

        jvalue[] args;
        PrepareJNI(parameters, out args, "Z", out signature);

        IntPtr clsPtr    = AndroidJNI.FindClass(classPath);
        IntPtr methodPtr = AndroidJNI.GetStaticMethodID(clsPtr, methodName, signature);

        Debug.Log("Calling JNI bool method " + classPath + "." + methodName + ", signature: " + signature);
        return(AndroidJNI.CallStaticBooleanMethod(clsPtr, methodPtr, args));
    }
Exemplo n.º 8
0
        private bool AndroidJNISafeCallStaticBooleanMethod(IntPtr clazz, IntPtr methodID, jvalue[] args)
        {
            bool result;

            try
            {
                result = AndroidJNI.CallStaticBooleanMethod(clazz, methodID, args);
            }
            finally
            {
                AndroidJNISafeCheckException();
            }
            return(result);
        }
Exemplo n.º 9
0
 public static bool isRunningOnOUYASupportedHardware()
 {
     if (_jcOuyaUnityPlugin == IntPtr.Zero)
     {
         Debug.LogError("_jcOuyaUnityPlugin is not initialized");
         return(false);
     }
     if (_jmIsRunningOnOUYASupportedHardware == IntPtr.Zero)
     {
         Debug.LogError("_jmIsRunningOnOUYASupportedHardware is not initialized");
         return(false);
     }
     return(AndroidJNI.CallStaticBooleanMethod(_jcOuyaUnityPlugin, _jmIsRunningOnOUYASupportedHardware, new jvalue[0]));
 }
Exemplo n.º 10
0
    public static bool IsExistSDCard()
    {
#if UNITY_ANDROID && !UNITY_EDITOR
        try
        {
            string sig = AndroidJNIHelper.GetSignature <bool>(new object[0]);
            var    ptr = AndroidJNI.GetStaticMethodID(GamePluginMgrPtr, "ExistSDCard", sig);
            bool   b   = AndroidJNI.CallStaticBooleanMethod(GamePluginMgrPtr, ptr, new jvalue[0]);
            return(b);
        }
        catch (Exception exception)
        {
            //ssLogger.Log(exception.Message);
        }
#endif
        return(false);
    }
Exemplo n.º 11
0
        public static T StaticInvokeCall <T>(string type, string name, string sig, params object[] args)
        {
            Type   typeFromHandle = typeof(T);
            IntPtr intPtr         = AndroidJNI.FindClass(type);
            IntPtr staticMethodID = AndroidJNI.GetStaticMethodID(intPtr, name, sig);

            jvalue[] array = ConstructArgArray(args);
            if (typeFromHandle == typeof(bool))
            {
                return((T)(object)AndroidJNI.CallStaticBooleanMethod(intPtr, staticMethodID, array));
            }
            if (typeFromHandle == typeof(string))
            {
                return((T)(object)AndroidJNI.CallStaticStringMethod(intPtr, staticMethodID, array));
            }
            if (typeFromHandle == typeof(int))
            {
                return((T)(object)AndroidJNI.CallStaticIntMethod(intPtr, staticMethodID, array));
            }
            if (typeFromHandle == typeof(float))
            {
                return((T)(object)AndroidJNI.CallStaticFloatMethod(intPtr, staticMethodID, array));
            }
            if (typeFromHandle == typeof(double))
            {
                return((T)(object)AndroidJNI.CallStaticDoubleMethod(intPtr, staticMethodID, array));
            }
            if (typeFromHandle == typeof(byte))
            {
                return((T)(object)AndroidJNI.CallStaticByteMethod(intPtr, staticMethodID, array));
            }
            if (typeFromHandle == typeof(char))
            {
                return((T)(object)AndroidJNI.CallStaticCharMethod(intPtr, staticMethodID, array));
            }
            if (typeFromHandle == typeof(long))
            {
                return((T)(object)AndroidJNI.CallStaticLongMethod(intPtr, staticMethodID, array));
            }
            if (typeFromHandle == typeof(short))
            {
                return((T)(object)AndroidJNI.CallStaticShortMethod(intPtr, staticMethodID, array));
            }
            return(StaticInvokeObjectCall <T>(type, name, sig, args));
        }
Exemplo n.º 12
0
        public static T StaticInvokeCall <T>(string type, string name, string sig, params object[] args)
        {
            Type   type1          = typeof(T);
            IntPtr num            = AndroidJNI.FindClass(type);
            IntPtr staticMethodId = AndroidJNI.GetStaticMethodID(num, name, sig);

            jvalue[] jvalueArray = JavaObjWrapper.ConstructArgArray(args);
            if ((object)type1 == (object)typeof(bool))
            {
                return((T)(ValueType)AndroidJNI.CallStaticBooleanMethod(num, staticMethodId, jvalueArray));
            }
            if ((object)type1 == (object)typeof(string))
            {
                return((T)AndroidJNI.CallStaticStringMethod(num, staticMethodId, jvalueArray));
            }
            if ((object)type1 == (object)typeof(int))
            {
                return((T)(ValueType)AndroidJNI.CallStaticIntMethod(num, staticMethodId, jvalueArray));
            }
            if ((object)type1 == (object)typeof(float))
            {
                return((T)(ValueType)AndroidJNI.CallStaticFloatMethod(num, staticMethodId, jvalueArray));
            }
            if ((object)type1 == (object)typeof(double))
            {
                return((T)(ValueType)AndroidJNI.CallStaticDoubleMethod(num, staticMethodId, jvalueArray));
            }
            if ((object)type1 == (object)typeof(byte))
            {
                return((T)(ValueType)AndroidJNI.CallStaticByteMethod(num, staticMethodId, jvalueArray));
            }
            if ((object)type1 == (object)typeof(char))
            {
                return((T)(ValueType)AndroidJNI.CallStaticCharMethod(num, staticMethodId, jvalueArray));
            }
            if ((object)type1 == (object)typeof(long))
            {
                return((T)(ValueType)AndroidJNI.CallStaticLongMethod(num, staticMethodId, jvalueArray));
            }
            if ((object)type1 == (object)typeof(short))
            {
                return((T)(ValueType)AndroidJNI.CallStaticShortMethod(num, staticMethodId, jvalueArray));
            }
            return(JavaObjWrapper.StaticInvokeObjectCall <T>(type, name, sig, args));
        }
Exemplo n.º 13
0
        public static bool isRunningOnOUYASupportedHardware()
        {
#if VERBOSE_LOGGING
            Debug.Log(string.Format("Invoking {0}...", MethodBase.GetCurrentMethod().Name));
#endif
            JNIFind();

            if (_jcOuyaUnityPlugin == IntPtr.Zero)
            {
                Debug.LogError("_jcOuyaUnityPlugin is not initialized");
                return(false);
            }
            if (_jmIsRunningOnOUYASupportedHardware == IntPtr.Zero)
            {
                Debug.LogError("_jmIsRunningOnOUYASupportedHardware is not initialized");
                return(false);
            }
            return(AndroidJNI.CallStaticBooleanMethod(_jcOuyaUnityPlugin, _jmIsRunningOnOUYASupportedHardware, new jvalue[0]));
        }
Exemplo n.º 14
0
 private static bool AndroidShowInterstitialWall()
 {
     jvalue[] args = new jvalue[0];
     return(AndroidJNI.CallStaticBooleanMethod(class_UnityDre, method_showInterstitialWall, args));
 }
Exemplo n.º 15
0
 private static bool AndroidShowVideoAd()
 {
     jvalue[] args = new jvalue[0];
     return(AndroidJNI.CallStaticBooleanMethod(class_UnityDre, method_showVideo, args));
 }
Exemplo n.º 16
0
 private static bool AndroidIsInstantVideoAvailable()
 {
     jvalue[] args = new jvalue[0];
     return(AndroidJNI.CallStaticBooleanMethod(class_UnityDre, method_isInstantVideoAvailable, args));
 }
Exemplo n.º 17
0
 static bool AndroidIsV4VCAvailable(string zone_id)
 {
     jvalue[] args = new jvalue[1];
     args[0].l = AndroidJNI.NewStringUTF(zone_id);
     return(AndroidJNI.CallStaticBooleanMethod(class_UnityADC, method_isV4VCAvailable, args));
 }
Exemplo n.º 18
0
 private bool CallStaticBoolMethod(IntPtr method, jvalue[] args)
 {
     return(AndroidJNI.CallStaticBooleanMethod(m_pluginClassRaw, method, args));
 }
Exemplo n.º 19
0
 private static bool BurstlyAdWrapper_isAdCached(string placementName)
 {
     jvalue[] args = new jvalue[1];
     args[0].l = AndroidJNI.NewStringUTF(placementName);
     return(AndroidJNI.CallStaticBooleanMethod(BurstlyPluginClass, methodID_isAdCached, args));
 }