Inappbrowser issue in worklight hybrid application in android devices - javascript

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.

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

Related

Adding Cordova Platforms

Hey, Guys! I recently started to work with Cordova and when I run the Cordova platform add android i get the following error. I have successfully placed the environment variables for Java and for the Android SDK as well. But the npm modules does not exist in C:/Windows/System32/npm as shown in the error, It is in the Users/My username/AppData/Roaming/npm folder. Some guidance would be appreciated.
I followed the following scripts which are shown in the official Cordova documentation to create a new project.
Cordova create hello com.example.hello HelloWorld
cd hello
Cordova platform add android -> where I'm stuck at
Kindly Check the Android Version Provided by Cordova and verify with your current Android version installed on your system , if there a mismatch :
1) Update Android Version From Android Studio SDK Manager
2) Update Cordova Platform - Refer: Cordova Documentation
External Source
cordova - Error: Failed to fetch platform android
I figured out halfway what the the problem was. There was a file named 'npm' in my C:/Windows/System32 directory wich was of 0kb size, and once i deleted it, the error vanished. But not all the way though. I was able to install the browser platform but not the android platform via cordova platform add android or even specifying what the matching cordova-andriod pluggin to be with cordova platform add andriod#version.
Only through the cordova platform add https://github.com/apache/cordova-android.git script I could install the andriod platform and once it was done other steps worked fine, and the project ran through the Android AVD. Any idea why the normal command to add the android platform didnt work, Just want to know but if it happens again i think Im gonna have to run the get from git command again. Thanks

Cordova: fcmPlugin.getToken is not a function [duplicate]

I am trying to use the cordova-plugin-health plugin for a phonegap app I am working on. Whenever I use the app every plugin works but this one. I am using the phonegap mac app to test on an iPhone 6s.
Steps I have taken:
Installed plugin with cordova plugin add cordova-plugin-health --variable HEALTH_READ_PERMISSION='App needs read access' --variable HEALTH_WRITE_PERMISSION='App needs write access' also I did cordova platform add ios
Used navigator.health.requestAuthorization later on tried window.plugin.health.requestAuthorization my ide WebStorm was able to detect the second but not the first.
Is there anything I missed/can I use this plugin using the phonegap mac app?
Thanks!
Phonegap Developer App is a tool to easily preview your apps.
Phonegap Developer App is a Cordova app itself, that loads your app code from a local web server.
The thing about the Phonegap Developer App is, as it's a precompiled app, it can only run the plugins that were included on the Phonegap Developer App at the moment of the build.
That means, most 3rd party plugins (like the heathkit one) won't work as they are not included in the Phonegap Developer App.
What you can do is to run your app in your device instead of previewing it.
To do it, run, with the Phonegap CLI installed and your device plugged in:
phonegap run ios
If you have Cordova CLI installed, this should also work
cordova run ios.

Chrome device inspect cannot find Ionic Application

I'm running debug my Ionic application with cordova run android and trying debug with chrome://inspect, it's found my device and list websites opened in my cellphone, but is not finding my Ionic application.
How to can I detect my Ionic application in my Chrome?
Following my cordova plugin list:
cordova-admobsdk 1.0.4 "Google Mobile Ads SDK for Cordova"
cordova-plugin-admob 3.2.4 "Cordova-Phonegap AdMob Plugin"
cordova-plugin-admobpro 2.25.0 "AdMob Plugin Pro"
cordova-plugin-console 1.0.4 "Console"
cordova-plugin-extension 1.5.1 "Cordova Plugin Extension"
cordova-plugin-whitelist 1.3.0 "Whitelist"
Device information:
Device: ASUS_T00F (Zenfone 1)
Android version: 4.3
I believe that you need Android >= 4.4.
Here The Chrome docs about it. Remember that Cordova use a WebView to show your app, and if you want to debbug an InApp WebViews you need Android 4.4 or high
Another point to note - in order for Chrome to detect in app 'WebView' of your Cordova application, your Cordova application must be of 'debug' version obtained from Cordova build. If your Cordova application is of 'release' version, Chrome will not be able to detect the 'WebView'.

Appcelerator on Windows: No valid Android SDK Targets Found

I'm trying to run an app on my Samsung Galaxy S6 installed with Marshmallow 6.0 in Appcelerator. I have downloaded Android Studio and used the SDK Manager to download the SDK for the OS. However, when trying to run my code, the console outputs these errors:
[ERROR] : No valid Android SDK targets found.
[ERROR] : Please download an Android SDK target API level 23 or newer from the Android
SDK Manager.
I tried uninstalling the API level 23 for Marshmallow 6.0 and reinstalling it directly through the manager rather than through installation of the studio, but this did not fix the issue. Appcelerator is able to detect my device, and developer mode as well as USB debugging are enabled on my S6.
How do I get Appcelerator to accept the SDK target API level 23?
To use the Android SDK with Studio, the path to the SDK must be set in the Preferences dialog.
Open the Preferences dialog:
On Mac OS X, from the menu bar, select Appcelerator Studio > Preferences.
On Windows, from the menu bar, select Window > Preferences.
In the Preferences dialog, navigate to Studio > Platforms > Android SDK.
Set your Android SDK path. Enter the path to your Android SDK in the Android SDK Home textbox or click the Configure button to navigate to the SDK directory.
Select your default Android SDK. Select a Google APIs item from the Default Android SDK drop-down menu.
Reference Link: Link
I have had the same problem, probably after Java was updated or because of Android SDK update (i'm not sure yet).
I managed to solve this problem by entering this in the CLI to select a specific Android SDK to build:
ti config android.buildTools.selectedVersion 23.0.3
Note that this is just a temporary solution to get going, but you might want to update this to a newer SDK version in time.
Edit: Best solution (on Windows): Go to Preferences > Studio > Platforms > Android. Click "Install SDK" and select/install Android 6.0 SDK.
Update: See this topic to update to Android 6.0 SDK

Cordova/Phonegap app is not showing the changes I've made in the jade files

I'm using grunt to show my changes that I've made in sublime text. But whenever i use cordova prepare, cordova build android, and cordova run android it only shows the previous version of the app on the emulator and my android device.
my changes were not navigating to the cordova folder because I didn't run grunt build-ios in the command line.

Categories

Resources