Skip to content

Navigation Menu

Sign in
Sign up
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
This repository was archived by the owner on Feb 7, 2019. It is now read-only.

Should the samples call registerUserNotificationSettings() before register()? #210

Open
Labels

Description

In the README.md and in the demo app, it first calls pushPlugin.register() then calls pushPlugin.registerUserNotificationSettings(). It seems like this is the reverse of the example in the Configuring Remote Notification Support (in the Obtaining a Device Token in iOS and tvOS section) of the Apple Docs.

onRegisterButtonTap() {
let self = this;
pushPlugin.register(this.pushSettings, (token: String) => {
self.updateMessage("Device registered. Access token: " + token);
// token displayed in console for easier copying and debugging durng development
console.log("Device registered. Access token: " + token);
if (pushPlugin.registerUserNotificationSettings) {
pushPlugin.registerUserNotificationSettings(() => {
self.updateMessage("Successfully registered for interactive push.");
}, (err) => {
self.updateMessage("Error registering for interactive push: " + JSON.stringify(err));
});
}
}, (errorMessage: String) => {
self.updateMessage(JSON.stringify(errorMessage));
});
}

Apple Sample Code:

func application(_ application: UIApplication,
 didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
 // Configure the user interactions first.
 self.configureUserInteractions()
 
 // Register with APNs
 UIApplication.shared.registerForRemoteNotifications()
}

It makes sense that you would want to setup the interactions first so that you don't run into a race condition trying to configure interactions before a notification comes in.

I'm totally new to mobile dev and just happened to be reading the Apple Docs to make sure I understood how this stuff works.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      AltStyle によって変換されたページ (->オリジナル) /