public MessagingService()
    {
      Types.AddClientClassMapping( "com.backendless.management.DeviceRegistrationDto",
                                   typeof( Messaging.DeviceRegistration ) );
      Types.AddClientClassMapping( "com.backendless.services.messaging.MessageStatus", typeof( Messaging.MessageStatus ) );
      Types.AddClientClassMapping( "com.backendless.services.messaging.PublishOptions",
                                   typeof( Messaging.PublishOptions ) );
      Types.AddClientClassMapping( "com.backendless.services.messaging.DeliveryOptions",
                                   typeof( Messaging.DeliveryOptions ) );
      Types.AddClientClassMapping( "com.backendless.services.messaging.PublishStatusEnum",
                                   typeof( Messaging.PublishStatusEnum ) );
      Types.AddClientClassMapping( "com.backendless.services.messaging.Message", typeof( Messaging.Message ) );

#if WINDOWS_PHONE8
      object deviceId;
      if (!Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out deviceId))
      {
          deviceId = HostInformation.PublisherHostId;

          if( deviceId == null )
            throw new BackendlessException(new BackendlessFault(ExceptionMessage.NO_DEVICEID_CAPABILITY));
      }

      _deviceRegistrationDto = new DeviceRegistration
        {
          Os = "WP",
          DeviceId = BitConverter.ToString( (byte[]) deviceId ).Replace( "-", "" ),
          OsVersion = System.Environment.OSVersion.Version.Major.ToString( CultureInfo.InvariantCulture )
        };
#endif
    }
Exemple #2
0
        public MessagingService()
        {
            Types.AddClientClassMapping("com.backendless.management.DeviceRegistrationDto", typeof(Messaging.DeviceRegistration));
            Types.AddClientClassMapping("com.backendless.services.messaging.MessageStatus", typeof(Messaging.MessageStatus));
            Types.AddClientClassMapping("com.backendless.services.messaging.PublishOptions", typeof(Messaging.PublishOptions));
            Types.AddClientClassMapping("com.backendless.services.messaging.DeliveryOptions", typeof(Messaging.DeliveryOptions));
            Types.AddClientClassMapping("com.backendless.services.messaging.PublishStatusEnum", typeof(Messaging.PublishStatusEnum));
            Types.AddClientClassMapping("com.backendless.services.messaging.Message", typeof(Messaging.Message));

#if WINDOWS_PHONE8
            object deviceId;
            if (!Microsoft.Phone.Info.DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out deviceId))
            {
                deviceId = HostInformation.PublisherHostId;

                if (deviceId == null)
                {
                    throw new BackendlessException(new BackendlessFault(ExceptionMessage.NO_DEVICEID_CAPABILITY));
                }
            }

            _deviceRegistrationDto = new DeviceRegistration
            {
                Os        = "WP",
                DeviceId  = BitConverter.ToString((byte[])deviceId).Replace("-", ""),
                OsVersion = System.Environment.OSVersion.Version.Major.ToString(CultureInfo.InvariantCulture)
            };
#elif UNITY || NETSTANDARD
            _deviceRegistrationDto = new DeviceRegistration();
            _deviceRegistrationDto = InitializeDeviceId(_deviceRegistrationDto);
#endif
        }
 public MessagingService()
 {
     _deviceRegistration = new DeviceRegistration();
 }
Exemple #4
0
 public MessagingService()
 {
     _deviceRegistration = new DeviceRegistration();
 }