Tauri Mobile and AdMob
Tauri Mobile and AdMob
From Tauri 2, Android and iOS became first-class citizens. Mobile apps have different distribution and monetization models from desktop.
1. About Tauri Mobile
Tauri 2.0 (2024-10) officially supports Android and iOS. Mobile targets are added on top of the same codebase as desktop builds.
- Android — System WebView as host, Rust connected to Java/Kotlin via JNI (
jni-rs). - iOS — WKWebView as host, Rust connected to Objective-C/Swift.
Like desktop, tauri::command works as is. Mobile-only features (permissions, lifecycle, push) are separate plugins, however.
2. Prerequisites
Android (common):
- Android Studio (or cmdline-tools).
- Android SDK (API 24+ is Tauri 2's minSdk).
- Android NDK (Rust cross-compilation).
- JDK 17+.
iOS (macOS only):
- Xcode and Command Line Tools.
- Apple Developer account (for distribution).
After installation, pnpm tauri android init / pnpm tauri ios init generates the native project.
3. Android build flow
pnpm tauri android dev # dev on a device/emulator
pnpm tauri android build # APK + AAB
pnpm tauri android build --apk # APK only
pnpm tauri android build --aab # AAB only
Output: src-tauri/gen/android/app/build/outputs/{apk,bundle}/release/.
APK vs AAB:
- APK — Single install file. Often used for sideload and internal distribution.
- AAB (Android App Bundle) — Google Play standard. Play generates per-device optimized APKs. Required for new apps from August 2021.
4. Signing
Play distribution requires signing. A keystore file (.jks, .keystore) + alias + password.
# src-tauri/gen/android/keystore.properties
storeFile=../my-release.jks
storePassword=...
keyAlias=upload
keyPassword=...
Enabling Play App Signing in the Play Console separates the upload key from the app signing key. Recovery is possible if the upload key is lost, so it is recommended.
5. About AdMob
AdMob is a mobile app ad network. Founder Omar Hamoui started it in 2006, Google acquired it in 2009, and it was officially merged in 2010. It now handles mobile ads on the same infrastructure as Google AdSense / Google Ads.
Ad formats:
| Format | Description |
|---|---|
| Banner | A fixed strip ad at the top or bottom of the screen. The simplest. |
| Interstitial | A full-screen ad. Shown at natural transition moments. |
| Rewarded | Reward type. The user voluntarily watches and receives a reward (coins, feature unlocks). |
| Rewarded Interstitial | Between Rewarded and Interstitial. |
| Native | Custom render to fit the app UI. |
| App Open | A full-screen ad shown when the app opens. |
Each format has its own ad unit ID.
6. Integrating AdMob
Native SDK (Google Mobile Ads SDK):
- Android:
com.google.android.gms:play-services-ads - iOS:
GoogleMobileAds(CocoaPods/SPM)
To call this SDK from Tauri, two paths exist.
① Official/community plugin
Adopt a wrapper like tauri-plugin-admob if available
→ check availability and maintenance status
② Write your own plugin
Use the tauri-plugin template to write Android (Kotlin/Java) + iOS (Swift)
→ expose to Rust bridge
→ workload exists but control is clear
Calling the ad SDK directly inside the WebView is close to a policy violation (Google does not recommend it). Native SDK invocation is the standard.
During development, you must use test ad unit IDs. Clicking or showing your own ads with real IDs is grounds for account suspension. Google publishes official test IDs in its docs.
7. iOS ad tracking — ATT
From iOS 14.5 (2021-04), App Tracking Transparency (ATT) applies. To track a user across other companies' apps and websites, explicit permission must be obtained through a system dialog.
Impact:
- When the deny rate is high, IDFA (advertising identifier) becomes unusable.
- Ad effectiveness measurement (conversion tracking) weakens → reinforced by aggregate models like SKAdNetwork.
NSUserTrackingUsageDescriptionstring is required inInfo.plist.
<key>NSUserTrackingUsageDescription</key>
<string>광고 개인화에 사용됩니다.</string>
import AppTrackingTransparency
ATTrackingManager.requestTrackingAuthorization { status in /* ... */ }
Android moved in a similar direction. Privacy Sandbox for Android is the work of gradually replacing the ad ID and tracking.
8. Getting started with Tauri Mobile
# Android
pnpm tauri android init
pnpm tauri android dev
# iOS (macOS)
pnpm tauri ios init
pnpm tauri ios dev
Calling ads from a Tauri command:
#[tauri::command]
async fn show_rewarded(app: tauri::AppHandle) -> Result<bool, String> {
// call SDK via plugin or custom JNI/objc code
// Android: GMS Ads -> RewardedAd.load -> show
// iOS: GADRewardedAd -> load -> present
Ok(true)
}
9. Policy checklist
- User consent (EU GDPR, UMP SDK).
- Family policies (under 13 has separate rules).
- No click incitement (self-clicks, reward bait).
10. Common pitfalls
Ads not showing on the emulator — check ad ID, SDK initialization, internet permission, and test device registration all at once. AdMob can return "no fill" frequently.
Missing INTERNET permission — declare it in AndroidManifest. Network security policy (networkSecurityConfig) might also block ad domains.
iOS Privacy Manifest (2024+) — without the PrivacyInfo.xcprivacy Apple requires, review is rejected. The AdMob SDK provides some automatically, but there are items the app side must write separately.
Forgetting test IDs at release — separating IDs per environment before release (such as splitting debug and release strings.xml) is safe.
Tauri plugin absence — ad SDK APIs change with every major update. A community plugin may not keep up with the latest SDK.
ATT dialog cannot be re-requested — once denied, the same dialog does not reappear. Guide the user into Settings → App → Tracking instead.
Closing thoughts
Monetization for mobile apps is simplest with ads. Missing the policies (test IDs, ATT, Privacy Manifest) leads to account suspension or review rejection, however. The balance among user consent, UX, and ad frequency is the central operational decision.
Next
- sqlite-local
- ocr-stt-tts
We refer to Tauri 2 docs, Tauri Mobile blog, Google AdMob, GMS SDK Android, GMS SDK iOS, Apple ATT, Apple Privacy Manifest, Privacy Sandbox for Android, and Android App Bundle.