跳至内容
WebViewGold 从 Vibe Coding 到 App Store
中文
获取 WebViewGold

Google AI Studio + 推送通知

为您的 Google AI Studio 应用添加推送通知

浏览器 Web 推送在 iOS 上只对添加到主屏幕的 Web 应用有效,大多数用户根本看不到。作为用 WebViewGold 构建的原生应用,您的 Google AI Studio 应用获得的是真正的推送:iOS 和 Android 上的系统推送通知,可从您的后端、从控制台发送,或由您自己的 JavaScript 定时触发。

每个平台一次性 $109 起,或由我们的团队全程代劳,$698 起。

  • 审核通过保证 – 否则 14 天内退款
  • 无需编程
  • 一次性付费,免费更新
  • 7×24 小时人工支持
  • 2014 年起德国出品 · ISO 27001

通知用户的三种方式

远程推送(OneSignal、Pushwoosh 或 Firebase)

从控制台发送推送活动,或通过它们的 REST API 从 Cloud Run 服务,在服务器端调用 Gemini 触发消息。细分用户、定时发送、跟踪打开情况。WebViewGold 内置这些集成;您只需把应用 ID 粘贴到 Config.swift 和 Config.java(或 Cloud Builder)中。

来自 JavaScript 的本地推送

只需一次 URL 调用,就能从您的 Google AI Studio 应用定时发送通知,例如两小时后的提醒或购物车挽回消息。即使应用已关闭也会触发。无需任何推送服务。

在合适的时机请求权限

