2015-12-28 41 views
2

是否當應用程序使用WL.Client.reloadApp重載wlcommoninit被調用重載wlcommoninit被調用?是否當應用程序使用WL.Client.reloadApp

我在混合應用程序中有一個用戶註銷功能。註銷後,有一個對WL.Client的reloadApp()方法的調用。重新加載後,似乎沒有調用wlcommoninit。如果我殺了應用並重新啓動它,它確實會被調用。

我們正在使用的版本MobileFirst爲7.1。 補充: 中有可能會阻止從wlCommonInit()日誌一Cordova.js錯誤註銷+ reloadApp後被稱爲:

12-28 16:52:18.354: I/chromium(9539): [INFO:CONSOLE(309)] "Error in Success callbackId: App414539960 : Error: Unknown event action undefined", source: file:///android_asset/www/default/worklight/cordova.js (309)

12-28 16:52:18.354: I/chromium(9539): [INFO:CONSOLE(1576)] "Uncaught (in promise) Error: Unknown event action undefined", source: file:///android_asset/www/default/worklight/cordova.js (1576)

回答

0

你不提MobileFirst平臺基礎是什麼版本(或Worklight),但我不確定它在這種情況下真正重要。

我只是測試了7.1,並證實wlCommonInit()其實是在當你重新裝入WL.Client.reloadApp的應用程序稱爲()。

我通過採取樣本「你好MobileFirst」應用程序(當你創建一個新的MobileFirst平臺的混合應用程序自動創建模板),加入這index.html文件這樣做:

<a onClick="WL.Client.reloadApp();">Click Me</a> 

然後加入這裏面wlCommonInit():

alert("init"); 

當應用程序首先初始化顯示警報,當你點擊應用中的「點擊我」鏈接也顯示,確認wlCommonInit()是是在這種情況下稱爲。

我沒有嘗試這種在任何實際的設備,但我想它在預覽公共資源和Android的環境,同時也試圖在桌面瀏覽器的環境中,並得到了相同的結果在所有的三個地方。

如果您可以編輯您的問題以提供更多信息(例如,可能指向您的實際MFP項目的鏈接,和/或您觀察到的導致您相信wlCommonInit()未被調用的情況) ,可以提供更有用的答案。但是,就你提出的具體問題而言 - 是的,當你調用WL.Client.reloadApp()時,wlCommonInit()肯定會被調用。

+1

嗨,帕特,謝謝你澄清。我們已經提出了PMR(26237,756,000)和更多的信息。似乎有一個Cordova.js錯誤,阻止wlCommonInit()被調用。 –

0

我對我身邊的同樣的問題,但我覺得這是我的錯。我的android/res/xml/config.xml文件已被遷移腳本成功遷移,以包含最新的必需MobileFirst插件,但是我已將其從我的源代碼庫中排除,因此我沒有簽入最新版本並仍在使用舊版本在我的應用程序。一旦我手動複製正確遷移的config.xml,一切正常。

您可以驗證您的config.xml中包含了所有必需的MobileFirst插件的Android。這是我的示例config.xml,適用於我。

<?xml version="1.0" encoding="UTF-8" standalone="no"?> 
<!-- 
Licensed to the Apache Software Foundation (ASF) under one 
or more contributor license agreements. See the NOTICE file 
distributed with this work for additional information 
regarding copyright ownership. The ASF licenses this file 
to you under the Apache License, Version 2.0 (the 
"License"); you may not use this file except in compliance 
with the License. You may obtain a copy of the License at 

