Esempio n. 1
0
        public async static Task <bool> RegisterPushNotifications(string token,
                                                                  PushNotification.Plugin.Abstractions.DeviceType deviceType,
                                                                  double longitude, double latitude)
        {
            JsonWebClient cli = new JsonWebClient();

            string getUri = GetUri(PUSH);

            var notification = new crime_notification();

            notification.DeviceToken = token;
            notification.DeviceType  = Convert.ToInt32(deviceType);
            notification.Longitude   = longitude;
            notification.Latitude    = latitude;
            notification.Version     = Global.VERSION;

            Debug.WriteLine($"About to post registration to server... LONG: {longitude}  LAT: {latitude}");
            await cli.DoSilentPost(getUri, JsonConvert.SerializeObject(notification));

            return(true);
        }
Esempio n. 2
0
 public static async void PostToken(string token, PushNotification.Plugin.Abstractions.DeviceType deviceType)
 {
     _deviceToken = token;
     _deviceType  = deviceType;
     await RegisterPushNotifications();
 }
		public void OnError (string message, PushNotification.Plugin.Abstractions.DeviceType deviceType)
		{
			Console.WriteLine (message);
		}
		public void OnUnregistered (PushNotification.Plugin.Abstractions.DeviceType deviceType)
		{
			Console.WriteLine ("Unregistered");
		}
		public async void OnRegistered (string Token, PushNotification.Plugin.Abstractions.DeviceType deviceType)
		{
			await TinyIoC.TinyIoCContainer.Current.Resolve<IApiService> ().RegisterDeviceAsync ("android", Token);
			Console.WriteLine ("Registered");

		}
		public async void OnMessage (Newtonsoft.Json.Linq.JObject values, PushNotification.Plugin.Abstractions.DeviceType deviceType)
		{
			
			Console.WriteLine ("Message Received");
		}
 public void OnUnregistered(PushNotification.Plugin.Abstractions.DeviceType deviceType)
 {
 }
 public void OnRegistered(string token, PushNotification.Plugin.Abstractions.DeviceType deviceType)
 {
     DeviceToken = token;
 }
 public void OnMessage(IDictionary <string, object> parameters, PushNotification.Plugin.Abstractions.DeviceType deviceType)
 {
     //handle push notifications here
 }
 public void OnError(string message, PushNotification.Plugin.Abstractions.DeviceType deviceType)
 {
     Console.WriteLine("A notifications error occured: {0} ", message);
 }