Skip to content

Commit

Permalink
docs(android): data types compatible with pubsub (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
carlpoole committed Dec 8, 2023
1 parent 75d9bd8 commit a03ffec
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 from native 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 a03ffec

Please sign in to comment.