gree / gree/unity-webview

firebase storageにあるpdfをgoogle docs viewerで表示できない。

Open
#1,030 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Objective-C++
Stars
2.7k
Forks
734
Avg merge
11h 39m
Merged PRs (30d)
1

Description

android端末にて、firebase storageにあるpdfをgoogle docs viewerで表示できないのですが、何か問題がありますでしょうか?

端末:Pixel 5 (Android 11)

_webViewObject.Init(
    ld: (msg) =>
    {
        Debug.Log($"CallOnLoaded[{msg}]");

        const string js = @"
            if (!(window.webkit && window.webkit.messageHandlers)) {
                window.Unity = {
                    call: function(msg) {
                        window.location = 'unity:' + msg;
                    }
                };
            }
        ";

        _webViewObject.EvaluateJS(js + @"Unity.call('ua=' + navigator.userAgent)");
    },
    enableWKWebView: true);

#if UNITY_EDITOR_OSX || UNITY_STANDALONE_OSX
    _webViewObject.bitmapRefreshCycle = 1;
#endif

var Url = $"https://drive.google.com/viewerng/viewer?embedded=true&url={encodeUrl}";
_webViewObject.LoadURL(Url);

PlayerSettings->Scripting Define SymbolsにUNITYWEBVIEW_ANDROID_USES_CLEARTEXT_TRAFFICを追加
AndroidManifest.xmlにINTERNETパーミッションとandroid:usesCleartextTraffic=trueを追加

参考:
https://stackoverflow.com/questions/68509932/how-to-embed-documents-from-firebase-storage-into-google-microsoft-document-view/68514824#68514824

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the failure on a Pixel 5 running Android 11 using _webViewObject.LoadURL and the Google Docs viewer URL shown in the issue. Review the PlayerSettings scripting define symbol and AndroidManifest.xml settings, then compare the result with the Firebase Storage PDF flow. Done means identifying and documenting why the PDF does not display, or confirming a working display path.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, csharp, firebase, unity
Domain
mobile, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.