Beispiel #1
0
        /// <summary>
        /// Schedules a notification to fire. Use the fields in the AndroidNotificationConfiguration object to configure the notification. When dealing with grouped notifications
        /// the groupKey must match for all notifications and you must set one notification to be the summary notification (AndroidNotificationConfiguration.isGroupSummary
        /// must be true). The extraData will be returned with the notificationReceivedEvent and the int returned (requestCode) can be used to cancel the notification.
        /// If AndroidNotificationConfiguration.cancelsNotificationId is set when the notification fires it will call cancelNotification with that notification Id.
        /// </summary>
        public static int scheduleNotification(AndroidNotificationConfiguration config)
        {
            if (Application.platform != RuntimePlatform.Android)
            {
                return(-1);
            }

            config.build();
            return(_plugin.Call <int>("scheduleNotification", Json.encode(config)));
        }
Beispiel #2
0
        // Schedules a notification to fire. Use the fields in the AndroidNotificationConfiguration object to configure the notification. When dealing with grouped notifications
        // the groupKey must match for all notifications and you must set one notification to be the summary notification (AndroidNotificationConfiguration.isGroupSummary
        // must be true). The extraData will be returned with the notificationReceivedEvent and the int returned (requestCode) can be used to cancel the notification.
        // If AndroidNotificationConfiguration.cancelsNotificationId is set when the notification fires it will call cancelNotification with that notification Id.
        public static int scheduleNotification(AndroidNotificationConfiguration config)
        {
            if (Application.platform != RuntimePlatform.Android)
            {
                return(-1);
            }

            config.build();
            //return _plugin.Call<int>( "scheduleNotification", config.secondsFromNow, config.title, config.subtitle, config.tickerText, config.extraData, config.smallIcon, config.largeIcon, config.requestCode, config.color, config.groupKey, config.isGroupSummary );
            return(_plugin.Call <int>("scheduleNotification", Json.encode(config)));
        }
