Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download Problem #415

Open
8 tasks
rox1010 opened this issue Jul 6, 2023 · 2 comments
Open
8 tasks

Download Problem #415

rox1010 opened this issue Jul 6, 2023 · 2 comments
Assignees
Labels
question Issue type : Question WebView Service : WebView

Comments

@rox1010
Copy link

rox1010 commented Jul 6, 2023

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

@rox1010 rox1010 added the question Issue type : Question label Jul 6, 2023
@taehyeon-nhn taehyeon-nhn self-assigned this Jul 6, 2023
@taehyeon-nhn taehyeon-nhn added the WebView Service : WebView label Jul 6, 2023
@taehyeon-nhn
Copy link
Contributor

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.

@rox1010
Copy link
Author

rox1010 commented Jul 6, 2023

`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 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issue type : Question WebView Service : WebView
Projects
None yet
Development

No branches or pull requests

2 participants