예제 #1
0
 public void RegisterForPushNotification()
 {
     GcmClient.CheckDevice(Forms.Context);
     GcmClient.CheckManifest(Forms.Context);
     GcmService.Initialize(Forms.Context);
     GcmService.Register(Forms.Context);
 }
예제 #2
0
        private void RegisterWithGCM()
        {
            // Check to ensure everything's set up right
            GcmClient.CheckDevice(this);
            GcmClient.CheckManifest(this);

            // Register for push notifications
            System.Diagnostics.Debug.WriteLine("MainActivity", "Registering...");
            GcmService.Initialize(this);
            GcmService.Register(this);
        }
예제 #3
0
        public static void ProcessNotification(GcmService service, NotificationManager notificationManager,
                                               Intent uiIntent, NotificationCompat.Builder builder, string title, string description, Bitmap largIcon)
        {
            var notification = builder.SetContentIntent(PendingIntent.GetActivity(service, 0, uiIntent, 0))
                               .SetSmallIcon(Resource.Drawable.icon)
                               .SetLargeIcon(largIcon)
                               .SetTicker(title)
                               .SetContentTitle(title)
                               .SetContentText(description)
                               .SetSound(RingtoneManager.GetDefaultUri(RingtoneType.Notification))
                               .SetAutoCancel(true).Build();

            notificationManager.Notify(1, notification);
        }
 private void RegisterPushNotifications()
 {
     try
     {
         GcmService.Initialize(this);
         GcmService.Register(this);
     }
     catch (Java.Net.MalformedURLException)
     {
         CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error");
     }
     catch (Exception e)
     {
         CreateAndShowDialog(e.Message, "Error");
     }
 }
예제 #5
0
 public GcmPushes(GcmService gcmService) {
     GService = gcmService;
 }