Embed the AdVanta Offerwall into native Android, iOS, Flutter, and React Native mobile applications with full external intent and Google Play Store link handling.
market:// and intent://) rather than attempting to render them internally.
Configure your WebView with DOM storage enabled and intercept store intents in WebViewClient:
import android.content.Intent
import android.net.Uri
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.appcompat.app.AppCompatActivity
class OfferwallActivity : AppCompatActivity() {
private lateinit var webView: WebView
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_offerwall)
webView = findViewById(R.id.offerwall_webview)
setupWebView()
val apiKey = "YOUR_API_KEY"
val userId = "USER_12345"
val wallUrl = "https://advanta-new.winwallgame.com/wall?apiKey=$apiKey&userId=$userId&device=android"
webView.loadUrl(wallUrl)
}
private fun setupWebView() {
val settings: WebSettings = webView.settings
settings.javaScriptEnabled = true
settings.domStorageEnabled = true
settings.loadWithOverviewMode = true
settings.useWideViewPort = true
webView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
if (url == null) return false
// Intercept Google Play Store and custom intent URLs
if (url.startsWith("market://") ||
url.startsWith("intent://") ||
url.contains("play.google.com/store/apps/details")) {
try {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
startActivity(intent)
return true
} catch (e: Exception) {
e.printStackTrace()
}
}
return false
}
}
}
override fun onBackPressed() {
if (webView.canGoBack()) {
webView.goBack()
} else {
super.onBackPressed()
}
}
}
Using WebKit and WKNavigationDelegate to handle App Store redirects:
import UIKit
import WebKit
class OfferwallViewController: UIViewController, WKNavigationDelegate {
var webView: WKWebView!
override fun viewDidLoad() {
super.viewDidLoad()
let config = WKWebViewConfiguration()
config.allowsInlineMediaPlayback = true
webView = WKWebView(frame: view.bounds, configuration: config)
webView.navigationDelegate = self
view.addSubview(webView)
let apiKey = "YOUR_API_KEY"
let userId = "USER_12345"
if let url = URL(string: "https://advanta-new.winwallgame.com/wall?apiKey=\(apiKey)&userId=\(userId)&device=ios") {
webView.load(URLRequest(url: url))
}
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
guard let url = navigationAction.request.url else {
decisionHandler(.allow)
return
}
// Open App Store links in native store
if url.scheme == "itms-apps" || url.host?.contains("apps.apple.com") == true {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
decisionHandler(.cancel)
return
}
decisionHandler(.allow)
}
}
import 'package:flutter/material.dart';
import 'package:webview_flutter/webview_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
class OfferwallScreen extends StatefulWidget {
final String userId;
const OfferwallScreen({required this.userId, Key? key}) : super(key: key);
@override
_OfferwallScreenState createState() => _OfferwallScreenState();
}
class _OfferwallScreenState extends State {
late final WebViewController _controller;
@override
void initState() {
super.initState();
final url = "https://advanta-new.winwallgame.com/wall?apiKey=YOUR_API_KEY&userId=${widget.userId}";
_controller = WebViewController()
..setJavaScriptMode(JavaScriptMode.unrestricted)
..setNavigationDelegate(NavigationDelegate(
onNavigationRequest: (NavigationRequest request) async {
if (request.url.startsWith("market://") ||
request.url.startsWith("intent://") ||
request.url.contains("play.google.com") ||
request.url.contains("apps.apple.com")) {
final uri = Uri.parse(request.url);
if (await canLaunchUrl(uri)) {
await launchUrl(uri, mode: LaunchMode.externalApplication);
}
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
))
..loadRequest(Uri.parse(url));
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Rewards Wall")),
body: WebViewWidget(controller: _controller),
);
}
}