Cordova inAppBrowser simply refuses to work on Android












1















Recently I started working with cordova again and I've been having quite the situation. I am trying to build a mobile app that simply displays a webpage along with push notification support. Thing is, when I build for android, even if plugins are loading fine, the inAppBrowser refuses to work. It stays in the initial screen. Also, if I build from phoneGap Build it works fine (but it's not compatible with the push plugin I have so I can't use that). Also, the plugin works fine if I run the app on the browser.



What I have tried:




  • Removing the android platform and rebuilding

  • Copying the entire www folder in a new clean cordova project

  • Debugging inAppBrowser


Nothing worked.



This is my config.xml:



<?xml version='1.0' encoding='utf-8'?>
<widget id="com.gr.---" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>----</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<allow-navigation href="*" />
<access origin="*" />
<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>
<plugin name="cordova-plugin-device" spec="^2.0.2" />
<plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
<plugin name="cordova-plugin-fcm-with-dependecy-updated" spec="^2.2.6" />
<engine name="android" spec="^7.1.3" />
<engine name="browser" spec="^5.0.4" />
</widget>


This is my index js file:



class Messenger {
constructor(uuid) {
//TODO: Add firebase message events
this.uuid = uuid ? uuid : "TESTING4";
this.endpoint = "http://192.168.1.200/";

}

updateSettings() {

}
}

var app = {
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
},

onDeviceReady: function() {
let messenger = new Messenger(device.uuid);
let ref = cordova.InAppBrowser.open(messenger.endpoint + "register?uuid=" + messenger.uuid, '_blank',"location=no");
},
};

app.initialize();


This is my index html file:



<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' ws: data: gap: https://ssl.gstatic.com 'unsafe-eval'; frame-src *;script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>FXTipster</title>
</head>
<body class="bg-fx">
<div class="app">
<div class="main-image-container">
<img src="img/logo.png" class="main-image">
</div>
<div class="loader-container">
<div class="loader"></div>
</div>
</div>


<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="cordova_plugins.js"></script>
<script type="text/javascript" src="js/index.js"></script>
</body>
</html>









