我按照這裏的指示點。 (https://documentation.onesignal.com/v3.0/docs/phonegap-sdk-setup)沒有任何插件可以在Cordova/PhoneGap Android混合移動應用程序中加載。怎麼解決?
我的目標是將推送通知從服務器(Firebase或OneSignal)發送到我在Android設備上進行測試的Chrome瀏覽器或PhoneGap測試應用程序。
我已將下面的代碼添加到我的onDeviceReady
函數中並且它運行;
console.log("OneSignal is here!");
var notificationOpenedCallback = function(jsonData) {
console.log('notificationOpenedCallback: ' + JSON.stringify(jsonData));
alert("Received my notification");
};
// c02be63f-e777-4b99-8775-dec62efxxxxx is my APP ID
window.plugins.OneSignal
.startInit("c02be63f-e777-4b99-8775-dec62efxxxxx")
.handleNotificationOpened(notificationOpenedCallback)
.endInit();
window.plugins.OneSignal.setSubscription (true);
window.plugins.OneSignal.enableNotificationWhenActive(true);
但是,運行後,我得到以下錯誤。有人可以解釋這個錯誤的含義嗎?
Error: exec proxy not found for :: StatusBar :: _ready
(index):365 OneSignal is here!
(index):365 Error: exec proxy not found for :: OneSignalPush :: setNotificationReceivedHandler
(index):365 Error: exec proxy not found for :: OneSignalPush :: setNotificationOpenedHandler
(index):365 Error: exec proxy not found for :: OneSignalPush :: init
(index):365 Error: exec proxy not found for :: OneSignalPush :: setSubscription
我注意到我試過的每個其他新插件都有同樣的錯誤。這意味着有些事情是錯的。
這是我3210
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.upen.testing" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:gap="http://phonegap.com/ns/1.0">
<name>Testing</name>
<description>
A blank PhoneGap app.
</description>
<author email="[email protected]" href="http://phonegap.com">
PhoneGap Team
</author>
<content src="index.html" />
<access origin="*" />
<gap:plugin name="onesignal-cordova-plugin" source="npm" spec="^2.2.4" />
<preference name="phonegap-version" value="cli-7.1.1" />
<preference name="android-build-tool" value="gradle" />
<preference name="android-minSdkVersion" value="15" />
<engine name="browser" spec="~5.0.1" />
<plugin name="cordova-plugin-whitelist" spec="~1.3.3" />
<plugin name="onesignal-cordova-plugin" spec="~2.2.4" />
<plugin name="cordova-plugin-statusbar" spec="~2.3.0" />
<plugin name="cordova-plugin-fcm" spec="^2.1.2" />
<engine name="android" spec="~6.3.0" />
</widget>
看到我的[回覆](https://stackoverflow.com/questions/39066959/check-internet-connection-in-android-webview-cordova/39211383#39211383)快速指南科爾多瓦安裝。 –
我已經安裝了Cordova/PhoneGap/Node.js - 一切正常。除了在測試項目中加載的插件得到這個exec ...錯誤。 – Zac
我認爲問題出在 。嘗試下載並使用 –