Esempio n. 1
0
    private VoxelBusters.NativePlugins.CrossPlatformNotification CreateNotification(long _fireAfterSec, VoxelBusters.NativePlugins.eNotificationRepeatInterval _repeatInterval)
    {
        // User info
        IDictionary _userInfo = new Dictionary <string, string>();

        _userInfo["data"] = "custom data";

        VoxelBusters.NativePlugins.CrossPlatformNotification.iOSSpecificProperties _iosProperties = new VoxelBusters.NativePlugins.CrossPlatformNotification.iOSSpecificProperties();
        _iosProperties.HasAction   = true;
        _iosProperties.AlertAction = "alert action";

        VoxelBusters.NativePlugins.CrossPlatformNotification.AndroidSpecificProperties _androidProperties = new VoxelBusters.NativePlugins.CrossPlatformNotification.AndroidSpecificProperties();
        _androidProperties.ContentTitle = "Daily Quote";
        _androidProperties.TickerText   = "Check your new daily quote for today";
        _androidProperties.LargeIcon    = "icon.png";         //Keep the files in Assets/PluginResources/Android or Common folder.

        VoxelBusters.NativePlugins.CrossPlatformNotification _notification = new VoxelBusters.NativePlugins.CrossPlatformNotification();
        _notification.AlertBody         = "Check your new daily quote for today";                 //On Android, this is considered as ContentText
        _notification.FireDate          = System.DateTime.Now.AddSeconds(_fireAfterSec);
        _notification.RepeatInterval    = _repeatInterval;
        _notification.SoundName         = "Notification.mp3";                 //Keep the files in Assets/PluginResources/Android or iOS or Common folder.
        _notification.UserInfo          = _userInfo;
        _notification.iOSProperties     = _iosProperties;
        _notification.AndroidProperties = _androidProperties;

        return(_notification);
    }
Esempio n. 2
0
        public override string ScheduleLocalNotification(CrossPlatformNotification _notification)
        {
            // Append notification id to user info
            string _notificationID = _notification.GenerateNotificationID();

            // Assign notification data
            LocalNotification _newNotification = new LocalNotification();

            _newNotification.alertBody      = _notification.AlertBody;
            _newNotification.fireDate       = _notification.FireDate;
            _newNotification.repeatInterval = iOSNotificationPayload.ConvertToCalendarUnit(_notification.RepeatInterval);
            _newNotification.userInfo       = _notification.UserInfo;

            // iOS Notification additional data
            CrossPlatformNotification.iOSSpecificProperties _iOSProperties = _notification.iOSProperties;

            if (_iOSProperties != null)
            {
                _newNotification.hasAction = _iOSProperties.HasAction;
                _newNotification.applicationIconBadgeNumber = _iOSProperties.BadgeCount;

                if (!string.IsNullOrEmpty(_iOSProperties.AlertAction))
                {
                    _newNotification.alertAction = _iOSProperties.AlertAction;
                }

                if (!string.IsNullOrEmpty(_iOSProperties.LaunchImage))
                {
                    _newNotification.alertLaunchImage = _iOSProperties.LaunchImage;
                }

                if (!string.IsNullOrEmpty(_iOSProperties.SoundName))
                {
                    _newNotification.soundName = _iOSProperties.SoundName;
                }
            }

            // Schedule notification
            NotificationServices.ScheduleLocalNotification(_newNotification);
            return(_notificationID);
        }
Esempio n. 3
0
	private CrossPlatformNotification CreateNotification (long _fireAfterSec, eNotificationRepeatInterval _repeatInterval)
	{
		// User info
		IDictionary _userInfo			= new Dictionary<string, string>();
		_userInfo["data"]				= "add what is required";
		
		CrossPlatformNotification.iOSSpecificProperties _iosProperties			= new CrossPlatformNotification.iOSSpecificProperties();
		_iosProperties.HasAction		= true;
		_iosProperties.AlertAction		= GMS.appName;
		
		CrossPlatformNotification.AndroidSpecificProperties _androidProperties	= new CrossPlatformNotification.AndroidSpecificProperties();
		_androidProperties.ContentTitle	= GMS.amigoData.nombre;
		_androidProperties.TickerText	= GMS.appName;
		_androidProperties.CustomSound	= "Notification.mp3"; //Keep the files in Assets/StreamingAssets/VoxelBusters/NativePlugins/Android folder.
		//_androidProperties.LargeIcon	= "NativePlugins.png"; //Keep the files in Assets/StreamingAssets/VoxelBusters/NativePlugins/Android folder.
		if (GMS.checkImageExists (GMS.amigoData.foto)) {
			_androidProperties.LargeIcon = Application.persistentDataPath + "/" + GMS.amigoData.foto;
		} else {
			_androidProperties.LargeIcon	= "default.jpg";
		}
		
		CrossPlatformNotification _notification	= new CrossPlatformNotification();
		_notification.AlertBody			= MgsTextNotif; //On Android, this is considered as ContentText
		_notification.FireDate			= System.DateTime.Now.AddSeconds(_fireAfterSec);
		_notification.RepeatInterval	= _repeatInterval;
		_notification.UserInfo			= _userInfo;
		_notification.iOSProperties		= _iosProperties;
		_notification.AndroidProperties	= _androidProperties;
		
		return _notification;
	}
		private CrossPlatformNotification CreateNotification (long _fireAfterSec, eNotificationRepeatInterval _repeatInterval)
		{
			// User info
			IDictionary _userInfo			= new Dictionary<string, string>();
			_userInfo["data"]				= "add what is required";
			
			CrossPlatformNotification.iOSSpecificProperties _iosProperties			= new CrossPlatformNotification.iOSSpecificProperties();
			_iosProperties.HasAction		= true;
			_iosProperties.AlertAction		= "alert action";
			
			CrossPlatformNotification.AndroidSpecificProperties _androidProperties	= new CrossPlatformNotification.AndroidSpecificProperties();
			_androidProperties.ContentTitle	= "content title";
			_androidProperties.TickerText	= "ticker ticks over here";
			_androidProperties.CustomSound	= "Notification.mp3"; //Keep the files in Assets/StreamingAssets/VoxelBusters/NativePlugins/Android folder.
			_androidProperties.LargeIcon	= "NativePlugins.png"; //Keep the files in Assets/StreamingAssets/VoxelBusters/NativePlugins/Android folder.
			
			CrossPlatformNotification _notification	= new CrossPlatformNotification();
			_notification.AlertBody			= "alert body"; //On Android, this is considered as ContentText
			_notification.FireDate			= System.DateTime.Now.AddSeconds(_fireAfterSec);
			_notification.RepeatInterval	= _repeatInterval;
			_notification.UserInfo			= _userInfo;
			_notification.iOSProperties		= _iosProperties;
			_notification.AndroidProperties	= _androidProperties;

			return _notification;
		}