Documentation Capacitor example #29
Replies: 5 comments 1 reply
-
@EMI-INDO Thanks for considering capacitor documentation. I'm just wake up, after reaching office, I'll give full details with example. Note: You are a great developer, don't use Cordova, try move to Capacitor or other tool. I have more than 100 app's in Cordova and I'm a Cordova developer from 2014, but many features are deprecated and many plugin's are not maintaining, so end of the 2023 onwards I'm using capacitor tools and trying to convert all my Cordova apps to Capacitor. I'm using Capacitor and framework 7. There only difference is javascript module based code, initially 2 months I'm struggling in capacitor, but now I have more experience. |
Beta Was this translation helpful? Give feedback.
-
Highlight of this plugin Install the plugin If your using module based javascript
Or
For iOS Step 1:
Step 2
For Android Find the below line Replace with your actual admob app id Step 2 (Optional): |
Beta Was this translation helpful? Give feedback.
-
Now I understand, it seems that there is no need to manually edit the admob-app-id in plugin.xml, I just need to create a capacitor-specific hook script, users can simply add the original admob-app-id from capacitor.config.json, everything will run automatically. |
Beta Was this translation helpful? Give feedback.
-
Plugin updated, including this documentation, emi-indo-cordova-plugin-admob@1.6.1 |
Beta Was this translation helpful? Give feedback.
-
Please add the below details to your capacitor documentation
Automatically update the AdMob id while building (npm run build)
|
Beta Was this translation helpful? Give feedback.
-
Note release https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/releases
Copy all the files in https://github.com/EMI-INDO/emi-indo-cordova-plugin-admob/tree/main/example
cd root project/
1. Add Capacitor to Project: Run the following command inside the project folder
Notes:
2. Add Platform Capacitor: For example, add an Android platform:
3. Run the sync to ensure Capacitor recognizes the www folder from Cordova:
4. Add Cordova Plugin to Capacitor
Capacitor supports integration with Cordova plugins. Existing Cordova plugins can be used in conjunction with Capacitor.
Installation
5. To change the admob-app-id automatically you can change it in capacitor.config.json
npm run update-admob will also add this automatically to "ios/App/App/Info.plist"
SKAdNetworkItems: https://developers.google.com/admob/ios/3p-skadnetworks
GADDelayAppMeasurementInit
NSUserTrackingUsageDescription
Run the Hook script
Or Automatically update the AdMob id while building (npm run build)
Modify the following line in package.json
"build": "cross-env NODE_ENV=production vite build" to "build": "npm run update-admob && cross-env NODE_ENV=production vite build"
Add the following line in package.json
"update-admob": "node node_modules/emi-indo-cordova-plugin-admob/capacitor-hook-admob-ids.js",
it would look something like this
6. Plugin Synchronization: Run the following command to synchronize the Cordova plugin to the Capacitor project:
7. Run Capacitor Project:
Note
Warning
capacitor.config.json
package.json
Version locking the plugin during production is highly recommended.
Optional advanced
https://www.npmjs.com/package/capacitor-hook-admob-ids
Regular maintenance support
💰Sponsor this project
Beta Was this translation helpful? Give feedback.
All reactions