protected override void OnMessage(Context context, Intent intent) { //FCM Message Catcher var FCMmsg = intent.Extras.GetString("gcm.notification.body"); title = intent.Extras.GetString("gcm.notification.title"); //Server Message Catcher type = intent.Extras.GetString("type"); why = intent.Extras.GetString("why"); objecter = intent.Extras.GetString("objecter"); imgUrl = intent.Extras.GetString("img"); //title = intent.Extras.GetString("title"); mPushNotify noti = new mPushNotify() { Messgae = FCMmsg, Why = why, Objecter = objecter, Type = type, Title = title, ImgUrl = null }; if (!String.IsNullOrEmpty(imgUrl)) { noti.ImgUrl = imgUrl; } createNotification(FCMmsg.ToString(), noti); }
public async void NavigateNotfiy(mPushNotify note) { DialogService.ShowLoading("Please wait"); if (note.Type == Keys.NotifyTypes[2]) //order { if (note.Why == Keys.NotifyWhys[8]) //order-update { var order = await OrderService.Instance.FetchOrder(note.Objecter); DialogService.HideLoading(); Detail = NavigationPageHelper.Create(new OrderDetail(order)); return; } } else if (note.Type == Keys.NotifyTypes[1]) //question { if (note.Why == Keys.NotifyWhys[2] || note.Why == Keys.NotifyTypes[1]) //answer-question & new-question { DialogService.HideLoading(); Detail = NavigationPageHelper.Create(new Notify()); return; } } else if (note.Type == Keys.NotifyTypes[0]) //item { if (note.Why == Keys.NotifyWhys[9]) //Rate { DialogService.HideLoading(); Detail = NavigationPageHelper.Create(new Notify()); } } DialogService.HideLoading(); }
private async void NavigateNotfiy(mPushNotify note) { if (IsBusy) { return; } IsBusy = true; DialogService.ShowLoading("Please wait"); if (note.Type == Keys.NotifyTypes[0])//item { } else if (note.Type == Keys.NotifyTypes[1]) //question { if (note.Why == Keys.NotifyWhys[2]) //answer-question { var question = await QuestionService.Instance.FetchQuestion(note.Objecter); DialogService.HideLoading(); var response = await DialogService.DisplayAlert("View item", "Dismiss", "Q:" + question.Question, "A:" + question.Answer); if (!response) { return; } DialogService.ShowLoading("Relocating"); var item = await ItemService.Instance.FetchItem(question.ProductId); DialogService.HideLoading(); await Current.MainPage.Navigation.PushAsync(new ItemView(item)); } } else if (note.Type == Keys.NotifyTypes[2]) //order { if (note.Why == Keys.NotifyWhys[8]) //order-update { var order = await OrderService.Instance.FetchOrder(note.Objecter); DialogService.HideLoading(); DialogService.ShowToast(order.Status); //await Current.MainPage.Navigation.PushAsync(new OrderDetail(order)); return; } } }
public RootPage(bool sayWelcome, mPushNotify note = null, Page page = null) { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); _showWelcome = sayWelcome; // Empty pages are initially set to get optimal launch experience //Master = new ContentPage { Title = "GridCentral" }; //Detail = NavigationPageHelper.Create(new ContentPage()); InitializeMasterDetail(page); if (note != null) { NavigateNotfiy(note); } }
public App(mPushNotify note = null) { InitializeComponent(); CrossDeviceOrientation.Current.LockOrientation(CrossDeviceOrientation.Current.CurrentOrientation); //Lock Orientation //var ISS = AccountService.Instance.ReadyToSignIn; if (note == null || !AccountService.Instance.ReadyToSignIn) { CrossSettings.Current.AddOrUpdateValue("AlertView", false); MainPage = GetMainPage(); MainPage.SetValue(NavigationPage.BarTextColorProperty, Color.White); } else { //NavigateNotfiy(note); MainPage = new RootPage(false, note); MainPage.SetValue(NavigationPage.BarTextColorProperty, Color.White); } // var crashed = HockeyApp.CrashManager.DidCrashInLastSession; }
protected override void OnCreate(Bundle bundle) { // Changing to App's theme since we are OnCreate and we are ready to // "hide" the splash base.Window.RequestFeature(WindowFeatures.ActionBar); base.SetTheme(Resource.Style.AppTheme); FormsAppCompatActivity.ToolbarResource = Resource.Layout.Toolbar; FormsAppCompatActivity.TabLayoutResource = Resource.Layout.Tabs; base.OnCreate(bundle); //CrashManager.Register(this, GridCentral.Helpers.Keys.HockeyId_Android); //MetricsManager.Register(Application, GridCentral.Helpers.Keys.HockeyId_Android); //Initializing FFImageLoading CachedImageRenderer.Init(); global::Xamarin.Forms.Forms.Init(this, bundle); CarouselViewRenderer.Init(); UXDivers.Artina.Shared.GrialKit.Init(this, "GridCentral.Droid.GrialLicense"); UserDialogs.Init(() => (Activity)Forms.Context); PhoneCallImplementation.Init(); FormsHelper.ForceLoadingAssemblyContainingType(typeof(UXDivers.Effects.Effects)); mPushNotify paramValue = new mPushNotify(); paramValue.Messgae = Intent.GetStringExtra("message"); paramValue.Objecter = Intent.GetStringExtra("objecter"); paramValue.Type = Intent.GetStringExtra("type"); paramValue.Why = Intent.GetStringExtra("why"); if (!String.IsNullOrEmpty(paramValue.Messgae)) { LoadApplication(new App(paramValue)); } else { LoadApplication(new App()); //LoadApplication(UXDivers.Gorilla.Droid.Player.CreateApplication( // this, // new UXDivers.Gorilla.Config("Good Gorilla").RegisterAssembliesFromTypes<UXDivers.Artina.Shared.CircleImage, // GrialShapesFont, BindablePicker, XLabs.Forms.Controls.CheckBox, CarouselViewControl>())); } try { // Check to ensure everything's set up right GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Register for push notifications System.Diagnostics.Debug.WriteLine("Registering..."); GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); } catch (Java.Net.MalformedURLException) { CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error"); } catch (Exception e) { CreateAndShowDialog(e.Message, "Error"); } CheckForUpdates(); }
void createNotification(string body, mPushNotify info) { var intent = new Intent(this, typeof(MainActivity)); intent.PutExtra("type", info.Type); intent.PutExtra("why", info.Why); intent.PutExtra("objecter", info.Objecter); intent.PutExtra("message", info.Messgae); intent.AddFlags(ActivityFlags.ClearTop); var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot); var defaultSoundUri = RingtoneManager.GetDefaultUri(RingtoneType.Notification); #region Priority Numbers // // Summary: // /// // Lowest Android.App.Notification.Priority; these items might not be shown to the // user except under special /// circumstances, such as detailed notification logs. // /// // /// // Min = -2, // // Summary: // /// // Lower Android.App.Notification.Priority, for items that are less important. The // UI may choose to show these /// items smaller, or at a different position in // the list, compared with your app's /// Android.App.Notification.PriorityDefault // items. /// // /// //Low = -1, // // Summary: // /// // Default notification Android.App.Notification.Priority. If your application does // not prioritize its own /// notifications, use this value for all notifications. // /// // /// //Default = 0, // // Summary: // /// // Higher Android.App.Notification.Priority, for more important notifications or // alerts. The UI may choose to /// show these items larger, or at a different position // in notification lists, compared with /// your app's Android.App.Notification.PriorityDefault // items. /// // /// // High = 1, // // Summary: // /// // Highest Android.App.Notification.Priority, for your application's most important // items that require the /// user's prompt attention or input. /// // /// //Max = 2 #endregion var notificationBuilder = new NotificationCompat.Builder(this); if (!String.IsNullOrEmpty(info.ImgUrl)) { var imageBitmap = GetImageBitmapFromUrl(info.ImgUrl); notificationBuilder = new NotificationCompat.Builder(this) .SetPriority(1) .SetSmallIcon(Resource.Drawable.ic_logo) .SetContentTitle(info.Title) .SetContentText(body) .SetAutoCancel(true) .SetStyle(new NotificationCompat.BigPictureStyle().BigPicture(imageBitmap).SetBigContentTitle(body)) .SetSound(defaultSoundUri) .SetContentIntent(pendingIntent); } else { notificationBuilder = new NotificationCompat.Builder(this) .SetPriority(1) .SetSmallIcon(Resource.Drawable.ic_logo) .SetContentTitle("Grid Central") .SetContentText(body) .SetAutoCancel(true) .SetStyle(new NotificationCompat.BigTextStyle().BigText(body)) .SetSound(defaultSoundUri) .SetVibrate(new long[] { 1000, 1000 }) .SetContentIntent(pendingIntent); } //var notify = new NotificationCompat.BigTextStyle(notificationBuilder).BigText(body); var notificationManger = NotificationManager.FromContext(this); notificationManger.Notify(0, notificationBuilder.Build()); }