Android Cordova Plugin that uses draw over all apps feature to display a HTML Web view , it supports displaying HTML file with style files and Javascript libraries and scripts - for now it can not use cordova capabilities -
Install
cordova plugin add cordova-plugin-drawoverapps
It is also possible to install via repo url directly
cordova plugin add https://github.com/ahmedwahba/cordova-plugin-drawoverapps
Functions
- window.overApps.checkPermission
- window.overApps.startOverApp
- window.overApps.closeOverApp
window.overApps.checkPermission
This to check draw-over-apps permession and open system permission window to be granted
window.overApps.checkPermission(function(msg){
console.log(msg);
});
window.overApps.startOverApp
start service function display the over-all head or the web view according to options. If successful the success
is called,
otherwise the failed
is called instead.
window.overApps.startOverApp(options, success, failed);
Options
-
path: file path to display as view content, this file should be located in
WWW
root folder. - hasHead: display over app head image which open the view up on click , by default true.
- dragToSide: enable auto move of head to screen side after dragging stop , by default true.
- enableBackBtn: enable hardware back button to close view , by default true.
- enableCloseBtn: whether to show native close btn or to hide it , by default true
- verticalPosition: set vertical alignment of view , values are top - center - bottom , by default center.
- horizontalPosition: set horizontal alignment of view , values are right - center - left , by default center.
Example
var options = {
path: "test.html", // file path to display as view content.
hasHead: true, // display over app head image which open the view up on click.
dragToSide: false, // enable auto move of head to screen side after dragging stop.
enableBackBtn: false, // enable hardware back button to close view.
enableCloseBtn: true, // whether to show native close btn or to hide it.
verticalPosition: "top", // set vertical alignment of view.
horizontalPosition: "left" // set horizontal alignment of view.
};
window.overApps.startOverApp(options,function (success){
console.log(success);
},function (err){
console.log(err);
});
window.overApps.closeOverApp
It closes over app web view , called inside app itself only .
window.overApps.closeOverApp();
Control overApp WebView
Close WebView
It closes over app webview from one of the webview UI or event
OverApps.closeWebView();