share|improve this question





























    1















    Recently I started working with cordova again and I've been having quite the situation. I am trying to build a mobile app that simply displays a webpage along with push notification support. Thing is, when I build for android, even if plugins are loading fine, the inAppBrowser refuses to work. It stays in the initial screen. Also, if I build from phoneGap Build it works fine (but it's not compatible with the push plugin I have so I can't use that). Also, the plugin works fine if I run the app on the browser.



    What I have tried:




    • Removing the android platform and rebuilding

    • Copying the entire www folder in a new clean cordova project

    • Debugging inAppBrowser


    Nothing worked.



    This is my config.xml:



    <?xml version='1.0' encoding='utf-8'?>
    <widget id="com.gr.---" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>----</name>
    <description>
    A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@cordova.apache.org" href="http://cordova.io">
    Apache Cordova Team
    </author>
    <content src="index.html" />
    <plugin name="cordova-plugin-whitelist" spec="1" />
    <allow-navigation href="*" />
    <access origin="*" />
    <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>
    <plugin name="cordova-plugin-device" spec="^2.0.2" />
    <plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
    <plugin name="cordova-plugin-fcm-with-dependecy-updated" spec="^2.2.6" />
    <engine name="android" spec="^7.1.3" />
    <engine name="browser" spec="^5.0.4" />
    </widget>


    This is my index js file:



    class Messenger {
    constructor(uuid) {
    //TODO: Add firebase message events
    this.uuid = uuid ? uuid : "TESTING4";
    this.endpoint = "http://192.168.1.200/";

    }

    updateSettings() {

    }
    }

    var app = {
    initialize: function() {
    document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
    },

    onDeviceReady: function() {
    let messenger = new Messenger(device.uuid);
    let ref = cordova.InAppBrowser.open(messenger.endpoint + "register?uuid=" + messenger.uuid, '_blank',"location=no");
    },
    };

    app.initialize();


    This is my index html file:



    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' ws: data: gap: https://ssl.gstatic.com 'unsafe-eval'; frame-src *;script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
    <meta name="format-detection" content="telephone=no">
    <meta name="msapplication-tap-highlight" content="no">
    <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
    <link rel="stylesheet" type="text/css" href="css/index.css">
    <title>FXTipster</title>
    </head>
    <body class="bg-fx">
    <div class="app">
    <div class="main-image-container">
    <img src="img/logo.png" class="main-image">
    </div>
    <div class="loader-container">
    <div class="loader"></div>
    </div>
    </div>


    <script type="text/javascript" src="cordova.js"></script>
    <script type="text/javascript" src="cordova_plugins.js"></script>
    <script type="text/javascript" src="js/index.js"></script>
    </body>
    </html>









    share|improve this question



























      1












      1








      1








      Recently I started working with cordova again and I've been having quite the situation. I am trying to build a mobile app that simply displays a webpage along with push notification support. Thing is, when I build for android, even if plugins are loading fine, the inAppBrowser refuses to work. It stays in the initial screen. Also, if I build from phoneGap Build it works fine (but it's not compatible with the push plugin I have so I can't use that). Also, the plugin works fine if I run the app on the browser.



      What I have tried:




      • Removing the android platform and rebuilding

      • Copying the entire www folder in a new clean cordova project

      • Debugging inAppBrowser


      Nothing worked.



      This is my config.xml:



      <?xml version='1.0' encoding='utf-8'?>
      <widget id="com.gr.---" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
      <name>----</name>
      <description>
      A sample Apache Cordova application that responds to the deviceready event.
      </description>
      <author email="dev@cordova.apache.org" href="http://cordova.io">
      Apache Cordova Team
      </author>
      <content src="index.html" />
      <plugin name="cordova-plugin-whitelist" spec="1" />
      <allow-navigation href="*" />
      <access origin="*" />
      <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>
      <plugin name="cordova-plugin-device" spec="^2.0.2" />
      <plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
      <plugin name="cordova-plugin-fcm-with-dependecy-updated" spec="^2.2.6" />
      <engine name="android" spec="^7.1.3" />
      <engine name="browser" spec="^5.0.4" />
      </widget>


      This is my index js file:



      class Messenger {
      constructor(uuid) {
      //TODO: Add firebase message events
      this.uuid = uuid ? uuid : "TESTING4";
      this.endpoint = "http://192.168.1.200/";

      }

      updateSettings() {

      }
      }

      var app = {
      initialize: function() {
      document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
      },

      onDeviceReady: function() {
      let messenger = new Messenger(device.uuid);
      let ref = cordova.InAppBrowser.open(messenger.endpoint + "register?uuid=" + messenger.uuid, '_blank',"location=no");
      },
      };

      app.initialize();


      This is my index html file:



      <!DOCTYPE html>
      <html>
      <head>
      <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' ws: data: gap: https://ssl.gstatic.com 'unsafe-eval'; frame-src *;script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
      <meta name="format-detection" content="telephone=no">
      <meta name="msapplication-tap-highlight" content="no">
      <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
      <link rel="stylesheet" type="text/css" href="css/index.css">
      <title>FXTipster</title>
      </head>
      <body class="bg-fx">
      <div class="app">
      <div class="main-image-container">
      <img src="img/logo.png" class="main-image">
      </div>
      <div class="loader-container">
      <div class="loader"></div>
      </div>
      </div>


      <script type="text/javascript" src="cordova.js"></script>
      <script type="text/javascript" src="cordova_plugins.js"></script>
      <script type="text/javascript" src="js/index.js"></script>
      </body>
      </html>









      share|improve this question
















      Recently I started working with cordova again and I've been having quite the situation. I am trying to build a mobile app that simply displays a webpage along with push notification support. Thing is, when I build for android, even if plugins are loading fine, the inAppBrowser refuses to work. It stays in the initial screen. Also, if I build from phoneGap Build it works fine (but it's not compatible with the push plugin I have so I can't use that). Also, the plugin works fine if I run the app on the browser.



      What I have tried:




      • Removing the android platform and rebuilding

      • Copying the entire www folder in a new clean cordova project

      • Debugging inAppBrowser


      Nothing worked.



      This is my config.xml:



      <?xml version='1.0' encoding='utf-8'?>
      <widget id="com.gr.---" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
      <name>----</name>
      <description>
      A sample Apache Cordova application that responds to the deviceready event.
      </description>
      <author email="dev@cordova.apache.org" href="http://cordova.io">
      Apache Cordova Team
      </author>
      <content src="index.html" />
      <plugin name="cordova-plugin-whitelist" spec="1" />
      <allow-navigation href="*" />
      <access origin="*" />
      <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>
      <plugin name="cordova-plugin-device" spec="^2.0.2" />
      <plugin name="cordova-plugin-inappbrowser" spec="^3.0.0" />
      <plugin name="cordova-plugin-fcm-with-dependecy-updated" spec="^2.2.6" />
      <engine name="android" spec="^7.1.3" />
      <engine name="browser" spec="^5.0.4" />
      </widget>


      This is my index js file:



      class Messenger {
      constructor(uuid) {
      //TODO: Add firebase message events
      this.uuid = uuid ? uuid : "TESTING4";
      this.endpoint = "http://192.168.1.200/";

      }

      updateSettings() {

      }
      }

      var app = {
      initialize: function() {
      document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
      },

      onDeviceReady: function() {
      let messenger = new Messenger(device.uuid);
      let ref = cordova.InAppBrowser.open(messenger.endpoint + "register?uuid=" + messenger.uuid, '_blank',"location=no");
      },
      };

      app.initialize();


      This is my index html file:



      <!DOCTYPE html>
      <html>
      <head>
      <meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' ws: data: gap: https://ssl.gstatic.com 'unsafe-eval'; frame-src *;script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; media-src *; img-src 'self' data: content:;">
      <meta name="format-detection" content="telephone=no">
      <meta name="msapplication-tap-highlight" content="no">
      <meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
      <link rel="stylesheet" type="text/css" href="css/index.css">
      <title>FXTipster</title>
      </head>
      <body class="bg-fx">
      <div class="app">
      <div class="main-image-container">
      <img src="img/logo.png" class="main-image">
      </div>
      <div class="loader-container">
      <div class="loader"></div>
      </div>
      </div>


      <script type="text/javascript" src="cordova.js"></script>
      <script type="text/javascript" src="cordova_plugins.js"></script>
      <script type="text/javascript" src="js/index.js"></script>
      </body>
      </html>






      android cordova cordova-plugins inappbrowser






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 23 '18 at 8:06









      Aniruddh Parihar

      2,21911129




      2,21911129










      asked Nov 23 '18 at 7:50









      voidblazevoidblaze

      4316




      4316
























          0






          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442590%2fcordova-inappbrowser-simply-refuses-to-work-on-android%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53442590%2fcordova-inappbrowser-simply-refuses-to-work-on-android%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Paul Cézanne

          UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

          Angular material date-picker (MatDatepicker) auto completes the date on focus out