public void OnApplicationPause(bool paused)
 {
     if (PlatformHooks.IsAndroid)
     {
         PlatformHooks.CallStaticJavaUnityMethod("com.parse.ParsePushUnityHelper", "setApplicationPaused", new object[] { paused });
     }
 }
 static ParseClient()
 {
     /* Type platformHookType = Type.GetType("Parse.PlatformHooks, Parse.Unity"); // GetParseType("PlatformHooks");
      * if (platformHookType == null)
      * {
      *   throw new InvalidOperationException("You must include a reference to a platform-specific Parse library.");
      * }*/
     platformHooks = new PlatformHooks(); //Activator.CreateInstance(platformHookType) as IPlatformHooks;
     commandRunner = new ParseCommandRunner(platformHooks.HttpClient);
     versionString = "net-" + platformHooks.SDKName + Version;
 }
        private void Initialize()
        {
            if (!isInitialized)
            {
                isInitialized = true;
                // Keep this gameObject around, even when the scene changes.
                GameObject.DontDestroyOnLoad(gameObject);

                ParseClient.Initialize(applicationID, dotnetKey);

                // Kick off the dispatcher.
                StartCoroutine(PlatformHooks.RunDispatcher());
            }
        }
Example #4
0
        /// <summary>
        /// Authenticates this client as belonging to your application. This must be
        /// called before your application can use the Parse library. The recommended
        /// way is to put a call to <c>ParseFramework.Initialize</c> in your
        /// Application startup.
        /// </summary>
        /// <param name="configuration">The configuration to initialize Parse with.
        /// </param>
        public static void Initialize(Configuration configuration)
        {
            lock (mutex) {
                HostName             = HostName ?? new Uri("https://api.parse.com/1/");
                CurrentConfiguration = configuration;

                ParseObject.RegisterSubclass <ParseUser>();
                ParseObject.RegisterSubclass <ParseInstallation>();
                ParseObject.RegisterSubclass <ParseRole>();
                ParseObject.RegisterSubclass <ParseSession>();

                // Give platform-specific libraries a chance to do additional initialization.
                PlatformHooks.Initialize();
            }
        }
        /// <summary>
        /// Authenticates this client as belonging to your application. This must be
        /// called before your application can use the Parse library. The recommended
        /// way is to put a call to <c>ParseFramework.Initialize</c> in your
        /// Application startup.
        /// </summary>
        /// <param name="applicationId">The Application ID provided in the Parse dashboard.
        /// </param>
        /// <param name="dotnetKey">The .NET API Key provided in the Parse dashboard.
        /// </param>
        public static void Initialize(string applicationId, string dotnetKey)
        {
            lock (mutex) {
                HostName      = HostName ?? new Uri("https://api.parse.com/1/");
                ApplicationId = applicationId;
                WindowsKey    = dotnetKey;

                ParseObject.RegisterSubclass <ParseUser>();
                ParseObject.RegisterSubclass <ParseInstallation>();
                ParseObject.RegisterSubclass <ParseRole>();
                ParseObject.RegisterSubclass <ParseSession>();

                // Give platform-specific libraries a chance to do additional initialization.
                PlatformHooks.Initialize();
            }
        }
        /// <summary>
        /// Initializes the Parse SDK and begins running network requests created by Parse.
        /// </summary>
        public virtual void Awake()
        {
            Initialize();
            // Force the name to be `ParseInitializeBehaviour` in runtime.
            gameObject.name = "ParseInitializeBehaviour";

            if (PlatformHooks.IsIOS)
            {
                PlatformHooks.RegisterDeviceTokenRequest((deviceToken) => {
                    if (deviceToken != null)
                    {
                        ParseInstallation installation = ParseInstallation.CurrentInstallation;
                        installation.SetDeviceTokenFromData(deviceToken);

                        // Optimistically assume this will finish.
                        installation.SaveAsync();
                    }
                });
            }
        }