cordova 6.5 inappbrowser 1.7.0 android无法正常工作,但iOS正常工作

时间:2017-03-17 20:52:32

标签: android cordova inappbrowser

我完全被一个让inappbrowser工作在android上的问题傻眼了。一切都在iOS上完美运行,但android什么都不做。没有空白窗口打开,没有错误消息,没有。任何帮助将不胜感激!

js致电:

document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
  console.log('device ready!');
 window.open = cordova.InAppBrowser.open;
}

var ref = null;
ref = cordova.InAppBrowser.open(oktaURL, '_blank', 'hidden=no,location=yes');
ref.addEventListener('loadstart', function (event) {
    console.log('loadstart');
});
ref.addEventListener('loadstop', function (event) {
    console.log('loadstop');
});
ref.addEventListener('exit', function () {
    console.log('exit ');
});

触发时,没有任何控制台登录事件侦听器。但是,如果我检查ref,它将返回带有正确对象的“InAppBrowser {channels:Object}”并正确引用称为inappbrowser等的函数。

在控制台上执行手册

cordova.exec(null, null, "InAppBrowser", "open", ['http://www.yahoo.com', '_blank', 'location=yes']); 

返回相同的东西,没有错误,但也没有任何窗口。 请注意,当在inappbrowser.js的module.exports中的console.log时,我确实看到源文件本身触发的内容

config.xml中:

