Example #1
0
    private void Awake()
    {
        GCM.Initialize(); //create GCMReceiver

        // Set callbacks
        GCM.SetErrorCallback(errorId => Debug.Log("Parse notification error: " + errorId));
        GCM.SetUnregisteredCallback(registrationId => Debug.Log("Parse notification Unregistered: " + registrationId));
        GCM.SetDeleteMessagesCallback(total => Debug.Log("Parse notification DeleteMessages " + total));
        GCM.SetMessageCallback(HandleMessage);
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        // Create receiver game object
        GCM.Initialize();

        // Set callbacks
        GCM.SetErrorCallback((string errorId) => {
            Debug.Log("Error!!! " + errorId);
            GCM.ShowToast("Error!!!");
            _text = "Error: " + errorId;
        });

        GCM.SetMessageCallback((Dictionary <string, object> table) => {
            Debug.Log("Message!!!");
            GCM.ShowToast("Message!!!");
            _text = "Message: " + System.Environment.NewLine;
            foreach (var key in  table.Keys)
            {
                _text += key + "=" + table[key] + System.Environment.NewLine;
            }
        });

        GCM.SetRegisteredCallback((string registrationId) => {
            Debug.Log("Registered!!! " + registrationId);
            GCM.ShowToast("Registered!!!");
            _text = "Register: " + registrationId;
        });

        GCM.SetUnregisteredCallback((string registrationId) => {
            Debug.Log("Unregistered!!! " + registrationId);
            GCM.ShowToast("Unregistered!!!");
            _text = "Unregister: " + registrationId;
        });

        GCM.SetDeleteMessagesCallback((int total) => {
            Debug.Log("DeleteMessages!!! " + total);
            GCM.ShowToast("DeleteMessaged!!!");
            _text = "DeleteMessages: " + total;
        });
    }