user3878988
user3878988

Reputation: 841

Inappbrowser issue in worklight hybrid application in android devices

I have created worklight 6.2 hybrid application for android in which when user clicks on a button it has to open an Inappbrowser with external url. Below is the code I have used on click of a button:

$("#inapp").click(function(){
    window.open("https://xxxx.com","_blank","location=yes");
});

When I click on the button the application closes by displaying a pop up with an error message:

Unfortunately, sampleApp stopped

This is happening only in android devices, in iOS it is working fine.

Upvotes: 2

Views: 516

Answers (1)

Erika Hoffman
Erika Hoffman

Reputation: 66

This is a known issue with missing resources. The current workaround is to create a standalone Cordova 3.4 Android application with the Cordova Command Line Interface.

This will NOT be a replacement of your Worklight application - it will allow you to generate the resources you are missing.

Workaround instructions:

--> Android Platform Guide: http://cordova.apache.org/docs/en/3.4.0/guide_platforms_android_index.md.html#Android%20Platform%20Guide

In the "Requirements and Support" section, follow the steps to include the Android SDK's tools and platform-tools directories in your PATH environment and to enable Java and Ant.

--> The Command-Line Interface: http://cordova.apache.org/docs/en/3.4.0/guide_cli_index.md.html#Plugin%20Development%0AGuide

Follow the steps under "Prerequisites" then do the following commands:

cordova create hello com.example.hello "HelloWorld"
cd hello
cordova platform add android
cordova plugin add org.apache.cordova.inappbrowser
cordova build

--> Android Platform Guide: Follow the steps under "Open a Project in the SDK"

Now you can navigate to the files you need, which will be in: \hello\platforms\android\res\drawable-hdpi

Copy the 3 ic_action PNG files into the \native\res\drawable-hdpi directory of your Worklight 6.2 project:

  • ic_action_next_item.png
  • ic_action_previous_item.png
  • ic_action_remove.png

This should fix the issue and allow the application to run successfully.

Here is a technote on this issue: http://www-01.ibm.com/support/docview.wss?uid=swg21681060

Upvotes: 5

Related Questions