u/nelvincheung

REALLY DESPERATE, notification works perfectly in emulator, once on real phone breaks. HELP NEEDED.

expo-notifications on Android — Failed to schedule the notification. org.json.JSONObject — crashes on physical Xiaomi but not on emulator, surviving all fix attempts

We've been chasing a persistent org.json.JSONObject crash in expo-notifications@0.32.17 for three app versions. Looking for anyone who's actually resolved this.

What we're building: A React Native (Expo, CNG) app that schedules local push notifications. Users set recurring reminders; we call scheduleNotificationAsync once per date slot.

The error — identical every time:

Failed to schedule the notification. org.json.JSONObject

Appears in logcat and Sentry. org.json.JSONObject is the Java class name, not a message string — meaning a JSONException escapes ArgumentsNotificationContentBuilder.getBody() uncaught, because the catch block only handles NullPointerException.

Reproduction pattern:

  • ✅ Works fine: Android emulator (stock AOSP)
  • ❌ Fails: Physical Xiaomi device (MIUI, Android 13)
  • ❌ Fails: EAS production build from Google Play
  • ✅ Works: Local gradlew assembleRelease

Our actual scheduling code:

slotBuilder.ts — builds the payload, coerces all data values to strings:

typescript

function toSafeData(obj: Record<string, unknown>): Record<string, string> {
  const out: Record<string, string> = {};
  for (const [k, v] of Object.entries(obj)) {
    if (v == null) continue;
    out[k] = typeof v === 'string' ? v : JSON.stringify(v);
  }
  return out;
}

// data passed to scheduler:
data: toSafeData({
  reminderId: reminder.id,    // string
  style:      reminder.style, // string
  locale:     reminder.locale,// string
})

scheduler.ts — the actual scheduleNotificationAsync call:

typescript

const notifId = await Notifications.scheduleNotificationAsync({
  content: {
    title: slot.title,   // string
    body:  slot.body,    // string
    data:  slot.data,    // Record<string, string> — fully guarded above
    sound: true,         // ← boolean — our current suspect
    ...(Platform.OS === 'android' && { channelId: REMINDER_CHANNEL_ID }),
  },
  trigger: {
    type: Notifications.SchedulableTriggerInputTypes.DATE,
    date: slot.fireDate,
  },
});

What we've already tried:

  1. patch-package to widen the Java catch block to also catch JSONException → patch applies to source on EAS server but bytecode in the final APK is unchanged (expo-notifications resolves as a pre-built AAR from Maven, not compiled from source)
  2. EAS_BUILD_DISABLE_MAVEN_CACHE=1 → patch still doesn't apply
  3. toSafeData() guard on the entire data field → error persists

Current hypothesis: toSafeData() correctly sanitizes the data sub-object. The only remaining non-string value in the content object is sound: true — a boolean at the top level of content, not inside data. Our Android channel (setupChannel()) already sets sound: null (device default), making sound: true in the content object completely redundant on Android. We suspect MIUI's modified notification stack does a secondary JSONObject serialization pass over the full content object, and the boolean is what triggers the exception. Stock AOSP (emulator) tolerates it.

Questions:

  1. Has anyone actually resolved org.json.JSONObject from expo-notifications on a physical Android device?
  2. Is sound: true in notification content (not channel) known to cause issues on MIUI or other OEM ROMs?
  3. Is there any documented difference in how expo-notifications serializes the content object between stock Android and MIUI?
  4. Are there other non-string fields in NotificationContentInput that could cause this on certain ROMs?
  5. Any known issues on expo-notifications?
  6. Or even investigation ideas or direction?
  7. we do have a icon transparent png, for notification icon, but i think this is unlikely.

Any help and pointer is appreciated. been literally trying to fix for over a week, however with no results, and now not even much direction or ideas.

reddit.com
u/nelvincheung — 2 days ago

Step 1 — https://groups.google.com/g/cangjieking

Step 2 — https://play.google.com/apps/testing/com.cangjieking.cangjielearner

Step 3 — https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner

Step 4 ⚠️ Important: After downloading, please leave a rating and written review on the Play Store. This is required for us to publish the official version. Thank you! (U do more I do more for you)

https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner
(Google may not let u to publish the official version, if it don’t have records on actual feedback, so, we need  so feedback, u can randomly say a page text is small, that is fine. I will also do the same for you as well. )

Provide a screenshot to, and i will do in return.

reddit.com
u/nelvincheung — 19 days ago

Step 1 — https://groups.google.com/g/cangjieking

