Skip to main content

Download listening

In UWebView2, these callbacks will be triggered when downloading files, for example, generating table data for users to download.

  void Awake()
{
Edge.DownloadStartingEvent.AddListener(OnStart);
Edge.DownloadProgressEvent.AddListener(OnProgress);
Edge.DownloadStateChangedEvent.AddListener(OnStateChanged);
}

void OnStart(UInt64 task_id, string file_url, string file_save_path, string mime_type)
{

}

void OnProgress(UInt64 task_id, long recvBytes, long total_bytes)
{

}

void OnStateChanged(UInt64 task_id, EdgeWebViewDownloadStateChanged state)
{
if(state == EdgeWebViewDownloadStateChanged.COMPLETED)
{
// Success
}
else
{
// Failed.
}
}