Chapter 8. Push notification and in-app purchase—Rock, Paper, Scissors
This chapter covers
Push notification is a way to have a server send a message to a device. The message can include text, a badge number for the specified app’s icon, and an audio file included in the app to play.
If the app isn’t currently running, the user will see the notification and can open the app. If the app is running, a certain method is called with the notification details, which the app is designed to handle.
In-app purchases are facilitated by the app, but supported by the server, which handles the payment processing. The items available for sale within the app are stored on the server. The information stored is little more than an ID, description, and price. The app can query for salable items from the server, present them to the user, and then initiate the sale.
Apple servers handle the sales transaction, which prompts the user for their iTunes account password. The sale is handled like buying an app, and the user is emailed a receipt. The app is informed of the outcome of the sale (such as success or failure) and can then provide the user with whatever they bought.