Oracle Help Center | Oracle Push Cloud Service (Standalone) title

Implementing Categories

If your application provides users a way to specify a preference or favorite, you may want to register devices for categories so you can push relevant content to your users:

    - (IBAction)switchAction:(id)sender
    {
         UISwitch *mySwitch = (UISwitch *)sender;

         if (mySwitch.on == YES)
         {
            // Register for US Headlines
            [[PushIOManager sharedInstance] registerCategory:@"US"];
         }
         else
         {
            // Unregister for US Headlines
            [[PushIOManager sharedInstance] unregisterCategory:@"US"];
         }
    }

This kind of registration can be tied to a UI Action, such as a UI Switch:

"Example of a UI switch for turning on categories"

You can also ask PushIOManager if a category is registered, to help configure your UI:

    - (void)viewWillAppear
    {
        [super viewWillAppear];

        // Set UI switches based upon Push IO registration status
        _usSwitch.on = [[PushIOManager sharedInstance] isRegisteredForCategory:@"US"];
        _sportsSwitch.on = [[PushIOManager sharedInstance] isRegisteredForCategory:@"Sports"];
    }

Tip: There's a great way to check if your registration code is working. If you log into the Web Dashboard --> Set Up --> Categories section, you will see each category and its total number of registered devices:

"PushIO Web Dashboard, Set Up tab, Categories section"

Also, by default, the PushIOManager registers each user for a broadcast category, so that you can push to all your users. Users can be registered (and unregistered) for the broadcast push category using these methods:

// Register device, so broadcasts can be sent to the user.
[[PushIOManager sharedInstance] registerWithPushIO];

// Unregister device entirely from Push IO.
[[PushIOManager sharedInstance] unregisterFromPushIO];