通过链接(registerpush://)在用户有理由同意的时候触发系统权限弹窗,而不是在首次启动时;并通过 checkNativePushPermissions://(JavaScript 变量 nativePushEnabled)读取权限状态。

给 Google AI Studio 的提示词

把这段粘贴到 Google AI Studio 中以实现 Web 应用端。检查结果,发布,然后在 WebViewGold 应用中测试。

粘贴到 AI Studio 的提示词
Add native push notifications for the WebViewGold app wrapper around this Gemini app. In the React front end, add a Notification settings page with an Enable notifications button that navigates to registerpush:// only when navigator.userAgent contains my custom WebViewGold token; otherwise show a hint that notifications are available in the app. After login, read the global onesignalplayerid variable (set window.location.href to getonesignalplayerid:// once if it is undefined) and POST it to /api/push/register on the Cloud Run server, which stores it in Firestore under the user. Add a server function sendPush(uid, title, message, url) that calls the OneSignal REST API with the ONESIGNAL_REST_API_KEY secret. Retry the register call once on a cold start.

把 Web 应用转换成原生应用的绝佳方式!周转速度快,无需开发完整的原生应用就能把应用上架到应用商店!

Kevin Joling · FlightConnections & TrainConnections · Trustpilot

为 Google AI Studio 应用设置推送

两个平台合计约 20 分钟。

  1. 创建一个免费的 OneSignal(或 Pushwoosh)应用

    添加一个使用您 Apple 推送密钥(来自 Apple Developer 门户的 .p8 文件)的 iOS 应用,以及一个使用您 Firebase Cloud Messaging 凭据的 Android 应用。两个控制台都会引导您完成。

  2. 把 ID 粘贴到 WebViewGold 中

    在 Config.swift 和 Config.java(或 Cloud Builder 表单)中启用推送选项并填入您的 OneSignal App ID。决定是在首次启动时请求权限,还是稍后通过 registerpush:// 请求。

  3. 从您的 Google AI Studio 应用识别用户

    WebViewGold 会把推送订阅 ID 作为 JavaScript 变量暴露给您的 Web 应用(调用 getonesignalplayerid:// 后的 onesignalplayerid),或以 ?onesignal_push_id=… 的形式附加到您的 URL 上。把它与用户一起存储在 Cloud Run 服务,在服务器端调用 Gemini 中,这样您的后端就能定向推送给单个用户。

  4. 从您的后端发送

    每当有事件发生时(新消息、订单更新、提醒),从 Cloud Run 服务,在服务器端调用 Gemini 调用 OneSignal REST API。或者从控制台手动发送推送活动。

  5. 为通知添加深度链接

    为每条推送附加一个 url 字段;用户点击通知时,WebViewGold 会在应用内打开该页面。

本地推送:JavaScript 调用

无需推送服务。从您的 Google AI Studio 应用定时发送一条即使应用关闭后也会触发的通知:

javascript
var title = "Your session starts soon";
var message = "Tap to open your dashboard.";
var seconds = 7200;                        // fire in two hours
var url = "https://yourapp.com/dashboard"; // opened when tapped
window.location.href = "sendlocalpushmsg://push.send?s=" + seconds + "=msg!" + message + "&!#" + title + "&!#" + url;

// cancel everything that is scheduled
// window.location.href = "sendlocalpushmsg://push.send.cancel";

要告诉 Google AI Studio 的事

  • 添加一个通知设置页面,带有“启用通知”按钮,且仅在应用内导航到 registerpush://(WebViewGold 通过您在配置中定义的自定义 User-Agent 来标识自己)。
  • 读取 WebViewGold 提供的推送订阅 ID,并保存到 Cloud Run 服务,在服务器端调用 Gemini 中的用户资料上。
  • 创建一个后端函数,在事件发生时使用用户的订阅 ID 调用 OneSignal REST API。
  • 给通知 URL 添加 ?utm_source=push 参数,以便您的分析工具能归因打开来源。

常见问题

来自 Google AI Studio 的 Web 推送在应用内能用吗?

浏览器 Web 推送(基于 Service Worker)并不是商店和用户对应用的期望。WebViewGold 使用原生的 APNs 和 FCM 通知,它们会出现在系统通知中心,支持角标和声音,并且在每一台 iPhone 上都能工作。

OneSignal 是免费的吗?

OneSignal 有免费套餐,足以覆盖大多数新应用;Pushwoosh 为 WebViewGold 客户提供两个月免费。本地推送通知是免费的,完全不需要任何服务。

推送通知对 App Store 审核有帮助吗?

有。准则 4.2 要求提供超出网站的功能;原生推送通知是一项具体的、用户可感知的原生功能。

我能给某个特定用户发送推送吗?

可以。把 WebViewGold 暴露的订阅 ID 映射到 Cloud Run 服务,在服务器端调用 Gemini 中的用户记录,然后通过 OneSignal API 定向到该 ID。

让您的应用上架商店的三种方式

结果相同,只是您需要投入的工作量不同。三种方式都附带审核通过保证和 7×24 小时人工支持。

自己动手

$109 每个平台,一次性付费

WebViewGold 许可证:一个现成的 Xcode 或 Android Studio 项目。粘贴您的 URL,设置名称和图标,开启所需功能,构建并提交。永久免费更新。

在主页查看方案

Cloud Builder

$349 每个许可证,一次性附加购买

无需 Mac、Xcode 或 Android Studio:在浏览器中完成配置,我们在云端构建两个应用,并将其交付到 App Store Connect 和 Play Console。

Cloud Builder 如何运作 试用免费演示

Full Service

$698 每个平台 $798

把您的 URL 和图标发给我们。我们的团队在 72 小时内完成配置、构建并交付您的应用,白标,附源码项目。两个平台共 $1,158。

Full Service 详情 服务提供方: WeSetupYourWebViewApp

冬季特惠价格有效期至 2026年12月31日。

准备好发布您的 Google AI Studio 应用了吗?

App Store & Google Play 审核通过保证 – 否则 14 天内退款

想直接交给我们?Full Service:我们在 72 小时内完成配置、构建并交付,每个平台 $698 起。有疑问?通过 7×24 小时在线聊天联系我们。

退款依据我们 FAQ 中列出的条件:应用因非内容原因被 Apple 和/或 Google 拒审,并在购买后 14 天内提出申请。