【发布时间】:2019-11-19 10:45:33
【问题描述】:
谁能帮我解决我的 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 测试应用程序。
非常感谢。
【问题讨论】:
-
当我直接通过 Firebase Cloud 测试应用程序时,它会收到推送通知。它只是没有使用我自己的有效负载发送者代码(使用您在上面看到的有效负载)接收它。
标签: ios push-notification phonegap-build phonegap