Step 2 — https://play.google.com/apps/testing/com.cangjieking.cangjielearner

Step 3 — https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner

Step 4 ⚠️ Important: After downloading, please leave a rating and written review on the Play Store. This is required for us to publish the official version. Thank you! (U do more I do more for you)

https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner
(Google may not let u to publish the official version, if it don’t have records on actual feedback, so, we need  so feedback, u can randomly say a page text is small, that is fine. I will also do the same for you as well. )

 

Tier 1 help each other: Just download and screenshot, putting app in phone for 14 days, sometimes opening it

Tier 2. Everything in tier 1, but will give some comment feedback each day as well.
(giving the 5 star review, and comment some feedback,
Good: "The UI is clean, but the back button sometimes crashes on Android 13.", change the text size in x
Bad: “Tested” or “Nice app.”

Tell me which tier u want to do.

https://preview.redd.it/irfynouzytyg1.png?width=720&format=png&auto=webp&s=d8c4947e8fe9924122c4ec1d816158e444ed6b47

reddit.com
u/nelvincheung — 20 days ago

倉頡王 (CangJie King) — Android Closed Beta 🙏

Step 1 — Join the tester Google Group:

https://groups.google.com/g/cangjieking

Step 2 — Click the opt-in link:

https://play.google.com/apps/testing/com.cangjieking.cangjielearner

Step 3 — Confirm you see "You are a tester" on the page

⚠️ This step is required — you're not officially a tester until you see this message

Step 4 — Download from the Play Store:

https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner

Step 5 ⚠️ Important: After downloading, please leave a 5 star rating and written review on the Play Store. This is required for us to publish the official version. Thank you!

(Google may not let u to publish the official version, if it don’t have records on actual feedback, so, we need  so feedback, u can randomly say a page text is small, that is fine. I will also do the same for you as well. )

https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner

Notes:

After helping me, please screenshot and Give me your link that requires help.
Thank you so much for helping test! 🙌

Tier 1 help each other: Just download and screenshot, putting app in phone for 14 days, sometimes opening it

Tier 2. Everything in tier 1, but will give some comment feedback each day as well.

Tell me which tier u want to do.

reddit.com
u/nelvincheung — 20 days ago

倉頡王 (CangJie King) — Android Closed Beta 🙏

Step 1 — Join the tester Google Group:

https://groups.google.com/g/cangjieking

Step 2 — Click the opt-in link:

https://play.google.com/apps/testing/com.cangjieking.cangjielearner

Step 3 — Confirm you see "You are a tester" on the page

⚠️ This step is required — you're not officially a tester until you see this message

Step 4 — Download from the Play Store:

https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner

Step 5 ⚠️ Important: After downloading, please leave a 5 star rating and written review on the Play Store. This is required for us to publish the official version. Thank you!

(Google may not let u to publish the official version, if it don’t have records on actual feedback, so, we need  so feedback, u can randomly say a page text is small, that is fine. I will also do the same for you as well. )

https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner

Notes:

After helping me, please screenshot and Give me your link that requires help.
Thank you so much for helping test! 🙌

Tier 1 help each other: Just download and screenshot, putting app in phone for 14 days, sometimes opening it

Tier 2. Everything in tier 1, but will give some comment feedback each day as well.

Tell me which tier u want to do.

reddit.com
u/nelvincheung — 23 days ago

倉頡王 (CangJie King) — Android Closed Beta 🙏

CangJie King is an app for learning and practising the Cangjie input method, featuring practice modes, a dictionary, and quizzes.

Please follow these steps using the same Google account throughout:

Step 1 — Join the tester Google Group:

https://groups.google.com/g/cangjieking

Step 2 — Click the opt-in link:

https://play.google.com/apps/testing/com.cangjieking.cangjielearner

Step 3 — Confirm you see "You are a tester" on the page

⚠️ This step is required — you're not officially a tester until you see this message

Step 4 — Download from the Play Store:

https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner

Step 5 ⚠️ Important: After downloading, please leave a 5 star rating and written review on the Play Store. This is required for us to publish the official version. Thank you!

(Google may not let u to publish the official version, if it don’t have records on actual feedback, so, we need  so feedback, u can randomly say a page text is small, that is fine. I will also do the same for you as well. )

https://play.google.com/store/apps/details?id=com.cangjieking.cangjielearner

Notes:

After helping me, please screenshot and Give me your link that requires help.
Thank you so much for helping test! 🙌

reddit.com
u/nelvincheung — 24 days ago