Store Close Handling
Handle the store close event in Unity, iOS, Android, React Native, and Flutter
Store Close Handling
When the user taps Continue Playing inside the store, the WebView fires a close action. How you handle it depends on your platform.
Unity (PlaySuper SDK)
The SDK handles dismissal automatically. Subscribe to the event to run your own logic (e.g. resume gameplay):
PlaySuperUnitySDK.OnStoreClosed += HandleStoreClosed;
void HandleStoreClosed()
{
Debug.Log("Store closed — resuming game");
}
PlaySuperUnitySDK.Instance.OpenStore();Native WebView (non-Unity apps)
If you load the store in your own WebView, intercept the close URL scheme USER_CUSTOM_SCHEME://close and dismiss the WebView.
On iOS, WebKit may emit the scheme as USER_CUSTOM_SCHEME:/close (single slash) or append it to the current URL. Always check for both patterns.
iOS (Swift)
import WebKit
class StoreWebViewController: UIViewController, WKNavigationDelegate {
var webView: WKWebView!
override func viewDidLoad() {
super.viewDidLoad()
webView = WKWebView(frame: view.bounds)
webView.navigationDelegate = self
view.addSubview(webView)
if let url = URL(string: "https://store.playsuper.club/...") {
webView.load(URLRequest(url: url))
}
}
func webView(_ webView: WKWebView,
decidePolicyFor navigationAction: WKNavigationAction,
decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) {
if let url = navigationAction.request.url?.absoluteString,
url.contains("USER_CUSTOM_SCHEME://close") || url.contains("USER_CUSTOM_SCHEME:/close") {
decisionHandler(.cancel)
dismiss(animated: true)
return
}
decisionHandler(.allow)
}
}iOS (Objective-C)
- (void)webView:(WKWebView *)webView
decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction
decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler {
NSString *urlString = navigationAction.request.URL.absoluteString;
if ([urlString containsString:@"USER_CUSTOM_SCHEME://close"] ||
[urlString containsString:@"USER_CUSTOM_SCHEME:/close"]) {
decisionHandler(WKNavigationActionPolicyCancel);
[self dismissViewControllerAnimated:YES completion:nil];
return;
}
decisionHandler(WKNavigationActionPolicyAllow);
}Android (Kotlin)
webView.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
if (url?.contains("USER_CUSTOM_SCHEME://close") == true ||
url?.contains("USER_CUSTOM_SCHEME:/close") == true) {
finish()
return true
}
return false
}
}Android (Java)
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
if (url.contains("USER_CUSTOM_SCHEME://close") ||
url.contains("USER_CUSTOM_SCHEME:/close")) {
finish();
return true;
}
return false;
}
});React Native
import { WebView } from 'react-native-webview';
<WebView
source={{ uri: 'https://store.playsuper.club/...' }}
onNavigationStateChange={({ url }) => {
if (
url.includes('USER_CUSTOM_SCHEME://close') ||
url.includes('USER_CUSTOM_SCHEME:/close')
) {
onClose();
}
}}
/>;Flutter
WebViewController()
..setNavigationDelegate(
NavigationDelegate(
onNavigationRequest: (request) {
if (request.url.contains('USER_CUSTOM_SCHEME://close') ||
request.url.contains('USER_CUSTOM_SCHEME:/close')) {
onClose();
return NavigationDecision.prevent;
}
return NavigationDecision.navigate;
},
),
)
..loadRequest(Uri.parse('https://store.playsuper.club/...'));WebView requirements
Your WebView must have JavaScript and DOM Storage enabled for the store to function correctly.
Next, learn how to display reward widgets and product collections in Touchpoints & Curated Lists.