form http://ionicframework.com/docs/native/push/
ionic start aaa tabs
pod setup
cordova plugin add cordova-plugin-crosswalk-webview
ionic upload (sync APP ID)
ionic cordova plugin add phonegap-plugin-push --variable SENDER_ID=XXXXXXXXX
npm install --save @ionic-native/push
ionic Cordova platform add ios
ionic Cordova platform add android
Preformatted text
in ionic.io > setting > Certificates I upload all Certificates iOS and FCM android success
I test on device Samsung Galaxy S3 4.3 It not work not show error and it Nothing happened.
I test on device iPhone 6Plus 10.3.2 it show log token from Xcode
2017-06-07 14:27:52.600567+0700 PSP for parient[802:357967] DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/36F6DB34-2116-44A7-9440-4A21D051B90D/Library/Cookies/Cookies.binarycookies
2017-06-07 14:27:52.841985+0700 PSP for parient[802:357967] Apache Cordova native platform version 4.4.0 is starting.
2017-06-07 14:27:52.843091+0700 PSP for parient[802:357967] Multi-tasking -> Device: YES, App: YES
2017-06-07 14:27:52.966243+0700 PSP for parient[802:357967] Using UIWebView
2017-06-07 14:27:52.969809+0700 PSP for parient[802:357967] [CDVTimer][handleopenurl] 0.147998ms
2017-06-07 14:27:52.974129+0700 PSP for parient[802:357967] [CDVTimer][intentandnavigationfilter] 4.203022ms
2017-06-07 14:27:52.974383+0700 PSP for parient[802:357967] [CDVTimer][gesturehandler] 0.150979ms
2017-06-07 14:27:52.997387+0700 PSP for parient[802:357967] [CDVTimer][splashscreen] 22.854984ms
2017-06-07 14:27:53.011666+0700 PSP for parient[802:357967] [CDVTimer][statusbar] 14.114976ms
2017-06-07 14:27:53.013673+0700 PSP for parient[802:357967] [CDVTimer][keyboard] 1.798987ms
2017-06-07 14:27:53.013843+0700 PSP for parient[802:357967] [CDVTimer][TotalPluginStartup] 44.175982ms
2017-06-07 14:27:53.207515+0700 PSP for parient[802:357967] createNotificationChecker
2017-06-07 14:27:53.207599+0700 PSP for parient[802:357967] not coldstart
2017-06-07 14:27:53.211037+0700 PSP for parient[802:357967] active
2017-06-07 14:27:53.212304+0700 PSP for parient[802:357967] PushPlugin skip clear badge
2017-06-07 14:27:53.285733+0700 PSP for parient[802:358127] libMobileGestalt MobileGestaltSupport.m:153: pid 802 (PSP for parient) does not have sandbox access for frZQaeyWLUvLjeuEK43hmg and IS NOT appropriately entitled
2017-06-07 14:27:53.285850+0700 PSP for parient[802:358127] libMobileGestalt MobileGestalt.c:550: no access to InverseDeviceID (see <rdar://problem/11744455>)
2017-06-07 14:27:54.153256+0700 PSP for parient[802:357967] Resetting plugins due to page load.
2017-06-07 14:27:58.479576+0700 PSP for parient[802:357967] Finished load of: file:///var/containers/Bundle/Application/B3E5C1EF-BDB1-4145-9D56-52B63D35C54C/PSP%20for%20parient.app/www/index.html
2017-06-07 14:27:59.023147+0700 PSP for parient[802:357967] THREAD WARNING: ['Device'] took '39.726807' ms. Plugin should use a background thread.
2017-06-07 14:27:59.168189+0700 PSP for parient[802:357967] Ionic Native: deviceready event fired after 4060 ms
2017-06-07 14:27:59.168321+0700 PSP for parient[802:357967] DEVICE READY FIRED AFTER 3797 ms
2017-06-07 14:27:59.232287+0700 PSP for parient[802:357967] THREAD WARNING: ['StatusBar'] took '63.853027' ms. Plugin should use a background thread.
2017-06-07 14:27:59.260093+0700 PSP for parient[802:358126] Push Plugin register called
2017-06-07 14:27:59.261644+0700 PSP for parient[802:358126] PushPlugin.register: setting badge to false
2017-06-07 14:27:59.261718+0700 PSP for parient[802:358126] PushPlugin.register: clear badge is set to 0
2017-06-07 14:27:59.261749+0700 PSP for parient[802:358126] PushPlugin.register: better button setup
2017-06-07 14:27:59.299973+0700 PSP for parient[802:358126] GCM Sender ID (null)
2017-06-07 14:27:59.300063+0700 PSP for parient[802:358126] Using APNS Notification
2017-06-07 14:28:00.219070+0700 PSP for parient[802:357967] Push Plugin register success: <e78663bf d55dc728 be75464c 5fef8129 bc14c8ed 8df51a95 fd2135e8 3d47aec5>
2017-06-07 14:28:00.264875+0700 PSP for parient[802:357967] Device registered [object Object]
2017-06-07 14:28:01.717306+0700 PSP for parient[802:357967] active
2017-06-07 14:28:01.717430+0700 PSP for parient[802:357967] PushPlugin skip clear badge
2017-06-07 14:28:01.806969+0700 PSP for parient[802:357967] Push Plugin register success: <e78663bf d55dc728 be75464c 5fef8129 bc14c8ed 8df51a95 fd2135e8 3d47aec5>
2017-06-07 14:28:01.889623+0700 PSP for parient[802:357967] Device registered [object Object]
I test send push from webpage ionic.io, it not show. it Nothing happened.
ionic info
global packages:
@ionic/cli-utils : 1.3.0 Cordova CLI : 7.0.1 Ionic CLI : 3.3.0
local packages:
@ionic/app-scripts : 1.3.7 @ionic/cli-plugin-cordova : 1.3.0 @ionic/cli-plugin-ionic-angular : 1.3.0 Cordova Platforms : android 6.2.3 ios 4.4.0 Ionic Framework : ionic-angular 3.3.0
System:
Node : v6.10.3 OS : macOS Sierra Xcode : Xcode 8.3.3 Build version 8E3004b ios-deploy : not installed ios-sim : not installed
in app.component.ts
import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { TabsPage } from '../pages/tabs/tabs';
import { Push, PushObject, PushOptions } from '@ionic-native/push';
@Component({
templateUrl: 'app.html'
})
export class MyApp {
rootPage:any = TabsPage;
constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private push: Push) {
platform.ready().then(() => {
// Push Start
// to initialize push notifications
const options: PushOptions = {
android: {
senderID: '-----'
},
ios: {
alert: 'true',
badge: true,
sound: 'false'
},
windows: {}
};
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));
// Push end
statusBar.styleDefault();
splashScreen.hide();
});
}
}