nhn / gpm.unity

A brand of NHN providing free services required for game development.

Home Page:https://gameplatform.nhncloud.com/en/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Download Problem

rox1010 opened this issue · comments

Service

  • [... ] WebView
  • AssetManagement
  • Communicator
  • LogViewer
  • Manager
  • UI
  • Profiler
  • Adapter
  • DLST

Version

Latest

Summary

I have Succesfully Download and use WebView so far its good but suddenly when i tried to dowload some files. app crash instantly or close im trying to figure out why its happening ? or how can i enable download if needed ?

Screenshots

no screenshot just got test on my phone

Additional context

im trying to use this WebView to open URL and Download files from there . Thankyou for ASAP reply

Hello. @rox1010.

Let us know the detailed flow of the file download and we'll check it out.
It would also be helpful to include your Unity Editor version and Android SdK version.

Thank you.

`using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Gpm.WebView;

public class WebViewTest : MonoBehaviour
{

// FullScreen
public void ShowUrlFullScreen()
{
GpmWebView.ShowUrl(
"https://www.mediafire.com/file/4hb7r3s1qbvv0vl/000.gwo/file",
new GpmWebViewRequest.Configuration()
{
style = GpmWebViewStyle.FULLSCREEN,
orientation = GpmOrientation.LANDSCAPE,
isClearCookie = true,
isClearCache = true,
backgroundColor = "#FFFFFF",
isNavigationBarVisible = true,
navigationBarColor = "#4B96E6",
title = "The page title.",
isBackButtonVisible = true,
isForwardButtonVisible = true,
supportMultipleWindows = true,
#if UNITY_IOS
contentMode = GpmWebViewContentMode.MOBILE
#endif
},
OnCallback,
new List()
{
"USER_ CUSTOM_SCHEME"
});

}

// Popup default
public void ShowUrlPopupDefault()
{
GpmWebView.ShowUrl(
"https://google.com/",
new GpmWebViewRequest.Configuration()
{
style = GpmWebViewStyle.POPUP,
orientation = GpmOrientation.LANDSCAPE,
isClearCookie = true,
isClearCache = true,
isNavigationBarVisible = false,
supportMultipleWindows = true,
#if UNITY_IOS
contentMode = GpmWebViewContentMode.MOBILE,
isMaskViewVisible = true,
#endif
},
OnCallback,
new List()
{
"USER_ CUSTOM_SCHEME"
});
}

// Popup custom position and size
public void ShowUrlPopupPositionSize()
{
GpmWebView.ShowUrl(
"https://www.google.com",
new GpmWebViewRequest.Configuration()
{
style = GpmWebViewStyle.POPUP,
orientation = GpmOrientation.LANDSCAPE,
isClearCookie = true,
isClearCache = true,
isNavigationBarVisible = false,
position = new GpmWebViewRequest.Position
{
hasValue = true,
x = (int)(Screen.width * 0.1f),
y = (int)(Screen.height * 0.1f)
},
size = new GpmWebViewRequest.Size
{
hasValue = true,
width = (int)(Screen.width * 0.8f),
height = (int)(Screen.height * 0.8f)
},
supportMultipleWindows = true,
#if UNITY_IOS
contentMode = GpmWebViewContentMode.MOBILE,
isMaskViewVisible = true,
#endif
}, null, null);
}

// Popup custom margins
public void ShowUrlPopupMargins()
{
GpmWebView.ShowUrl(
"https://google.com/",
new GpmWebViewRequest.Configuration()
{
style = GpmWebViewStyle.POPUP,
orientation = GpmOrientation.LANDSCAPE,
isClearCookie = true,
isClearCache = true,
isNavigationBarVisible = false,
margins = new GpmWebViewRequest.Margins
{
hasValue = true,
left = (int)(Screen.width * 0.1f),
top = (int)(Screen.height * 0.1f),
right = (int)(Screen.width * 0.1f),
bottom = (int)(Screen.height * 0.1f)
},
supportMultipleWindows = true,
#if UNITY_IOS
contentMode = GpmWebViewContentMode.MOBILE,
isMaskViewVisible = true,
#endif
}, null, null);
}

private void OnCallback(
GpmWebViewCallback.CallbackType callbackType,
string data,
GpmWebViewError error)
{
Debug.Log("OnCallback: " + callbackType);
switch (callbackType)
{
case GpmWebViewCallback.CallbackType.Open:
if (error != null)
{
Debug.LogFormat("Fail to open WebView. Error:{0}", error);
}
break;
case GpmWebViewCallback.CallbackType.Close:
if (error != null)
{
Debug.LogFormat("Fail to close WebView. Error:{0}", error);
}
break;
case GpmWebViewCallback.CallbackType.PageStarted:
if (string.IsNullOrEmpty(data) == false)
{
Debug.LogFormat("PageStarted Url : {0}", data);
}
break;
case GpmWebViewCallback.CallbackType.PageLoad:
if (string.IsNullOrEmpty(data) == false)
{
Debug.LogFormat("Loaded Page:{0}", data);
}
break;
case GpmWebViewCallback.CallbackType.MultiWindowOpen:
Debug.Log("MultiWindowOpen");
break;
case GpmWebViewCallback.CallbackType.MultiWindowClose:
Debug.Log("MultiWindowClose");
break;
case GpmWebViewCallback.CallbackType.Scheme:
if (error == null)
{
if (data.Equals("USER_ CUSTOM_SCHEME") == true || data.Contains("CUSTOM_SCHEME") == true)
{
Debug.Log(string.Format("scheme:{0}", data));
}
}
else
{
Debug.Log(string.Format("Fail to custom scheme. Error:{0}", error));
}
break;
break;
case GpmWebViewCallback.CallbackType.GoBack:
Debug.Log("GoBack");
break;
case GpmWebViewCallback.CallbackType.GoForward:
Debug.Log("GoForward");
break;
case GpmWebViewCallback.CallbackType.ExecuteJavascript:
Debug.LogFormat("ExecuteJavascript data : {0}, error : {1}", data, error);
break;
}
}

}
`

Heres my testsample code and i am only using public void ShowUrlFullScreen() and im using Unity Editor Version 2022.3.2f1 SDK latest 32 or 34 . when i connect my Android phone then build and run it run smoothly web open but after clicking download theres nothing happened instead it will close automatically and probably crash or idk yet . My Aim is to Open web on my Android phone and download that files and save it to my phone but after long long journey of search can't find how can i add download option or does it have its own download method like list on GamePackage Image has .