Build process part 2: Capacitor
The build process relies on a config file capacitor.config.json where any configuration or plugins can be added.
The app makes use of the PushNotifications plugin.
capacitor.config.json: local config
...
{
"appId": "org.avert.youthboost",
"appName": "youthboost",
"webDir": "public",
"bundledWebRuntime": false,
"plugins": {
"PushNotifications": {
"presentationOptions": ["badge", "sound", "alert"]
}
}
}
The config can also be set for local development and debugging e.g:
capacitor.config.json: local config
...
{
"appId": "org.avert.youthboost",
"appName": "youthboost",
"webDir": "public",
"bundledWebRuntime": false,
"server": {
"url": "http://192.168.1.1:8000",
"cleartext": true
}
"plugins": {
"PushNotifications": {
"presentationOptions": ["badge", "sound", "alert"]
}
}
}
The following commands can be used from the command line:
npx cap update android Run this to apply any config updates
npx cap copy android Run this to copy the assets to the android folder (note that you must run a gatsby build first)
npx cap open android Run this to open the project in Android Studio, from there a build can be created as an .apk file
Full documentation for the CLI can be found here