Did You Know?

Stay Ahead In Digital Economy

Setting up your web app

Author: admin 182 views

1) Setting up your web app/website/HTML files

Option A) Use a URL for accessing your web application (= store files online)

Create a mobile-optimized website, for example, using jQuery Mobile and upload your site to your webserver/webspace. WebViewGold supports all kinds of web apps/websites (including HTML, PHP, WordPress, Progressive Web Apps, HTML 5 Games, WiX, apprat.io, bubble.io, …). Please make sure to optimize your website to feel like an app. Please consider a professional User Experience/UX Review on UXreviewer.io or similar services for best Play Store approval results. Such a UX review also helps you to achieve better customer retention in general for your product with suggestions for improvement.

Option B) Use a local HTML folder for accessing your web application (= store files within the app)

WebViewGold supports web apps bases on local HTML folders, too: Copy your HTML/CSS/JavaScript files to the Android Studio project and set USE_LOCAL_HTML_FOLDER to true (see next step). Please consider a professional User Experience/UX Review on UXreviewer.io or similar services for best Play Store approval results. Such a UX review also helps you to achieve better customer retention in general for your product with suggestions for improvement.

Option C) Use an HTML folder if the user is offline, and use a remote URL if the user is online (= store files online + store backup/fallback files within the app)

Copy your HTML/CSS/JavaScript files to the Android Studio project, set USE_LOCAL_HTML_FOLDER to false (see next step) and set FALLBACK_USE_LOCAL_HTML_FOLDER_IF_OFFLINE to true (see next step). Please consider a professional User Experience/UX Review on UXreviewer.io or similar services for best Play Store approval results. Such a UX review also helps you to achieve better customer retention in general for your product with suggestions for improvement.

Afterward, open Android Studio:

Android Studio welcome screen

Choose Import project:

Import Project button

Select your AndroidStudioSource folder and wait until the project loaded completely:

Android Studio file picker

Afterward, open Config.java file to edit main configuration details (URL, URL Handling, UserAgent, dialogs). Please take a look at our YouTube channel for specific setup tutorials.
The main configuration document Config.java looks like this:

Config.java allows you to configure most of the settings directly in the document

Setting up apps with WebViewGold is very easy and does not require any coding knowledge. Please take a look at this overview of the built-in configuration options in Config.java file:

