我在chromebook上遇到一个(大)问题,其功能在“经典” Android设备(手机,平板电脑)上正常工作。
我尝试发送带有附件的电子邮件。
这是一部分代码(api> = 23)。

在我的手机(android 9 api 28)上,调用了gmail应用,所有文本字段均填充了正确的信息,并且文件(myResume.pdf)正确连接。
电子邮件在发送后被接收,包含一个可读的pdf文件。这很酷。
使用我的chromebook(PB 314/v。83.0.4103.119),将调用gmail,所有文本字段均填充了正确的信息,但没有附件
LogCat指示:

2020-06-27 15:25:50.886 127-2348/? I/ActivityManager: START u0 {act=android.intent.action.SEND typ=message/rfc822 flg=0x43 cmp=org.chromium.arc.applauncher/.ChromeBrowserProxyActivity clip={message/rfc822 T:My text} (has extras)} from uid 10040
2020-06-27 15:25:50.887 565-565/? D/ArcDummy: New intent received: Intent { act=android.intent.action.SEND typ=message/rfc822 flg=0x10000043 cmp=org.chromium.arc.applauncher/.ChromeBrowserProxyActivity clip={message/rfc822 T:My text} (has extras) }
2020-06-27 15:25:50.887 565-565/? W/ContextImpl: Calling a method in the system process without a qualified user: android.app.ContextImpl.startService:1531 android.content.ContextWrapper.startService:664 org.chromium.arc.applauncher.DummyActivity.forwardIntentIfNeeded:155 org.chromium.arc.applauncher.DummyActivity.onNewIntent:121 android.app.Activity.performNewIntent:7255
2020-06-27 15:25:50.892 127-2348/? W/WindowManagerInjector: Attempted to get menu state of app token with non existing window
2020-06-27 15:25:50.896 780-842/? D/ArcMediaControllerManager: onTaskMovedToFront: 2
2020-06-27 15:25:50.897 780-842/? I/ArcMediaControllerManager: onAppBecameActive: org.chromium.arc.applauncher
2020-06-27 15:25:50.892 127-2348/? W/WindowManagerInjector: Attempted to get menu state of app token with non existing window
2020-06-27 15:25:50.900 127-760/? W/ActivityManager: For security reasons, the system cannot issue a Uri permission grant to content://com.TTT.fileprovider/images/myResume.pdf [user 0]; use startActivityAsCaller() instead
2020-06-27 15:25:50.901 127-760/? W/WindowManagerInjector: Attempted to get menu state of app token with non existing window
在android手机上测试时,此句子永远不会出现:
For security reasons, the system cannot issue a Uri permission grant to content://com.TTT.fileprovider/images/myResume.pdf [user 0]; use startActivityAsCaller() instead
有关先前代码的更多信息:
the file "myResume.pdf" is copied to a special directory for beeing shared with gmail.

dest is a string (/storage/emulated/0/MyDir/myResume.pdf) obtained with

Environment.getExternalStorageDirectory().toString() > /storage/emulated/0/
my sub directory, created and verified > MyDir/
the file > myResume.pdf

文件AndroidManifest.xml包括
<provider
        android:name="android.support.v4.content.FileProvider"
        android:authorities="com.TTT.fileprovider"
        android:exported="false"
        android:grantUriPermissions="true">
        <meta-data
            android:name="android.support.FILE_PROVIDER_PATHS"
            android:resource="@xml/provider_paths"/>
</provider>
文件@ xml/provider_paths是:
<?xml version="1.0" encoding="utf-8"?>
    <paths xmlns:android="http://schemas.android.com/apk/res/android">
    <external-path name="images"  path="myDir/"/>
    </paths>
我希望我已经详细解释了我的问题,
谁能帮我?
非常感谢你!

最佳答案

该问题最终通过使用gmail应用程序(下载后)解决了,然后使用了它而不是gmail/web/chrome。

关于java - Chromebook : can't attach file to e-mail,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/62611615/

10-08 23:46