From 10db6be3ac28cc127b828adb0b8adf5c77cf27e2 Mon Sep 17 00:00:00 2001 From: Carl Poole Date: Fri, 3 Nov 2023 09:53:48 -0500 Subject: [PATCH] docs: data types compatible with pubsub for android --- .../for-android/how-to/using-the-portals-plugin.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/website/docs/for-android/how-to/using-the-portals-plugin.md b/website/docs/for-android/how-to/using-the-portals-plugin.md index cd0cf19..cd338d7 100644 --- a/website/docs/for-android/how-to/using-the-portals-plugin.md +++ b/website/docs/for-android/how-to/using-the-portals-plugin.md @@ -380,6 +380,17 @@ PortalsPubSub.getShared().publish("weather", "sunny"); +### Data Types + +Data published through the `publish()` function should be a type compatible with objects in the [org.json](https://developer.android.com/reference/org/json/package-summary) package. Compatible types include: + +- String +- Numbers (e.g: integer) +- [JSONObject](https://developer.android.com/reference/org/json/JSONObject) +- [JSONArray](https://developer.android.com/reference/org/json/JSONArray) + +The Capacitor [JSObject](https://github.com/ionic-team/capacitor/blob/main/android/capacitor/src/main/java/com/getcapacitor/JSObject.java) and [JSArray](https://github.com/ionic-team/capacitor/blob/main/android/capacitor/src/main/java/com/getcapacitor/JSArray.java) are also compatible. + ## Examples The `PortalsPlugin` is used in the [E-Commerce App](../examples/ecommerce-app) demo.