A React Native Expo app demonstrating iOS Live Activities with real APNs integration via a local Express server.
- Remote Live Activity Control: Start Live Activities from your app and control them remotely
- Real-time Updates: Update Live Activity content dynamically while it's running
- Dynamic Island Integration: See your Live Activity appear in the Dynamic Island
- Lock Screen Widgets: Live Activities display on the lock screen with live data
- Graceful Termination: End Live Activities programmatically when done
git clone <your-repo-url>
cd live-activity-demo
yarn install-
Get APNs credentials from Apple Developer Console
- Create an APNs Auth Key (.p8 file)
- Download the
.p8file to your computer - Note your Key ID and Team ID
-
Configure server environment:
cd server
cp env.example .env
# Edit .env with your credentials-
Open your downloaded
.p8file in a text editor and copy the entire contents -
Paste the private key content into your
.envfile:
# Paste your ENTIRE .p8 file contents here (including BEGIN/END lines)
APN_KEY=-----BEGIN PRIVATE KEY-----
MIGTAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBHkwdwIBAQQg...
(your actual private key content)
...
-----END PRIVATE KEY-----
APN_KEY_ID=ABC123DEF4
APPLE_TEAM_ID=XYZ789ABC1
PORT=3000Terminal 1 - Server:
yarn serverTerminal 2 - Build & Run App:
# Build the app (required for native module compilation)
npx expo run:ios
# This builds the Live Activity native module and launches the app
# Note: Use yarn start only for development after initial build- Open the app in iOS Simulator
- Wait for push token to be ready
- Tap "Start Live Activity"
- Check Dynamic Island for the Live Activity
- Test "Update" and "End" functionality
For testing on a physical device, use ngrok to expose your local server:
# Install ngrok
npm install -g ngrok
# Expose server (in new terminal)
ngrok http 3000
# Update SERVER_BASE_URL in services/apnsService.ts to use ngrok URL- App loads → Gets push-to-start token
- User taps Start → App calls local server with token and data
- Server → Sends real APNs notification to Apple
- Apple → Delivers Live Activity to device
- Updates/End → Same flow with push-to-update token
├── app/ # React Native app screens
├── server/ # Express server with APNs integration
├── services/apnsService.ts # HTTP client for server communication
├── contexts/ # Token management
└── modules/ # Live Activity native module
Note: This is a demo project. Production apps would need proper authentication, error handling, and server deployment.