当使用WL.Client.reloadApp重新加载应用程序时,是否调用wlcommoninit



当使用WL.Client.reloadApp重新加载应用程序时,是否调用wlcommoninit??

我在一个混合应用程序中有一个用户注销功能。注销后,会调用WL.Client的reloadApp()方法。似乎在重新加载wlcommoninit后没有被调用。如果我杀死应用程序并重新启动它,它确实会被调用。

我们正在使用的MobileFirst版本是7.1。已添加:日志中存在Cordova.js错误,这可能会阻止wlCommonInit()在注销+重新加载App:后被调用

12-28 16:52:18.354:I/chromium(9539):[信息:控制台(309)]"错误成功回调Id:App414539960:错误:未知事件操作未定义",来源:file:///android_asset/www/default/worklight/cordova.js(309)

12-28 16:52:18.354:I/chromium(9539):[信息:控制台(1576)]"未捕获(承诺中)错误:未知事件操作未定义",来源:file:///android_asset/www/default/worklight/cordova.js(1576)

您没有提到您正在使用的MobileFirst Platform Foundation(或Worklight)的版本,但我不确定在这种情况下它是否真的重要。

我刚刚在7.1上进行了测试,并确认当您使用WL.Client.reloadApp().重新加载应用程序时,实际上调用了wlCommonInit()

我通过使用示例"Hello MobileFirst"应用程序(创建新的MobileFirst平台混合应用程序时自动创建的模板),将其添加到index.html文件中:

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

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

alert("init");

该警报在应用程序首次初始化时显示,当您单击应用程序中的"单击我"链接时也会显示,确认在这种情况下正在调用wlCommonInit()。

我没有在任何实际的设备上尝试过,但我在公共资源和Android环境的预览中尝试过,也在桌面浏览器环境中尝试过它,在这三个地方都得到了相同的结果。

如果您可以编辑您的问题以提供更多信息(例如,可能是您实际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>

最新更新