系統登入點
https://yoursite/ag-push/
後台管理登入點
https://yoursite/auth/admin/aerogear/console/index.html
Android 註冊
RegistrarManager.config("register", AeroGearGCMPushConfiguration.class) .setPushServerURI(URI.create(UNIFIED_PUSH_URL)) .setSenderIds(GCM_SENDER_ID) .setVariantID(VARIANT_ID) .setAlias(ALIAS) .setSecret(SECRET) .asRegistrar();
iOS 註冊(Swift)
let device = AGDeviceRegistration(config: "pushconfig") // perform registration of this device device.registerWithClientInfo({ (clientInfo: AGClientDeviceInformation!) in // set the deviceToken clientInfo.deviceToken = deviceToken // --optional config-- // set some 'useful' hardware information params let currentDevice = UIDevice() clientInfo.operatingSystem = currentDevice.systemName clientInfo.osVersion = currentDevice.systemVersion clientInfo.deviceType = currentDevice.model clientInfo.Alias = currentDevice.alias
iOS 註冊(Objective-C)
AGDeviceRegistration *registration = [[AGDeviceRegistration alloc] initWithServerURL: [NSURL URLWithString:@"http://YOUR_SERVER/ag-push/"]]; [registration registerWithClientInfo:^(idclientInfo) { [clientInfo setDeviceToken:deviceToken]; [clientInfo setVariantID:@"YOUR IOS VARIANT ID"]; [clientInfo setVariantSecret:@"YOUR IOS VARIANT SECRET"]; // --optional config-- UIDevice *currentDevice = [UIDevice currentDevice]; [clientInfo setOperatingSystem:[currentDevice systemName]]; [clientInfo setOsVersion:[currentDevice systemVersion]]; [clientInfo setDeviceType: [currentDevice model]]; [clientInfo setAlias:@"User Alias"]; } success:^() { NSLog(@"UnifiedPush Server registration worked"); } failure:^(NSError *error) { NSLog(@"UnifiedPush Server registration Error: %@", error); }];
Cordova 註冊
var pushConfig = { pushServerURL: "", alias: " ", android: { senderID: " ", variantID: " ", variantSecret: " " alias: "User Alias" }, ios: { variantID: " ", variantSecret: " " alias: "User Alias" } }; push.register(onNotification, successHandler, errorHandler, pushConfig);