http://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, 
software distributed under the License is distributed on an 
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express or implied. See the License for the 
specific language governing permissions and limitations 
under the License. 
--><widget xmlns="http://www.w3.org/ns/widgets" id="PluginDevelopment" version="1.0.0.0"> 
    <name>PluginDevelopment</name> 

    <description> 
     PluginDevelopment 
    </description> 

    <author email="application author's e-mail" href="http://mycompany.com"> 
     application's author 
    </author> 

    <access origin="*"/> 
    <preference name="loglevel" value="DEBUG"/> 
    <!-- 
     <preference name="splashscreen" value="resourceName" /> 
     <preference name="backgroundColor" value="0xFFF" /> 
     <preference name="loadUrlTimeoutValue" value="20000" /> 
     <preference name="InAppBrowserStorageEnabled" value="true" /> 
     <preference name="disallowOverscroll" value="true" /> 
    --> 
    <!-- This is required for native Android hooks --> 
    <feature name="App"> 
     <param name="android-package" value="org.apache.cordova.App"/> 
    </feature> 
    <feature name="Device"> 
     <param name="android-package" value="org.apache.cordova.device.Device"/> 
    </feature> 
    <feature name="Accelerometer"> 
     <param name="android-package" value="org.apache.cordova.devicemotion.AccelListener"/> 
    </feature> 
    <feature name="Compass"> 
     <param name="android-package" value="org.apache.cordova.deviceorientation.CompassListener"/> 
    </feature> 
    <feature name="Media"> 
     <param name="android-package" value="org.apache.cordova.media.AudioHandler"/> 
    </feature>   
    <feature name="Camera"> 
     <param name="android-package" value="org.apache.cordova.camera.CameraLauncher"/> 
    </feature> 
    <feature name="Contacts"> 
     <param name="android-package" value="org.apache.cordova.contacts.ContactManager"/> 
    </feature> 
    <feature name="File"> 
     <param name="android-package" value="org.apache.cordova.file.FileUtils"/> 
    </feature> 
    <feature name="Notification"> 
     <param name="android-package" value="org.apache.cordova.dialogs.Notification"/> 
    </feature>  
    <feature name="FileTransfer"> 
     <param name="android-package" value="org.apache.cordova.filetransfer.FileTransfer"/> 
    </feature> 
    <feature name="Capture"> 
     <param name="android-package" value="org.apache.cordova.mediacapture.Capture"/> 
    </feature> 
    <feature name="Battery"> 
     <param name="android-package" value="org.apache.cordova.batterystatus.BatteryListener"/> 
    </feature> 
    <feature name="SplashScreen"> 
     <param name="android-package" value="org.apache.cordova.splashscreen.SplashScreen"/> 
    </feature> 
    <feature name="Globalization"> 
     <param name="android-package" value="org.apache.cordova.globalization.Globalization"/> 
    </feature> 
    <feature name="InAppBrowser"> 
     <param name="android-package" value="org.apache.cordova.inappbrowser.InAppBrowser"/> 
    </feature>  
    <feature name="Vibration"> 
     <param name="android-package" value="org.apache.cordova.vibration.Vibration"/> 
    </feature> 

<feature name="WLInitializationPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLInitializationPlugin"/> 
     <param name="onload" value="true"/> 
    </feature> 
    <feature name="UserAuth"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.UserAuthPlugin"/> 
     <param name="onload" value="false"/> 
    </feature> 
    <feature name="LoggerPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.LoggerPlugin"/> 
    </feature> 
    <feature name="WLApp"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLApp"/> 
    </feature> 
    <feature name="NativePage"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.NativePage"/> 
    </feature> 
    <feature name="NativeBusyIndicator"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.BusyIndicator"/> 
    </feature> 
    <feature name="SecurityPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.SecurityPlugin"/> 
    </feature> 
    <feature name="StoragePlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.StoragePlugin"/> 
    </feature> 
    <feature name="Push"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.Push"/> 
    </feature> 
    <feature name="WebResourcesDownloader"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WebResourcesDownloaderPlugin"/> 
    </feature> 
    <feature name="WLDirectUpdatePlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLDirectUpdatePlugin"/> 
    </feature> 
    <feature name="NetworkDetector"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.NetworkDetector"/> 
    </feature> 
    <feature name="DeviceAuth"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.DeviceAuthPlugin"/> 
    </feature> 
    <feature name="WifiPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WifiPlugin"/> 
    </feature> 
    <feature name="WLGeolocationPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLGeolocationPlugin"/> 
    </feature> 
    <feature name="ForegroundBinderPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.ForegroundBinderPlugin"/> 
    </feature> 
    <feature name="FIPSHttpPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.FIPSHttpPlugin"/> 
    </feature> 
    <feature name="WLCustomDialog"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLCustomDialog"/> 
    </feature> 
    <feature name="NetworkStatus"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLNetworkManager"/> 
    </feature> 
    <feature name="WLSplashScreen"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLSplashScreenPlugin"/> 
    </feature> 
    <feature name="WLNativeXHRPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLNativeXHRPlugin"/> 
    </feature> 
    <feature name="WLActionSenderPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLActionSenderPlugin"/> 
    </feature> 
    <feature name="StatusBar"> 
     <param name="android-package" value="org.apache.cordova.statusbar.StatusBar"/> 
    </feature> 
    <feature name="WLAuthorizationManagerPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLAuthorizationManagerPlugin"/> 
    </feature> 
    <feature name="WLCertificatePinningPlugin"> 
     <param name="android-package" value="com.worklight.androidgap.plugin.WLCertificatePinningPlugin"/> 
    </feature 
</widget> 
+0

我還注意到通過進一步測試,如果您的應用未部署到MobileFirst Development Server進行測試,則會出現此錯誤。確保你也部署了你的應用程序。我們曾經爲這種情況獲得了更好的錯誤消息,但也很好解決這個問題。 –

相關問題