Ana içeriğe atla

Ionic Android Push Notification

Ionic push notifications are really easy to implement but if you couldn't find the best tutorial to use push notification yet it can't be easy at the first. Due to this reason I decide to prepare this small tutorial for ionic developers.

Lets start with easy steps.

Android Push Notification

 - Create Firebase account at here https://firebase.google.com/

 - After creating your firebase account click to "GO TO CONSOLE" button from right top corner of page. (you should redirect to https://console.firebase.google.com/ link.)

 - Click to "Create Project" button and enter dummy values to input. Just care about application package name while you fill the input, it should has same name with your project root directory config.xml file widget id value.

 - Then end of the creating new project wizard you should download google-services.json file to your project "projectName/platforms/android/app/" directory.

- click the settings in the top of left nav bar and go to 'Cloud Messaging'  menu.then copy your senderID to use following steps.

- then run the following commands in console


cd projectName
ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID=yoursenderId

npm install --save @ionic-native/push


 - Then open component.ts file and add to following codes.

import { Push, PushObject, PushOptions } from '@ionic-native/push';

constructor(private push: Push) {

this.pushInit();

}

pushInit(){


const options: PushOptions = { android: {
senderID:'put your senderId here'
}, ios: { alert: 'true', badge: true, sound: 'false' } }; const pushObject: PushObject = this.push.init(options); pushObject.on('notification').subscribe((notification: any) => console.log('Received a notification', notification)); pushObject.on('registration').subscribe((registration: any) => console.log('Device registered', registration));
pushObject.on('error').subscribe(error => console.error('Error with Push plugin', error));


}


 - now when you start your application, you can get push message and regsiteredDeviceId values.

 - after that you can use 'Cloud Messaging' link from left nav menu and send push message to all users or deviceId spesific users.








Bu blogdaki popüler yayınlar

Netsis NetOpenX50 Nesnesini C# Visual Studio Üzerinde Çalıştırma

Netsis ile sipariş, ürün, fiyat, stok entegrasyonları yaparken NetOpenX apisini kullanmamız gerekiyor. Netsis kullanan bir firma ile entegrasyon geliştirmeden önce yapmamız gereken şey firmanın netopenx api lisansı alıp almadığını öğrenmeliyiz.Bunu onaylattıktan sonra Visual Studio projemize NetOpenx50 dosyasını referans olarak eklemek kalıyor. Projemize referans eklemek için öncelikle NetOpenX50.dll ini bilgisayarımıza indiriyoruz.Ardından komut sataırına girerek aşağıdaki komutu vermeliyiz. regsvr32 C:\Netsis\NetOpenX50.dll Bu işlem sonrasında NetOpenX50 dosyamızı com objesi olarak işletim sistemimize kayıt etmiş oluyoruz. Hemen ardından visual studio projemizi açarak projenin üzerinde References kısmına sağ tuş tıklayarak yeni referens ekle diyoruz.Ardından çıkan pencereden sol panelden COM objelerini seçiyoruz ve orada "NetOpenX50 Kütüphanesi" alanı zaten çıkıyor ve direk seçip referans olarak projemize ekleyebiliyoruz. NetOpenX50 apisinin kullanımı için her d...

.NET Core 3.0: Razor views değişikliklerinde uygulama tekrar derlenmeme problemi

 Normal şartlarda mvc  ortamında uygulama geliştirirken cshtml dosyalarında yaptığımız değişiklikler uygulama çalışır durumdayken sayfayı yenilediğimizde otomatik derlenip ekrana geliyordu sadece .cs dosyalarındaki işlemler için uygulamayı durdurup tekrar başlatmamız gerekiyordu. Fakat .net core ile birilkte bu çalışmamaya başladı ve mvc core uygulaması geliştirirken view larımızda yaptığımız her değişiklikten sonra uygulamayı durdurup tekrar başlatmamız gerekiyor bu da geliştirme sırasında bir işkenceye dönüşüyor.  Bu sorunu çözmek için bir nuget package yükleyerek startup.cs e aşağıdaki kodu eklememiz yeterli. Sırası ile  :  1. Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation nuget package ını indiriyoruz. 2. Startup.cs içerisine aşağıdaki gibi bir ekleme yapıyoruz ki bu kısım views değiştiğinde otomatik recompile işlemini yapacak kısım. services . AddControllersWithViews (). AddRazorRuntimeCompilation (); yada  services . AddControllers (). AddRa...

Linux Centos 7 - .Net Core Api Yayınlama

.Net Core dünyasını uzun zamandır takip etmemin yanı sıra bir fırsat bulupta arge ve küçük deneme projelerinden öteye geçememiş, henüz zamanı var bu platform biraz daha olgunlaşsın community artsın diye diye baya da geç kalmıştım :) Sonunda dedim ki tamam ben artık bu .Net Core dünyasına geçiş yapayım ve deployment dahil tam bir similasyon projesi yapayım gerçek hayata uygun şekilde. Bu tarafta da belirlediğim kıstasların başında projenin Linux da çalışması vardı.Şimdi bakalım adım adım neler yaptık, hangi kavramları öğrendik ve sonuca nasıl ulaştık. Başlamadan Önce Araştırmanız Gereken Temel Konular;  - Nginx -> EngineX  - Centos7 Linux İşletim sistemi  - .Net Core Kestrel Servis  - SSH ile command line üzerinden linux sunucusuna bağlantı ve temel ssh komutları  - .Net Core da bir api projesi oluşturmak ve deploy etmek  -