public void UnregisterFromAzurePushNotification() { if (MainActivityInstance == null) { Log.Info("MainActivityInstance", "MainActivityInstance = null;"); throw new Exception("You need to set AzurePushNotificationImplementation.MainActivityInstance to your MainActivity inside MainActivity.cs."); } try { // Check to ensure everything's set up right GcmClient.CheckDevice(MainActivityInstance); GcmClient.CheckManifest(MainActivityInstance); // Register for push notifications Log.Info("MainActivity", "Unregistering..."); GcmClient.UnRegister(MainActivityInstance); Log.Info("MainActivity", "Completed unregistering."); } catch (Exception exc) { Log.Info("Exception : ", exc.Message); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.FirstView); // Make sure the device support for google play services GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Register the app for push notifications. GcmClient.Register(this, Receiver.senderIDs); TabHost.TabSpec spec; spec = TabHost.NewTabSpec("search"); spec.SetIndicator("", Resources.GetDrawable(Resource.Drawable.indicator_search)); spec.SetContent(this.CreateIntentFor(FirstViewModel.Search)); TabHost.AddTab(spec); spec = TabHost.NewTabSpec("recent"); spec.SetIndicator("", Resources.GetDrawable(Resource.Drawable.indicator_history)); spec.SetContent(this.CreateIntentFor(FirstViewModel.Recent)); TabHost.AddTab(spec); spec = TabHost.NewTabSpec("favourite"); spec.SetIndicator("", Resources.GetDrawable(Resource.Drawable.indicator_favorite)); spec.SetContent(this.CreateIntentFor(FirstViewModel.Favourite)); TabHost.AddTab(spec); }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); Xamarin.FormsMaps.Init(this, bundle); SecureStorageImplementation.StoragePassword = Build.Id; global::Xamarin.Forms.Forms.Init(this, bundle); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); CurrentActivity = this; LoadApplication(new App()); try { GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Nos registramos por notificaciones push System.Diagnostics.Debug.WriteLine("Registrando..."); GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); } catch (Java.Net.MalformedURLException) { System.Diagnostics.Debug.WriteLine("Error creando el cliente. Verifica la URL."); } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e.Message); } }
protected override void OnCreate(Bundle bundle) { instance = this; TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); LoadApplication(new App()); try { GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); System.Diagnostics.Debug.WriteLine("Registrando..."); GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS); } catch (Java.Net.MalformedURLException) { createAndShowDialog("Url inválida", "Erro"); } catch (Exception e) { createAndShowDialog(e.Message, "Erro"); } }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); AzurePushNotificationsImplementation.Init(this); //Validate if Play Services are supported in the system. var gpsAvailable = IsPlayServicesAvailable(); //Settings.Current.IsPushEnabled = gpsAvailable; if (gpsAvailable) { // Check to ensure everything's set up right GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Register for push notifications StartService(new Intent(this, typeof(PNRegistrationService))); } LoadApplication(new App(new AndroidInitializer())); }
public async Task InitializeNotificationsAsync() { try { // If already registered, then just return so that we only register for push notications once if (Locator.Instance.IsPushNotificationsRegistered) { return; } // Check to ensure everything's setup right GcmClient.CheckDevice(MainActivity.CurrentActivity); GcmClient.CheckManifest(MainActivity.CurrentActivity); // Register for push notifications System.Diagnostics.Debug.WriteLine("Registering..."); GcmClient.Register(MainActivity.CurrentActivity, PushHandlerBroadcastReceiver.SENDER_IDS); Locator.Instance.IsPushNotificationsRegistered = true; } catch (Exception e) { Locator.Instance.IsPushNotificationsRegistered = false; CreateAndShowDialog("Registration for push notifications failed:\n\n" + e.Message + "\n\nIf this app is running in an emmulator, make sure that you are deploying to or debugging on a virtual device that has Google APIs set as the target", "Error - Push Registration Failed"); } }
private async void RegisterForNotifications() { GcmClient.CheckDevice(this.ApplicationContext); GcmClient.CheckManifest(this.ApplicationContext); GcmClient.Register(this.ApplicationContext, Constants.GCMProjectIdentifier); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); instance = this; CurrentPlatform.Init(); todoItemManager = new ToDoItemManager(); App.SetTodoItemManager(todoItemManager); LoadApplication(new App()); try { // Check to ensure everything's setup 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(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error"); } catch (Exception e) { CreateAndShowDialog(e, "Error"); } }
public void StartRegisterDevice(Context ctx) { GcmClient.CheckDevice(ctx); GcmClient.CheckManifest(ctx); if (!GcmClient.IsRegistered(ctx)) { try { string projectId; try { _host = _host.ToCurrentScheme(false); projectId = GetGoogleProjectId(); } catch (WebException e) { _host = _host.ToCurrentScheme(true); projectId = GetGoogleProjectId(); } GcmBroadcastReceiver.SenderIds = new[] { projectId }; GcmClient.Register(ctx, GcmBroadcastReceiver.SenderIds); } catch (Exception e) { _applicationContext.HandleException(e); } } }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Activity_To_Do); CurrentPlatform.Init(); // Create the Mobile Service Client instance, using the provided // Mobile Service URL client = new MobileServiceClient(applicationURL); await InitLocalStoreAsync(); // Set the current instance of TodoActivity. instance = this; // Make sure the GCM client is set up correctly. GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Get the Mobile Service sync table instance to use toDoTable = client.GetSyncTable <ToDoItem> (); textNewToDo = FindViewById <EditText> (Resource.Id.textNewToDo); // Create an adapter to bind the items with the view adapter = new ToDoItemAdapter(this, Resource.Layout.Row_List_To_Do); var listViewToDo = FindViewById <ListView> (Resource.Id.listViewToDo); listViewToDo.Adapter = adapter; //// Load the items from the Mobile App backend. //OnRefreshItemsSelected (); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_main); Button button = FindViewById <Button>(Resource.Id.btnLogin); button.Click += btnGiris_Click; txtUsername = FindViewById <EditText>(Resource.Id.txtKullaniciAdi); txtPassword = FindViewById <EditText>(Resource.Id.txtPassword); Intent servIntent = new Intent(ApplicationContext, typeof(LocationControlService)); StartService(servIntent); GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); Firebase.FirebaseApp.InitializeApp(this); Thread.Sleep(1000); //FloatingActionButton fab = FindViewById<FloatingActionButton>(Resource.Id.fab); // fab.Click += FabOnClick; }
protected override void OnCreate(Bundle bundle) { TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); SecureStorageImplementation.StoragePassword = Build.Id; Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); global::Xamarin.Forms.Forms.Init(this, bundle); ImageCircleRenderer.Init(); LoadApplication(new App()); try { GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Register for push notifications System.Diagnostics.Debug.WriteLine("Registering..."); GcmClient.Register(this, GcmService.SenderId); } catch (Java.Net.MalformedURLException) { CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error"); } catch (Exception e) { CreateAndShowDialog(e.Message, "Error"); } }
public static async Task<bool> RegisterService(Context context) { try { // Check to ensure everything's set up right GcmClient.CheckDevice(context); GcmClient.CheckManifest(context); // Register for push notifications System.Diagnostics.Debug.WriteLine("Registering..."); GcmClient.Register(context, PushHandlerBroadcastReceiver.SENDER_IDS); return await Task.Run(() => true); } catch (Java.Net.MalformedURLException) { if (context is MainActivity) (context as MainActivity).CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error"); return await Task.Run(() => false); } catch (Exception e) { if (context is MainActivity) (context as MainActivity).CreateAndShowDialog(e.Message, "Error"); return await Task.Run(() => false); } }
public void Start(string userName) { this.userName = userName; GcmClient.CheckDevice(context); GcmClient.CheckManifest(context); GcmClient.Register(context, Constants.ProjectId); }
private void RegisterForPushNotifications() { GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS); }
private ProgressBar progressBar; // Progress spinner to use for table operations // Called when the activity initially gets created protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Activity_To_Do); // Initialize the progress bar progressBar = FindViewById <ProgressBar>(Resource.Id.loadingProgressBar); progressBar.Visibility = ViewStates.Gone; // Create ProgressFilter to handle busy state var progressHandler = new ProgressHandler(); progressHandler.BusyStateChange += (busy) => { if (progressBar != null) { progressBar.Visibility = busy ? ViewStates.Visible : ViewStates.Gone; } }; try { // Check to ensure everything's setup right GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Register for push notifications System.Diagnostics.Debug.WriteLine("Registering..."); GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); CurrentPlatform.Init(); // Create the Mobile Service Client instance, using the provided // Mobile Service URL and key client = new MobileServiceClient( Constants.ApplicationURL, Constants.ApplicationKey, progressHandler); // Get the Mobile Service Table instance to use todoTable = client.GetTable <TodoItem>(); textNewTodo = FindViewById <EditText>(Resource.Id.textNewTodo); // Create an adapter to bind the items with the view adapter = new TodoItemAdapter(this, Resource.Layout.Row_List_To_Do); var listViewTodo = FindViewById <ListView>(Resource.Id.listViewTodo); listViewTodo.Adapter = adapter; // Load the items from the Mobile Service await RefreshItemsFromTableAsync(); } catch (Java.Net.MalformedURLException) { CreateAndShowDialog(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error"); } catch (Exception e) { CreateAndShowDialog(e, "Error"); } }
protected override void OnCreate(Bundle bundle) { instance = this; TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); ImageCircleRenderer.Init(); LoadApplication(new App()); try { //instalado a library GcmClient e verificamos se está tudo Ok GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); 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 ex) { CreateAndShowDialog(ex.Message, "Error"); } }
protected override void OnCreate(Bundle bundle) { // GCM instance = this; ///// base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); LoadApplication(new DontBeDoryApp.App()); MobileAds.Initialize(ApplicationContext, "ca-app-pub-8521044456540023~7459937605"); // GCM try { GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); 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"); } }
protected override void OnCreate(Bundle bundle) { CurrentActivity = this; base.OnCreate(bundle); global::Xamarin.Forms.Forms.Init(this, bundle); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); LoadApplication(new App()); try { // Check to ensure everything's setup 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"); } }
void RegisterGCM() { GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); GcmClient.Register(this, NotificationConstants.SenderId); }
protected override void OnCreate(Bundle bundle) { // GCM instance = this; ///// TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); global::Xamarin.Forms.Forms.Init(this, bundle); LoadApplication(new App()); // GCM try { GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); 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"); } }
protected override void OnCreate(Bundle bundle) { // Push Notification: inicializando a instancia do MainActivity. instance = this; base.OnCreate(bundle); // Initialize Azure Mobile Apps Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); // Initialize Xamarin Forms global::Xamarin.Forms.Forms.Init(this, bundle); // Load the main application LoadApplication(new App()); // Push Notification try { GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Registra a mensagem no push notifications System.Diagnostics.Debug.WriteLine("Enviando..."); GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); } catch (Java.Net.MalformedURLException) { CreateAndShowDialog("Ocorreu um erro inesperado. Verifique a URL", "Falha"); } catch (Exception e) { CreateAndShowDialog(e.Message, "Falha"); } App.Init((IAuthenticate)this); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); CurrentActivity = this; Forms.Init(this, bundle); CurrentPlatform.Init(); App.Init(this); new SfRatingRenderer(); new SfCalendarRenderer(); ZXing.Net.Mobile.Forms.Android.Platform.Init(); UserDialogs.Init(() => this); FormsVideoPlayer.Init(); LoadApplication(new App()); try { // Check to ensure everything's setup right GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); // Register for push notifications Debug.WriteLine("Registering..."); GcmClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS); } catch (MalformedURLException) { CreateAndShowDialog("There was an error creating the client. Verify the URL.", "Error"); } catch (System.Exception e) { CreateAndShowDialog(e.Message, "Error"); } }
private void RegistrarApp(Context applicationContext) { GcmClient.CheckDevice(applicationContext); GcmClient.CheckManifest(applicationContext); GcmClient.Register(applicationContext, Constantes.SenderId); }
protected override void OnCreate(Bundle bundle) { // Set the current instance of MainActivity. instance = this; TabLayoutResource = Resource.Layout.Tabbar; ToolbarResource = Resource.Layout.Toolbar; base.OnCreate(bundle); Xamarin.Forms.Forms.Init(this, bundle); Xamarin.FormsMaps.Init(this, bundle); App.Init((IAuthenticate)this); LoadApplication(new App()); try { // Check to ensure everything's setup 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"); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); FormsAppCompatActivity.ToolbarResource = Resource.Layout.Toolbar; FormsAppCompatActivity.TabLayoutResource = Resource.Layout.Tabbar; // iconify init Plugin.Iconize.Iconize.With(new Plugin.Iconize.Fonts.MaterialModule()); FormsPlugin.Iconize.Droid.IconControls.Init(); // xlabs init var container = new SimpleContainer(); container.Register <IDevice>(t => AndroidDevice.CurrentDevice); container.Register <IDisplay>(t => t.Resolve <IDevice>().Display); container.Register <INetwork>(t => t.Resolve <IDevice>().Network); Resolver.SetResolver(container.GetResolver()); global::Xamarin.Forms.Forms.Init(this, bundle); // xamarin plugins init ImageCircleRenderer.Init(); // init gcm client GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); //Call to Register the device for Push Notifications GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS); LoadApplication(new App()); }
protected override async void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Activity_To_Do); CurrentPlatform.Init(); // Create the client instance, using the mobile app backend URL. client = new MobileServiceClient(applicationURL); #if OFFLINE_SYNC_ENABLED await InitLocalStoreAsync(); // Get the sync table instance to use to store TodoItem rows. todoTable = client.GetSyncTable <ToDoItem>(); #else todoTable = client.GetTable <ToDoItem>(); #endif textNewToDo = FindViewById <EditText>(Resource.Id.textNewToDo); // Create an adapter to bind the items with the view adapter = new ToDoItemAdapter(this, Resource.Layout.Row_List_To_Do); var listViewToDo = FindViewById <ListView>(Resource.Id.listViewToDo); listViewToDo.Adapter = adapter; ToDoActivity.instance = this; GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); GcmClient.Register(this, ToDoBroadcastReceiver.senderIDs); // Load the items from the mobile app backend. OnRefreshItemsSelected(); }
public override void OnCreate() { base.OnCreate(); var config = new ImageLoaderConfiguration.Builder(this) .MemoryCacheExtraOptions(DroidConstants.ImageSize, DroidConstants.ImageSize) // default = device screen dimensions .DiskCacheExtraOptions(DroidConstants.ImageSize, DroidConstants.ImageSize, null) .ThreadPoolSize(10) // default .ThreadPriority(Thread.NormPriority - 2) // default .TasksProcessingOrder(QueueProcessingType.Fifo) // default .MemoryCacheSize(20 * 1024 * 1024) .MemoryCacheSizePercentage(30) // default .DiskCacheSize(50 * 1024 * 1024) .DiskCacheFileCount(300) .WriteDebugLogs() .Build(); ImageLoader.Instance.Init(config); Crittercism.Init(ApplicationContext, "1c2c97937d6f4d0aa6235204ae512f4000555300"); GcmClient.CheckDevice(this); GcmClient.CheckManifest(this); GcmClient.Register(this, GcmBroadcastReceiver.SENDER_IDS); var handler = new ApplicationLifecycleHandler(); RegisterActivityLifecycleCallbacks(handler); RegisterComponentCallbacks(handler); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); this.Window.AddFlags(WindowManagerFlags.Fullscreen); global::Xamarin.Forms.Forms.Init(this, bundle); Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init(); App.UIContext = this; LoadApplication(new ContosoInsurance.App()); instance = this; #if PUSH // need to use a Google image on an Android emulator try { // Check to ensure everything's setup 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(new Exception("There was an error creating the Mobile Service. Verify the URL"), "Error"); } catch (Exception e) { CreateAndShowDialog(e, "Error"); } #endif }
/// <summary> /// For Android project, obj must be the MainActivity. /// </summary> /// <param name="obj"></param> public void RegisterForAzurePushNotification() { if (MainActivityInstance == null) { Log.Info("MainActivityInstance", "MainActivityInstance = null;"); throw new Exception("You need to set AzurePushNotificationImplementation.MainActivityInstance to your MainActivity inside MainActivity.cs before calling LoadApplication(new App());"); } try { // Check to ensure everything's set up right GcmClient.CheckDevice(MainActivityInstance); GcmClient.CheckManifest(MainActivityInstance); // Register for push notifications Log.Info("MainActivity", "Registering..."); GcmClient.Register(MainActivityInstance, MyBroadcastReceiver.SENDER_IDS); Log.Info("MainActivity", "Completed Registering."); } catch (Exception exc) { Log.Info("Exception : ", exc.Message); } }