![](/img/trans.png)
[英]Phonegap Build: Notification / Popup not working in android?
[英]Phonegap Build Firebase push notification on IOS not working (but working on Android)
誰能幫我解決我的 Phonegap 混合應用程序的以下問題? 我正在使用 Phonegap Build 來處理數據。
我的 ios 設備沒有收到推送通知,但我的 android 設備可以。 我在 config.xml 中使用以下數據:
...
<preference name="phonegap-version" value="cli-9.0.0" />
<platform name="android">
<resource-file src="google-services.json" target="app/google-services.json" />
</platform>
<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
</platform>
<plugin name="phonegap-plugin-push" spec="2.1.3">
<variable name="SENDER_ID" value="xxxxxxxxxxxxx" />
</plugin>
..
我的有效載荷看起來像這樣......
$data = [
"title" =>$titlenotification,
"message" => $message,
"content_available" => "1",
];
$fields = [
'registration_ids' => $registrationtokens,
'data' => $data,
"priority" => "high",
"content_available" => true,
];
...我在應用程序中的推送初始化看起來像這樣...
var push = PushNotification.init({
android: {
senderID: senderId,
iconColor: "#d4edda",
alert: true,
badge: true,
icon: 'notification_icon',
sound: true,
vibrate: true,
},
browser: {},
ios: {
senderID: senderId,
sound: true,
vibration: true,
badge: true
},
windows: {}
}
);
我正在使用 App Store Production 配置,並且正在通過 Testflight 測試該應用程序。
非常感謝。
答案是確保使用正確的 APN 和配置文件。 APN 中未包含推送通知,並且配置文件必須用於“生產”而不是開發。
我希望這對其他人有所幫助。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.