Beispiel #3
0
        void notificationsUI()
        {
            GUILayout.Label("Notifications");
            if (GUILayout.Button("Schedule Notification in 5s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(5, "Notification Title - 5 Seconds", "The subtitle of the notification", "Ticker text gets ticked")
                {
                    extraData = "five-second-note",
                    groupKey  = "my-note-group"
                };

                // turn off sound and vibration for this notification
                noteConfig.sound   = false;
                noteConfig.vibrate = false;

                _fiveSecondNotificationId = EtceteraAndroid.scheduleNotification(noteConfig);
                Debug.Log("notificationId: " + _fiveSecondNotificationId);
            }


            if (GUILayout.Button("Schedule Group Summary Notification in 5s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(5, "Group Summary Title", "Group Summary Subtitle - Stuff Happened", "Ticker text")
                {
                    extraData      = "group-summary-note",
                    groupKey       = "my-note-group",
                    isGroupSummary = true
                };
                EtceteraAndroid.scheduleNotification(noteConfig);
            }


            if (GUILayout.Button("Cancel 5s Notification"))
            {
                EtceteraAndroid.cancelNotification(_fiveSecondNotificationId);
            }


            if (GUILayout.Button("Check for Notifications"))
            {
                EtceteraAndroid.checkForNotifications();
            }


            if (GUILayout.Button("Cancel All Notifications"))
            {
                EtceteraAndroid.cancelAllNotifications();
            }
        }
Beispiel #4
0
        void OnGUI()
        {
            beginColumn();


            if (GUILayout.Button("Show Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewShow("http://prime31.com/", 160, 430, Screen.width - 160, Screen.height - 100);
            }


            if (GUILayout.Button("Close Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewClose();
            }


            if (GUILayout.Button("Set Url of Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewSetUrl("http://google.com");
            }


            if (GUILayout.Button("Set Frame of Inline Web View"))
            {
                EtceteraAndroid.inlineWebViewSetFrame(80, 50, 300, 400);
            }


            if (GUILayout.Button("Get First 25 Contacts"))
            {
                EtceteraAndroid.loadContacts(0, 25);
            }


            endColumn(true);


            if (GUILayout.Button("Schedule Notification in 5s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(5, "Notification Title - 5 Seconds", "The subtitle of the notification", "Ticker text gets ticked")
                {
                    extraData = "five-second-note",
                    groupKey  = "my-note-group"
                };

                // turn off sound and vibration for this notification
                noteConfig.sound   = false;
                noteConfig.vibrate = false;

                _fiveSecondNotificationId = EtceteraAndroid.scheduleNotification(noteConfig);
                Debug.Log("notificationId: " + _fiveSecondNotificationId);
            }


            if (GUILayout.Button("Schedule Notification in 10s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(10, "Notification Title - 10 Seconds", "The subtitle of the notification", "Ticker text gets ticked")
                {
                    extraData = "ten-second-note",
                    groupKey  = "my-note-group"
                };
                _tenSecondNotificationId = EtceteraAndroid.scheduleNotification(noteConfig);
                Debug.Log("notificationId: " + _tenSecondNotificationId);
            }


            if (GUILayout.Button("Schedule Group Summary Notification in 5s"))
            {
                var noteConfig = new AndroidNotificationConfiguration(5, "Group Summary Title", "Group Summary Subtitle - Stuff Happened", "Ticker text")
                {
                    extraData      = "group-summary-note",
                    groupKey       = "my-note-group",
                    isGroupSummary = true
                };
                EtceteraAndroid.scheduleNotification(noteConfig);
            }


            if (GUILayout.Button("Cancel 5s Notification"))
            {
                EtceteraAndroid.cancelNotification(_fiveSecondNotificationId);
            }


            if (GUILayout.Button("Cancel 10s Notification"))
            {
                EtceteraAndroid.cancelNotification(_tenSecondNotificationId);
            }


            if (GUILayout.Button("Check for Notifications"))
            {
                EtceteraAndroid.checkForNotifications();
            }


            if (GUILayout.Button("Cancel All Notifications"))
            {
                EtceteraAndroid.cancelAllNotifications();
            }


            if (GUILayout.Button("Quit App"))
            {
                Application.Quit();
            }


            endColumn();


            if (bottomRightButton("Previous Scene"))
            {
                Application.LoadLevel("EtceteraTestScene");
            }
        }
Beispiel #5
0
        // Schedules a notification to fire. Use the fields in the AndroidNotificationConfiguration object to configure the notification. When dealing with grouped notifications
        // the groupKey must match for all notifications and you must set one notification to be the summary notification (AndroidNotificationConfiguration.isGroupSummary
        // must be true). The extraData will be returned with the notificationReceivedEvent and the int returned (requestCode) can be used to cancel the notification.
        // If AndroidNotificationConfiguration.cancelsNotificationId is set when the notification fires it will call cancelNotification with that notification Id.
        public static int scheduleNotification( AndroidNotificationConfiguration config )
        {
            if( Application.platform != RuntimePlatform.Android )
                return -1;

            config.build();
            return _plugin.Call<int>( "scheduleNotification", Json.encode( config ) );
        }
Beispiel #6
0
    public void SetNotif_2Hr()
    {
        var noteConfig = new AndroidNotificationConfiguration(2 * 60 * 60, "Got an energy", "Play the epic clash", "Have fun")
        {
            extraData = "two-hour-note",
            groupKey = "my-note-group",
            smallIcon = "app_icon"
        };

        // turn off sound and vibration for this notification
        noteConfig.sound = false;
        noteConfig.vibrate = false;

        twoHrNotificationId = EtceteraAndroid.scheduleNotification(noteConfig);
    }
Beispiel #7
0
    public void SetNotif_24Hr()
    {
        var noteConfig = new AndroidNotificationConfiguration(SecInDay, "Epic Clash - The Puli", "Play daily to collect your daily bonus", "Have fun")
        {
            extraData = "one-day-note",
            groupKey = "my-note-group",
            smallIcon = "app_icon"
        };

        System.DateTime currentDate = System.DateTime.Now;
        //Debug.Log("SetNotif_24Hr : " + currentDate.ToString());
        oneDayNotificationId = EtceteraAndroid.scheduleNotification(noteConfig);
        SavedData.Inst.SaveAllData();
    }
Beispiel #8
0
    public void SetNotif_1Hr()
    {
        var noteConfig = new AndroidNotificationConfiguration(3 * EnergyRefillTime, "Epic Clash - The Puli", "Got an energy, continue the game", "Have fun")
        {
            extraData = "one-hour-note",
            groupKey = "my-note-group",
            smallIcon = "app_icon"
        };

        // turn off sound and vibration for this notification
        noteConfig.sound = false;
        noteConfig.vibrate = false;

        System.DateTime currentDate = System.DateTime.Now;
        Debug.Log("SetNotif_1Hr : " + currentDate.ToString());
        oneHrNotificationId = EtceteraAndroid.scheduleNotification(noteConfig);

        SavedData.Inst.SaveAllData();
    }
        void OnGUI()
        {
            beginColumn();

            if( GUILayout.Button( "Show Inline Web View" ) )
            {
                EtceteraAndroid.inlineWebViewShow( "http://prime31.com/", 160, 430, Screen.width - 160, Screen.height - 100 );
            }

            if( GUILayout.Button( "Close Inline Web View" ) )
            {
                EtceteraAndroid.inlineWebViewClose();
            }

            if( GUILayout.Button( "Set Url of Inline Web View" ) )
            {
                EtceteraAndroid.inlineWebViewSetUrl( "http://google.com" );
            }

            if( GUILayout.Button( "Set Frame of Inline Web View" ) )
            {
                EtceteraAndroid.inlineWebViewSetFrame( 80, 50, 300, 400 );
            }

            if( GUILayout.Button( "Get First 25 Contacts" ) )
            {
                EtceteraAndroid.loadContacts( 0, 25 );
            }

            endColumn( true );

            if( GUILayout.Button( "Schedule Notification in 5s" ) )
            {
                var noteConfig = new AndroidNotificationConfiguration( 5, "Notification Title - 5 Seconds", "The subtitle of the notification", "Ticker text gets ticked" )
                {
                    extraData = "five-second-note",
                    groupKey = "my-note-group"
                };

                // turn off sound and vibration for this notification
                noteConfig.sound = false;
                noteConfig.vibrate = false;

                _fiveSecondNotificationId = EtceteraAndroid.scheduleNotification( noteConfig );
                Debug.Log( "notificationId: " + _fiveSecondNotificationId );
            }

            if( GUILayout.Button( "Schedule Notification in 10s" ) )
            {
                var noteConfig = new AndroidNotificationConfiguration( 10, "Notification Title - 10 Seconds", "The subtitle of the notification", "Ticker text gets ticked" )
                {
                    extraData = "ten-second-note",
                    groupKey = "my-note-group"
                };
                _tenSecondNotificationId = EtceteraAndroid.scheduleNotification( noteConfig );
                Debug.Log( "notificationId: " + _tenSecondNotificationId );
            }

            if( GUILayout.Button( "Schedule Group Summary Notification in 5s" ) )
            {
                var noteConfig = new AndroidNotificationConfiguration( 5, "Group Summary Title", "Group Summary Subtitle - Stuff Happened", "Ticker text" )
                {
                    extraData = "group-summary-note",
                    groupKey = "my-note-group",
                    isGroupSummary = true
                };
                EtceteraAndroid.scheduleNotification( noteConfig );
            }

            if( GUILayout.Button( "Cancel 5s Notification" ) )
            {
                EtceteraAndroid.cancelNotification( _fiveSecondNotificationId );
            }

            if( GUILayout.Button( "Cancel 10s Notification" ) )
            {
                EtceteraAndroid.cancelNotification( _tenSecondNotificationId );
            }

            if( GUILayout.Button( "Check for Notifications" ) )
            {
                EtceteraAndroid.checkForNotifications();
            }

            if( GUILayout.Button( "Cancel All Notifications" ) )
            {
                EtceteraAndroid.cancelAllNotifications();
            }

            if( GUILayout.Button( "Quit App" ) )
            {
                Application.Quit();
            }

            endColumn();

            if( bottomRightButton( "Previous Scene" ) )
            {
                Application.LoadLevel( "EtceteraTestScene" );
            }
        }