Skip to content

Commit

Permalink
docs: data types compatible with pubsub for android
Browse files Browse the repository at this point in the history
  • Loading branch information
carlpoole committed Nov 3, 2023
1 parent 36834b7 commit 10db6be
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions website/docs/for-android/how-to/using-the-portals-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,17 @@ PortalsPubSub.getShared().publish("weather", "sunny");

</Tabs>

### 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.

0 comments on commit 10db6be

Please sign in to comment.