Asset - Extension GMSWebView Game Maker Studio Android Extension

RizbIT

Member
ok make a new project import gmswebview
set internet persmission
target sdk 25,min sdk 11, compile sdk 25
build tools 25.0.2
support lib 23.2.1

did you call WebView_Init(0); in game start before any other function call?

I just download the new gmsversion into new project, and imported ALL the resources for the demo. ran it on android phone and seems to work fine.

so we need to look at you gms setup

let me know your progress
 
A

alexsaa

Guest
I think it worked, it's interfering with another extension, anyway thanks
 
A

alexsaa

Guest
I have a problem, can you help me?
When I enter the room, everything works fine, but if I go back inside, when I want to go back, it hangs up :'v

 
Last edited by a moderator:

RizbIT

Member
yeah i dont understand what you are trying to do.

you are using gmswebview?

you are opening a fullscreen webview in your app then closing it?

please outline the steps you are taking and the functions you are using.

If you look at the demo included, there are several rooms, in each room a webview is created or resized and then a url loaded. so it is possible to have a webview and go to different rooms. note the webview will still be open so before you exit and room hide or destroy the webview
 
A

alexsaa

Guest
oh genial thx. I will try if the problem continues, do I have to download the new version?
 

RizbIT

Member
New Functions v3.0

WebView_SetInitialScale(scale)
Set as 0 for default scales or a value greater than 0 as a percentage. This sets the initial scale/zoom of the website in webview. It must be set AFTER WebView_Init() and BEFORE WebView_Create()


WebView_Zoom(amount)
Eenter a value from 0.01 to 100 to zoom in / out by that amount


WebView_ZoomIn()
zoom the webview in


WebView_ZoomOut()
zoom the webview out
 
G

Gonzonalta

Guest
Hello, I would like to know if with this extension it is possible to send a file in the included files file: /// android_asset / new_file
??
 
G

Gonzonalta

Guest
I would like to send the html file to the included files through the code:
file = http_get_file("https://teste.com/App/index.html", " ///android_asset/index.html");

and then load through the included files with the code:
webview_load_included("site/index.html");

so i update the file by the server
 
Last edited by a moderator:

RizbIT

Member
this would require a function like save_html() to save the html to a file but that is currently not supported
 
G

Gonzonalta

Guest
can i save the page in a variable and put it in its extension somehow?

webview_load_included ("var");

??
 
G

Gonzonalta

Guest
Hello, again .. how could i put the page in a variable and press the following code >> webview_load_url( global.page );
in a way that works?
 

RizbIT

Member
Hello, again .. how could i put the page in a variable and press the following code >> webview_load_url( global.page );
in a way that works?
I dont see why not as long as the global variable exists, is a string and a valid URL should work:
WebView_Goto(global.page );
 

RizbIT

Member
Just published v7.0

Two new functions added
New* WebView_SetDomStorage(true) - This may help with some sites that dont load and show as blank
New* WebView_SetJavaScript(true) - Optional if needed

Minor bug fixes.

Added a simple example object and room showing how to init and create the new webview in your app
 

mmuziek

Member
Sadly recently the plugin stopped working:

WebViewEmbed.java:60: error: cannot find symbol
vg = (ViewGroup)RunnerActivity.CurrentActivity.findViewById(R.id.ad);

so it doesnt compile anymore stange enough even with the provided example files
 

RizbIT

Member
Sadly recently the plugin stopped working:

WebViewEmbed.java:60: error: cannot find symbol
vg = (ViewGroup)RunnerActivity.CurrentActivity.findViewById(R.id.ad);

so it doesnt compile anymore stange enough even with the provided example files
Yes I am working on this. Its due to changes GMS made to layouts in new version.

Will update once resolved.

UPDATE:
The issue is fixed download the latest version.

It does work however it may be more of a workaround than a solution and really would need support from GMS or someone with better knowledge of GMS layouts and manifest
 
Last edited:

RizbIT

Member
Published new v8.0.0

In this version just tidied up the code and assets a bit. Few bug fixes.
Added Goto URL on the first example room.

Added Geo Location capabilities, which mean you can now enable GEO Location and the extension will ask for location permission. This will allow sites in the webview to make use of GPS and Javascript based location scripts. For example google maps can get exact location in the webview. Or use a script to get location details like Longitude.

More Details (Also included in the Notes in the extension file):
In order to use GEO location features of websites with Javascript code such as navigator.geolocation.getCurrentPosition
You will have to do the following:

1 - Enable Geo Location Functions of this extension when you initialize it via second argument
WebView_Init(0,1);

2 - Set the Access fine location permission in the extension's Android permission settings as these will NOT be added by default, so add:
android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION

3 - In order to enable Javascript also use this WebView_SetJavaScript(true) before you create the webview

4 - You can test using your own site location API or for example https://maps.google.com and press the My Location button and it should find correct location
1670801983831.png
 
Last edited:

RizbIT

Member
Updated to v8.2

Added support for tel:, geo: and mailto: URL schemes

So if your user clicks on any link in webview starting with for example "tel:07789266366" it will open the default caller app such as Phone and set the number (user can then press call to call it)
 
Top