<?xml version='1.0' encoding='utf-8'?>
<widget defaultlocale="en-US" id="com.zscaler.apex" version="0.0.34" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0" xmlns:vs="http://schemas.microsoft.com/appx/2014/htmlapps">
  <name>MyApp</name>
  <description>A blank project that uses Apache Cordova to help you build an app that targets multiple mobile platforms: Android, iOS, Windows, and Windows Phone.</description>
  <author email="dev@cordova.apache.org" href="http://cordova.io">Apache Cordova Team</author>
  <content src="index.html"/>
  <access origin="*"/>
  <access launch-external="yes" origin="http://*"/>
  <access launch-external="yes" origin="https://*"/>
  <allow-intent href="*"/>
  <allow-navigation href="*"/>
  <vs:features/>
  <preference name="SplashScreen" value="screen"/>
  <preference name="windows-target-version" value="8.1"/>
  <plugin name="cordova-plugin-whitelist" version="1"/>
  <allow-intent href="http://*/*"/>
  <allow-intent href="https://*/*"/>
  <allow-intent href="tel:*"/>
  <allow-intent href="sms:*"/>
  <allow-intent href="mailto:*"/>
  <allow-intent href="geo:*"/>
  <platform name="android">
    <allow-intent href="market:*"/>
  </platform>
  <platform name="ios">
    <allow-intent href="itms:*"/>
    <allow-intent href="itms-apps:*"/>
  </platform>
  <platform name="android">
    <icon density="ldpi" src="res/icons/android/icon-36-ldpi.png"/>
    <icon density="mdpi" src="res/icons/android/icon-48-mdpi.png"/>
    <icon density="hdpi" src="res/icons/android/icon-72-hdpi.png"/>
    <icon density="xhdpi" src="res/icons/android/icon-96-xhdpi.png"/>
  </platform>
  <platform name="ios">
    <icon height="180" src="res/icons/ios/icon-60-3x.png" width="180"/>
    <icon height="60" src="res/icons/ios/icon-60.png" width="60"/>
    <icon height="120" src="res/icons/ios/icon-60-2x.png" width="120"/>
    <icon height="76" src="res/icons/ios/icon-76.png" width="76"/>
    <icon height="152" src="res/icons/ios/icon-76-2x.png" width="152"/>
    <icon height="40" src="res/icons/ios/icon-40.png" width="40"/>
    <icon height="80" src="res/icons/ios/icon-40-2x.png" width="80"/>
    <icon height="57" src="res/icons/ios/icon-57.png" width="57"/>
    <icon height="114" src="res/icons/ios/icon-57-2x.png" width="114"/>
    <icon height="72" src="res/icons/ios/icon-72.png" width="72"/>
    <icon height="144" src="res/icons/ios/icon-72-2x.png" width="144"/>
    <icon height="29" src="res/icons/ios/icon-small.png" width="29"/>
    <icon height="58" src="res/icons/ios/icon-small-2x.png" width="58"/>
    <icon height="50" src="res/icons/ios/icon-50.png" width="50"/>
    <icon height="100" src="res/icons/ios/icon-50-2x.png" width="100"/>
  </platform>
  <platform name="android">
    <splash density="land-hdpi" src="res/screens/android/screen-hdpi-landscape.png"/>
    <splash density="land-ldpi" src="res/screens/android/screen-ldpi-landscape.png"/>
    <splash density="land-mdpi" src="res/screens/android/screen-mdpi-landscape.png"/>
    <splash density="land-xhdpi" src="res/screens/android/screen-xhdpi-landscape.png"/>
    <splash density="port-hdpi" src="res/screens/android/screen-hdpi-portrait.png"/>
    <splash density="port-ldpi" src="res/screens/android/screen-ldpi-portrait.png"/>
    <splash density="port-mdpi" src="res/screens/android/screen-mdpi-portrait.png"/>
    <splash density="port-xhdpi" src="res/screens/android/screen-xhdpi-portrait.png"/>
  </platform>
  <platform name="ios">
    <splash height="480" src="res/screens/ios/screen-iphone-portrait.png" width="320"/>
    <splash height="960" src="res/screens/ios/screen-iphone-portrait-2x.png" width="640"/>
    <splash height="1024" src="res/screens/ios/screen-ipad-portrait.png" width="768"/>
    <splash height="2048" src="res/screens/ios/screen-ipad-portrait-2x.png" width="1536"/>
    <splash height="768" src="res/screens/ios/screen-ipad-landscape.png" width="1024"/>
    <splash height="1536" src="res/screens/ios/screen-ipad-landscape-2x.png" width="2048"/>
    <splash height="1136" src="res/screens/ios/screen-iphone-568h-2x.png" width="640"/>
    <splash height="1334" src="res/screens/ios/screen-iphone-portrait-667h.png" width="750"/>
    <splash height="2208" src="res/screens/ios/screen-iphone-portrait-736h.png" width="1242"/>
    <splash height="1242" src="res/screens/ios/screen-iphone-landscape-736h.png" width="2208"/>
  </platform>
  <vs:plugin name="cordova-plugin-x-socialsharing" src="https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git" version="5.0.6"/>
  <vs:plugin name="de.appplant.cordova.plugin.email-composer" src="https://github.com/katzer/cordova-plugin-email-composer.git" version="0.8.3dev"/>
  <key>SocialSharingExcludeActivities</key>
  <array>
    <string>com.apple.UIKit.activity.AssignToContact</string>
    <string>com.apple.UIKit.activity.CopyToPasteboard</string>
    <string>com.apple.UIKit.activity.PostToFacebook</string>
    <string>com.apple.UIKit.activity.PostToTwitter</string>
    <string>com.apple.UIKit.activity.PostToFlickr</string>
    <string>com.apple.UIKit.activity.PostToWeibo</string>
    <string>com.apple.UIKit.activity.PostToVimeo</string>
    <string>com.apple.UIKit.activity.TencentWeibo</string>
    <string>com.apple.UIKit.activity.Print</string>
    <string>com.apple.UIKit.activity.CopyToPasteboard</string>
    <string>com.apple.UIKit.activity.AssignToContact</string>
    <string>com.apple.UIKit.activity.SaveToCameraRoll</string>
    <string>com.apple.UIKit.activity.AddToReadingList</string>
  </array>
  <preference name="KeepRunning" value="True"/>
  <preference name="ShowTitle" value="True"/>
  <preference name="InAppBrowserStorageEnabled" value="True"/>
  <preference name="SuppressesIncrementalRendering" value="True"/>
  <preference name="phonegap-version" value="cli-6.3.1"/>
  <vs:plugin name="cordova-plugin-whitelist" version="1.2.1"/>
  <vs:plugin name="cordova-plugin-file-transfer" version="1.5.0"/>
  <vs:plugin name="cordova-plugin-file" version="4.1.0"/>
  <vs:plugin name="cordova-plugin-splashscreen" version="3.1.0"/>
  <vs:plugin name="cordova-plugin-inappbrowser" spec="~1.7.0"/>
</widget>

0 个答案:

没有答案