Пример #1
0
    void Awake()
    {
        if (_instance == null)
        {
            _instance = GetComponent <JPushSDKHelper>();
            DontDestroyOnLoad(gameObject);
        }

#if UNITY_ANDROID
        if (Application.platform != RuntimePlatform.Android)
        {
            return;
        }

        using (var pluginClass = new AndroidJavaClass(SDKDefine.AndroidJPushPluginName))
            if (pluginClass != null)
            {
                _SDKHelperPlugin = pluginClass.CallStatic <AndroidJavaObject>("Instance");
            }

        if (_SDKHelperPlugin == null)
        {
            Debug.LogError("JPushSDKHelper Init() _SDKHelperPlugin == null!!!!");
            return;
        }
#endif
    }
Пример #2
0
    public static JPushSDKHelper GetInstance()
    {
        if (_instance == null)
        {
            GameObject obj = new GameObject();
            if (obj != null)
            {
                _instance = obj.AddComponent <JPushSDKHelper>();
                obj.name  = JPushSDKHelper._gameObjectName;
            }
        }

        return(_instance);
    }