Calling external URL in inAppBrowser - ibm-mobilefirst

How can we call external URL inside our worklight hybrid application?
We are calling it through window.open but we want to open it in InAppbrowser.
Does it need to install Cordova plugin "cordova-plugin-inappbrowser" ?
We have MFPF 7.1
can someone please advise what steps we need to follow.
Thanks,

IBM MFP 7.1 has cordova and the major cordova plugins embedded. This means when you create an MFP 7.1 hybrid project, certain plugins are already present for your use directly. The complete list of available plugins can be found in this document : https://mobilefirstplatform.ibmcloud.com/tutorials/en/foundation/7.1/hello-world/integrating-mfpf-sdk-in-cordova-applications/ .
You will find that among others, inappbrowser is also automatically added to your hybrid project. This means you can directly use :
var ref = cordova.InAppBrowser.open('http://apache.org', '_blank', 'location=yes');
or set existing window.open to inappbrowser like this :
window.open = cordova.InAppBrowser.open;
More usage info on inappbrowser can be found on the official cordova browser over here :
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-inappbrowser/

Related

No option for adding New flutter Web Project in IntelliJ Dart Templates !!! Also tried Vs code, is asking for Which Dart template

I'm trying to start a new Flutter project in Intellij as well as Vs code.
Intellij there is no option provided to add a new flutter web project in Dart templates.
Vs code whenever I select New flutter Web Project after accepting the stagehand it asks for the Dart template which is why I'm stuck.??
Please help soon??
Since flutter 1.9 flutter_web is merged inside flutter, Follow the below steps to create and run your first flutter web App through IntelliJ IDEA.
Create a new flutter project.
Now change your flutter channel to master using flutter channel master
Upgrade flutter flutter upgrade
Install the flutter_web build tools flutter pub global activate webdev
Enable flutter web using flutter config --enable-web
Check available devices flutter devices and you will get a result like:
Chrome • chrome • web-javascript • Google Chrome 81.0.4044.92
Web Server • web-server • web-javascript • Flutter Tools
Inside your flutter project create myapp using flutter create myapp
Navigate inside myapp using cd myapp
Finally, run flutter run -d chrome
And you will be able to run your flutter web app into chrome. Hurray 🤟🏽🤟🏽🥳
Reference links: Building a web application with Flutter , flutter_web
It seems that the support for Flutter Web Apps was dropped in stagehand (that contains the dart templates). From this commit on github: (Dropping Flutter Web sample). Instead, this wikipage shows how to migrate/create a web package in flutter from command line.
Create your project from command-line.
Check out this tutorial. flutter.dev/docs/get-started/web
Then just open the project in IntelliJ IDE.
Install or Update the dart and flutter plugins in Intellij and/or VS Code
For Intellij
Go to [mac] Preferences>Plugins>Marketplace and search for Dart and Flutter, install it.
For VS Code
Go to View > Command Pallet and type in Extensions: Install Extensions
then type flutter and install it
Its well documented in this link
Setup Flutter

Installing cordova plugin in MFPF 7.1

can we install Cordova plugin "cordova-plugin-wkwebview-engine" in MFPF 7.1
If Yes, can someone please advise what steps we need to follow.
Thanks,
You can integrate cordova-plugin-wkwebview-engine plugin in your MFP 7.1 Cordova Application by following this blog if the app is built using Mobilefirst Studio Plugin.
If it is MFP 7.1 pure cordova application, you can add wkwebview plugin by running following command in terminal.
cordova plugin add cordova-plugin-wkwebview-engine
Note : MobileFirst Features like Direct Update, Server Notifications might stop working if you are using wkwebview plugin.
cordova-plugin-wkwebview-engine plugin needs cordova-ios >4.0.0.
where as MobileFirst CLI contains an instance of Cordova CLI v5.0.0, and iOS platform version 3.7.0.
for more details see here : link
So it may not work.Try below command if it works
mfp cordova plugin add cordova-plugin-wkwebview-engine

How to add browser platform to MFP cordova app?

I'm looking for a way to add browser platform to the current mfp cordova app for testing purpose. When I tried to run mfp cordova platform add browser, I got the error
Error: Hook not implemented yet for browser
By the looks of the commands, you're using 7.1. This release does not support the Web platform for Cordova apps.
Note that Mobile Foundation 8.0 supports standard Cordova apps, including the Web platform.

How to navigate from one html page to another in IBM MobileFirst?

1)I need to navigate from one page to another in IBM mobile First app as soon as I click the button.
2)Is there any document that clearly explains how to develop an app using eclipse (IBM mobile first 8.0)?
Can anyone please help me
Eclipse Java EE IDE for Web Developers.
Version: Mars.2 Release (4.5.2)
Build id: 20160218-0600
Windows 7
1) To learn how to develop a hybrid Angular app in MobileFirst 8.0, please see this lab. There is no longer the MobileFirst hybrid, and will be moving toward Cordova, Ionic, Angular.
https://mobilefirstplatform.ibmcloud.com/labs/developers/8.0/intro/
2) To develop an app with eclipse in MobileFirst 8.0, please follow this blogpost. There's a plugin you can download from Eclipse marketplace.
https://mobilefirstplatform.ibmcloud.com/blog/2016/06/17/ibm-mobilefirst-studio-8-0-plugin-for-eclipse-now-available/
MobileFirst is a Single-page application (SPA).
There are several ways to navigate in a single-page application. Usually it will depend on the framework you are using to build your application such as jQuery, AngularJS, Ionic etc.
Simple Javascript worked for me
window.location("your html page path");

Worklight v6.2 - Android Cordova Plug-in

Has anyone tried the "Android - Adding native functionality to Hybrid Application using Apache Cordova plug-in" feature in v6.2 ?
I'm trying to use a 3rd party library on the client side and wanted to understand where to put the plug-in java class in the project. The documentation shows a java package (src) structure whereas the best I can find is normal folders in the android native folder.
Thanks.
The reason you see these as "regular" folders is likely because you are look at the Worklight project rather than the generated Android project.
Worklight project\apps\your_app\android\native\ ... will look as folders because they are indeed just folders.
Once you build your Worklight application (containing an Android environment), an Android project will be generated. In it, you will see the folders as packages, etc.
A Worklight project and application structure is explained in earlier training modules:
Creating your first Hybrid Worklight application
Previewing your application on Android
So, you should place your Java Class file in Worklight project\apps\your_app\android\native\src\com\package_name\ ...
Note about Cordova plug-ins in Worklight: depending on the plug-in this may not be possible to use as some plug-ins require using the Cordova plugman, which is not yet supported in Worklight.