# Add Expo Notifications Fcm

> Set up Firebase Cloud Messaging (FCM) push notifications via expo-notifications for Android. Use when the user says 'add fcm', 'push notifications android', 'expo notifications android', 'firebase push'.

- **Type:** Skill
- **Install:** `agentstack add skill-khadinakbarlabs-expo-mobile-app-builder-add-expo-notifications-fcm`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [khadinakbarlabs](https://agentstack.voostack.com/s/khadinakbarlabs)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [khadinakbarlabs](https://github.com/khadinakbarlabs)
- **Source:** https://github.com/khadinakbarlabs/expo-mobile-app-builder/tree/main/skills/add-expo-notifications-fcm
- **Website:** https://khadinakbar.com

## Install

```sh
agentstack add skill-khadinakbarlabs-expo-mobile-app-builder-add-expo-notifications-fcm
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Add FCM Push (expo-notifications)

Firebase Cloud Messaging — free, unlimited push for Android.

## Install
```bash
npx expo install expo-notifications expo-device
```

## Firebase project setup

Run `set-up-firebase-cli` skill first. Result: `google-services.json` in `android/app/`.

`app.json`:
```json
{
  "expo": {
    "android": { "googleServicesFile": "./google-services.json" },
    "notification": {
      "icon": "./assets/notification-icon.png",
      "color": "#ffffff",
      "androidMode": "default"
    }
  }
}
```

## Request permission (Android 13+ runtime)
```tsx
import * as Notifications from 'expo-notifications';
import * as Device from 'expo-device';

async function registerForPush() {
  if (!Device.isDevice) return;
  let { status } = await Notifications.getPermissionsAsync();
  if (status !== 'granted') {
    const r = await Notifications.requestPermissionsAsync();
    if (r.status !== 'granted') return null;
  }
  const token = (await Notifications.getDevicePushTokenAsync()).data;
  // FCM token — save to backend
  return token;
}
```

## Custom pre-prompt (boost permission opt-in)

Before calling `requestPermissionsAsync`, show your own screen:
> "Get a daily reminder. We promise no spam."
> [Sure] [Later]

If "Sure" → trigger system dialog. If "Later" → don't ask again this session.

## Notification channels (Android 8+)

```tsx
import * as Notifications from 'expo-notifications';

Notifications.setNotificationChannelAsync('daily-reminders', {
  name: 'Daily Reminders',
  importance: Notifications.AndroidImportance.HIGH,
  sound: 'default',
  vibrationPattern: [0, 250, 250, 250],
  lightColor: '#FF231F7C',
});
```

Channels are user-controllable in Settings. Group related notifs.

## Foreground handler
```tsx
Notifications.setNotificationHandler({
  handleNotification: async () => ({
    shouldShowAlert: true,
    shouldPlaySound: false,
    shouldSetBadge: true,
  }),
});
```

## Send from backend
Use Firebase Admin SDK or Expo Push API:
```ts
fetch('https://exp.host/--/api/v2/push/send', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    to: deviceToken,
    title: 'Reminder',
    body: 'Time to log today',
    channelId: 'daily-reminders',
  }),
});
```

## Deep link on tap
```tsx
const notificationRoutes = new Set(['/today', '/library']);

Notifications.addNotificationResponseReceivedListener((response) => {
  const screen = response.notification.request.content.data.screen;
  if (typeof screen === 'string' && notificationRoutes.has(screen)) {
    router.push(screen);
  }
});
```

## Manufacturer battery optimization (CRITICAL)

Xiaomi (MIUI), Oppo (ColorOS), OnePlus, Samsung kill background apps aggressively. Push works most of the time but for ENGAGEMENT push (reminders), users must:
- Settings → Battery → [Your app] → "Don't optimize"
- Some need: Settings → Apps → [Your app] → Battery saver → "No restriction"

Document this in onboarding for power users.

## Pair with
- `add-onesignal-push` for advanced campaigns (RC for transactional, OS for marketing)
- `add-deep-links` to handle taps

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [khadinakbarlabs](https://github.com/khadinakbarlabs)
- **Source:** [khadinakbarlabs/expo-mobile-app-builder](https://github.com/khadinakbarlabs/expo-mobile-app-builder)
- **License:** MIT
- **Homepage:** https://khadinakbar.com

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-khadinakbarlabs-expo-mobile-app-builder-add-expo-notifications-fcm
- Seller: https://agentstack.voostack.com/s/khadinakbarlabs
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
