Package Exports
- nuxt-twa-module
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nuxt-twa-module) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Nuxt TWA module
This module generates an android app using trusted web activities. It uses the SVGOMG example as template reference and sets the necessery configuration for running the app, creates icons and generates files used by the application.
Requirements
Trusted web activities only work when you are using a legitimate service worker, so we highly recommend using the PWA module or setting up a PWA yourself.
To upload an app to the Google Play Store you need a key for signing. To create one follow these instructions
Important notice
Store the key in safe place, if you uploaded your app with a key you will need the same key for each update.
After you've created this key you will need to copy the SHA-256 for the nuxt configuration file by running this code
$ keytool -list -v -keystore LOCATION_OF_YOUR_KEY.keystoreInstallation 🚀
$ npm install nuxt-twa-module --save-devSetting up configuration
Add nuxt-twa-module to modules section of nuxt.config.js.
{
modules: [
['nuxt-twa-module', {
/* module options */
defaultUrl: 'https://your-url.com',
hostName: 'your-url.com',
sha256Fingerprints: '/* your SHA-256 key */',
applicationId: 'com.example.example',
launcherName: 'Your app name',
versionCode: 1,
versionName: '1.0'
/* optional */
/* overwrite default location for icon */
iconPath: '/static/icon.png'
}],
]
}The values in defaultoptions and module options will replace variables in the build.gradle
Time to build 🏗
When the configuration is done you can run your project like you are used to.
$ npm run build/generateor
$ nuxt build/generateOutput
- An android folder in your project root, which you can be opened in android studio to build your app. When you've build and tested your app you can use Generate Signed Bundle / APK. This will generate a .aab file that can be uploaded to the Google Play Store.
- You Nuxt app with an added
.well-knownfolder which is needed to make your domain trusted with the app in the store.
Debug
To be able to test the android application, you need to tell chrome on your device it can trust your PWA. For this you need to have android-platform-tools installed on your machine.
$ brew cask install android-platform-toolsOn chrome on your device, go to chrome://flags and enable Enable command line on non-rooted devices
On your machine, run the following command to whitelist your URL in chrome:
$ adb shell "echo '_ --disable-digital-asset-link-verification-for-url=\"<your URL>\"' > /data/local/tmp/chrome-command-line"