This tool creates an Android Studio project from your Progressive Web Application (PWA).
The usage is fairly simple, it uses official Google example as a base and replaces values and images fetched from your PWA site.
After running this tool you should be able to open the newly created project in Android Studio and make any modifications you want.
Note that this tool is in a really early state and thus may fail anytime. I tested it with Angular powered apps and it worked well but results with other frameworks may vary. If it doesn't work for you, create an issue.
The PWA needs to specify that your app can access the content, read more here
You can either download the compiled static binary from releases or compile it yourself.
This tool takes three parameters:
- The android package name (e.g.
com.example.my_pwa
) - The PWA url (e.g.
https://my_pwa.example.com
) - The output directory (e.g.
./my-cool-pwa
)
If the manifest path is not in html source code or could not be detected for any other reason, you can add the relative path to your manifest using the --manifest option (relative to the PWA url).
You can even have the manifest in a local file and use it instead of fetching it from the web using the --local-manifest option.
Example:
pwa-to-twa com.example.my_pwa https://my_pwa.example.com ./my-cool-pwa
Example with --manifest option:
pwa-to-twa com.example.my_pwa https://my_pwa.example.com ./my-cool-pwa --manifest /manifest.json
Example with --local-manifest:
pwa-to-twa com.example.my_pwa https://my_pwa.example.com ./my-cool-pwa --local-manifest ./manifest.json
This tool needs these cli tools to be able to work:
- convert (from ImageMagick)
You need the Qt framework (tested with 5.10.1) and libgit2
(on Ubuntu you can use apt install libgit2-dev
).
Change into the cloned directory and:
git submodule init
git submodule update
qmake pwa-to-twa.pro
make
The binary file pwa-to-twa
will be created, to test
that everything works run ./pwa-to-twa
, you should see
something like this:
Usage: ./pwa-to-twa androidPackageName pwaUrl outputPath [--manifest path-to-manifest] [--local-manifest path-to-manifest]
Example: ./pwa-to-twa com.vendor.pwa https://pwa.vendor.com ./my-cool-pwa
Example: ./pwa-to-twa com.vendor.pwa https://pwa.vendor.com ./my-cool-pwa --manifest relative/path/to/manifest
Example: ./pwa-to-twa com.vendor.pwa https://pwa.vendor.com ./my-cool-pwa --local-manifest ./manifest.json
You need to have docker installed.
Change into the cloned directory and:
./configure-static
./build-static
This command will download the necessary image and
statically compile the app to binary file pwa-to-twa
.
(Binary created using the same command is always
available in releases).