August 9, 2022

WeAnswer

The complete guide to the beginners as well as to the experienced Web Developers

Send push notification to iOS devices

Push notifications allow developers to reach users, even when users aren’t actively using an app! In this article, you’ll learn how to configure your app to receive push notifications and to display them to your users or perform other tasks.

Push notification to iOS devices, In other words, APNs (Apple Push Notification service )

Service for iOS application developers to propagate information to push notifications to iOS devices and indirectly watchOS, tvOS, and macOS devices.

Follow the steps here to obtain and configure your APNs credentials

Step 1. Make sure, PHP extension php_openssl is enabled and port 2195 is free on the server.

Step 2. Generate certificate ck.pem from iOS Dev Center(https://developer.apple.com/ios/).

Step 3. Write below code in PHP file using your “ck.pem”, iOS “$deviceToken”(which are generating from an iOS device), and passphrase(use blank value if the passphrase is blank).

New Code

 

Optional settings

Badge: The default value is zero (0), and this would not display a badge.

Sound: Supports default or the name of a sound resource bundled in the app.

Additional payload: Specifies the custom payload values for your notifications to manage your application flow.