簡體   English   中英

使用WL.Client.reloadApp重新加載應用程序時,是否會調用wlcommoninit

[英]Does wlcommoninit get called when the app is reloaded using WL.Client.reloadApp

使用WL.Client.reloadApp重新加載應用程序時,wlcommoninit是否會被調用?

我在混合應用程序中具有用戶注銷功能。 注銷后,將調用WL.Client的reloadApp()方法。 似乎在重新加載后wlcommoninit沒有被調用。 如果我殺死應用程序並重新啟動它,它確實會被調用。

我們正在使用的MobileFirst版本是7.1。 補充:日志中存在Cordova.js錯誤,這可能導致注銷+ reloadApp后無法調用wlCommonInit():

12-28 16:52:18.354:I / chromium(9539):[INFO:CONSOLE(309)]“成功回調ID:App414539960中的錯誤:錯誤:未知事件操作未定義”,來源:file:/// android_asset / www /default/worklight/cordova.js(309)

12-28 16:52:18.354:I / chromium(9539):[INFO:CONSOLE(1576)]“未捕獲(承諾)錯誤:未知事件操作未定義”,來源:file:/// android_asset / www / default /worklight/cordova.js(1576)

您沒有提到您使用的是哪個版本的MobileFirst Platform Foundation(或Worklight),但是在這種情況下,我不確定它實際上是否重要。

我剛剛在7.1上進行了測試,並確認當您使用WL.Client.reloadApp()重新加載應用程序時,實際上已調用wlCommonInit()。

我通過獲取示例“ Hello MobileFirst”應用程序(創建新的MobileFirst Platform混合應用程序時自動創建的模板)來完成此任務,並將其添加到index.html文件中:

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

然后將其添加到wlCommonInit()中:

alert("init");

該警報在應用程序首次初始化時顯示,並且在您單擊應用程序中的“單擊我”鏈接時也顯示,確認在這種情況下正在調用wlCommonInit()。

我沒有在任何實際的設備上嘗試過此操作,但在Common Resources和Android環境中的預覽版中進行了嘗試,並在Desktop Browser環境中進行了嘗試,在所有三個地方都得到了相同的結果。

如果您可以編輯問題以提供更多信息(例如,可能指向實際MFP項目的鏈接,和/或所觀察到的內容使您相信未調用wlCommonInit()),則更有用可以提供答案。 但是,就您所詢問的特定問題而言,是的,當您調用WL.Client.reloadApp()時,肯定會調用wlCommonInit()。

我也有同樣的問題,但是我認為這是我的錯。 我的android / res / xml / config.xml文件已通過遷移腳本成功遷移,以包括最新的必需的MobileFirst插件,但是我將其從源存儲庫中排除,因此我沒有簽入最新版本,並且仍在使用我的應用中的舊版本。 一旦我手動復制了正確遷移的config.xml,一切都將正常運行。

您可以驗證config.xml是否包含所有必需的Android MobileFirst插件。 這是適合我的示例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>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM