How to unlock a simple subscription-based premium feature in a cordova application.
- Run
npm installat the root of the project to install cordova locally for the project. - From the
without-server/directory:npm run browserwill run the demo in the browser
- To run the demo on Android, a few extra steps are required:
- Update
config.xmlto use your own application id. - Update
www/ts/subscription-service.tsto use your own iaptic configuration and product identifiers. - From the
without-server/directory,npm run androidwill build the demo for android.
- Update
Note: If you are curious to know what those
npm runcommands do, just typenpm runwithout arguments.
This example requires you to deploy the demo server: https://github.com/iaptic/iaptic-example-nodejs-backend It's a minimal server that handles user sessions and subscription status.
Running the demo is similar to the example without a server.
All configuration for that example is in www/ts/configuration.ts
Source code in typescript is included in the cordova/www/ts directory.
- The entrypoint is
index.ts - In-App Purchases are handled in
subscription-service.ts - The pages are rendered in
pages/*-page.ts
(c) 2023, Jean-Christophe HOELT
License: MIT