Skip to content

Advanced Push Targeting on Android and iOS

Parse is the easiest way to send push notifications on Android and iOS. Android push requires almost no setup to create an app that pushes to broad audiences. Today we released tools that help Android developers to target their pushes for a more personalized message.

Let's explore this feature through the fictional game World of SpaceCraft. In this game, each player is a member of one of three teams: Terrestrian, Xerg, and Protion, which are at war with each other. When a team base is under attack, World of SpaceCraft sends a push notification to all players on that team:

ParsePush push = new ParsePush();
push.setMessage("Your base is under attack!");

Use advanced targeting for parse push notifications

Players loved the immersive experience and SpaceCraft was an overnight success. In its second version, World of SpaceCraft supports multiple battles with many bases. Push notifications needed to be more targeted: if a nuclear launch was detected, only one base needed to be notified; and if a building is under attack, only combatants should be notified. Parse's advanced targeting makes this task easy.

The ParseInstallation class (or PFInstallation in iOS) lets developers add any information they need to target pushes. For example, when a player signs up as a Xerg drone, World of SpaceCraft registers the player with:

ParseInstallation installation = ParseInstallation.getCurrentInstallation();
installation.put("unitType", "drone");
installation.put("team", "xerg");

When a Terrestian player launches a nuclear attack on the Xerg's main base, World of SpaceCraft can warn players with:

ParseQuery query = ParseIntallation.query();
query.whereEqualTo("team", "xerg");
query.whereEqualTo("base", "main");
ParsePush.sendMessageInBackground("Nuclear launch detected!", query);

Advanced push targeting makes it easy for applications to provide complex user engagement.