HOST
required value
Your domain host without https:// or http:// prefix (e.g. “www.example.org”)
HOME_URL
required value
Your full WebView URL (e.g. “https://www.example.org/app.html”) which should be loaded in the WebView
USE_LOCAL_HTML_FOLDER
true or false
Set to true to use local “index.html” HTML file instead of remote WebView URL
FALLBACK_USE_LOCAL_HTML_FOLDER_IF_OFFLINE
true or false
Set to true if you want to use the “local-html” folder if the user is offline, and use the remote URL if the user is online
ACTIVATE_PROGRESS_BAR
true or false
Set to false to disable the progress spinner/loading spinner
USER_AGENT
optional
Define a customized UserAgent for web requests (or leave it empty to use the default Android UserAgent)
APPEND_LANG_CODE
true or false
Set to true if you want to extend URL request by the system language like ?webview_language=LANGUAGE CODE (e.g., ?webview_language=EN for English users)
OPEN_EXTERNAL_URLS_IN_ANOTHER_BROWSER
true or false
Set to true to open all external hosts in an external browser (outside your app)
OPEN_SPECIAL_URLS_IN_NEW_TAB
true or false
Set to true to open links with attributes (_blank, _self) in new a tab by default
CLEAR_CACHE_ON_STARTUP
true or false
Set to true to clear the WebView cache on each app startup and do not use cached versions of your web app/website
IS_DEEP_LINKING_ENABLED
true or false
Set to true to enable deep-linking
OPEN_NOTIFICATION_URLS_IN_SYSTEM_BROWSER
true or false
Set to true to open the notification deep linking URLs in the system browser instead of your app
SPLASH_SCREEN_ACTIVATED
true or false
Set to true to activate the splash screen
SPLASH_TIMEOUT
number value (milliseconds)
Set the splash screen timeout in milliseconds
SCALE_SPLASH_IMAGE
percentage value (0-100)
Set the splash screen image size with respect to device smallest width/height; range in percentage [0-100]; Caution: value = 0 will hide the image completely
darkStatusBarText
true or false
Status Bar Dark/Light Mode; Set to true for dark status bar text; use it in combination with ‘colorPrimaryDark’ in style.xml
PREVENT_SLEEP
true or false
Set to true to prevent the device from going into sleep while the app is active
ENABLE_SWIPE_NAVIGATE
true or false
Set to true to enable navigation by swiping left or right to move back or forward a page
ENABLE__PULL_REFRESH
true or false
Set to true to enable swiping down to refresh the page
EXIT_APP_BY_BACK_BUTTON_ALWAYS
true or false
Set to true to close the app by pressing the hardware back button (instead of going back to the last page)
EXIT_APP_BY_BACK_BUTTON_HOMEPAGE
true or false
Set to true to close the app by pressing the hardware back button if the user is on the home page (which does not allow going to a prior page)
SHOW_FIRSTRUN_DIALOG
true or false
Set to false to disable the First Run Dialog
SHOW_FACEBOOK_DIALOG
true or false
Set to false to disable the Follow On Facebook Dialog
SHOW_RATE_DIALOG
true or false
Set to false to disable the Rate This App Dialog
RATE_DAYS_UNTIL_PROMPT
number value (days)
Set the minimum number of days to be passed after the application is installed before the “Rate this app” dialog is displayed
RATE_LAUNCHES_UNTIL_PROMPT
number value (launches)
Set the minimum number of application launches before the “Rate this app” dialog is displayed
FACEBOOK_DAYS_UNTIL_PROMPT
number value (days)
Set the minimum number of days to be passed after the application is installed before the “Follow on Facebook” dialog is displayed
FACEBOOK_LAUNCHES_UNTIL_PROMPT
number value (launches)
Set the minimum number of application launches before the “Rate this app” dialog is displayed
FACEBOOK_URL
value (URL)
Set the URL of your Facebook site
PUSH_ENABLED
true or false
Set to true to activate OneSignal Push (set OneSignal IDs in the build.gradle file)
PUSH_ENHANCE_WEBVIEW_URL
true or false
Set to true if you want to extend URL request by ?onesignal_push_id=XYZ (set the OneSignal IDs in the build.gradle file)
PUSH_RELOAD_ON_USERID
true or false
Set to true if WebView should be reloaded when the app gets a UserID from OneSignal (set the OneSignal IDs in the build.gradle file)
FIREBASE_PUSH_ENABLED
true or false
Set to true to activate Firebase Push (replace google-services.json before)
FIREBASE_PUSH_ENHANCE_WEBVIEW_URL
true or false
Set to true if you want to extend URL request by ?firebase_push_id=XYZ
SHOW_BANNER_AD
true or false
Set to true if you want to display AdMob banner ads (set the AdMob IDs in the strings.xml file)
SHOW_FULL_SCREEN_AD
true or false
Set to true if you want to display AdMob fullscreen interstitial ads after X website clicks (set the AdMob IDs in the strings.xml file)
SHOW_AD_AFTER_X
value (website reloads)
Set the number X of website clicks for AdMob interstitial ads (set the AdMob IDs in the strings.xml file)
HIDE_ADS_FOR_PURCHASE
true or false
Set to true to hide AdMob ads after successful In-App Purchase
USE_FACEBOOK_ADS
true or false
Set to true to use Facebook Audience Network ads instead of AdMob ads (set the Ad IDs in the strings.xml file)
downloadableExtension
list
Add the file formats that should trigger the file downloader functionality (e.g., .pdf, .docx, …)
requireLocation
true or false
Set to false if you do NOT require location services/GPS coordinates. You may also need to delete the permission from the AndroidManifest.xml file.
requireStorage
true or false
Set to false if you do NOT require APIs related to downloads or uploads. You may also need to delete the permission from the AndroidManifest.xml file.
requireCamera
true or false
Set to false if you do NOT require APIs related to camera images / camera videos. You may also need to delete the permission from the AndroidManifest.xml file.
requireRecordAudio
true or false
Set to false if you do NOT require APIs related to recording audio. You may also need to delete the permission from the AndroidManifest.xml file.

Open strings.xml file to edit app name & text strings:

string.xml file for editing text captions

Open dimens.xml file to modify text formatting:

Use dimens.xml to resize objects and text


Open colors.xml file to edit colors of the status bar, splash screen, and loading sign/loading indicator:

Modify the assets in colors.xml to re-color objects and screens

 


Loading...