Android
#
Android PackageThe Replay Android package is hosted on GitHub. Once added as a dependency using JitPack to your Android Studio project, you can replace the MainActivity
:
An assets folder also needs to be created for your project. See Replay Starter for an example setup. You can optionally add an index.html
here to override the default file.
ReplayActivity()
#
#
Overridable methodsonJsCallback(id: String, message: String, message2: String, message3: String, message4: String, message5: String)
: (Optional) A callback for messages sent from your game. See Bridge.
#
MethodsjsBridge(messageId: String, jsArg: String)
: Send a value from Android code to your JS game code. See Bridge.
#
InputsSince Replay Android embeds your game as a web view, the device.inputs
parameter of Sprite methods is an alias of the Web package's inputs:
The @replay/android
package exports this type for TypeScript projects.
#
BridgeYou can send asynchronous messages from your game's JS code to your Android code, and then respond back using a Promise. This allows you to use native features like in-app purchases.
#
JS side- JavaScript
- TypeScript