我按照以下链接中提到的步骤将 Freshdesk 集成到 android(Nougat) 中:
我在 gradle 文件中添加了最新版本的 freshdesk 的依赖项。 在上面链接中提到的集成的第一步中,它说我们可能会收到以下错误作为 Toast 消息
“Freshchat 的 FileProvider 缺失/错误。在运行 Nougat 或更高版本操作系统的设备中,摄像头捕获将失败(错误代码 354)”
为避免错误,我在我的 AndroidManifest.xml 文件和“freshchat_file_provider_authority”的字符串资源中添加了以下代码。 AndroidManifest.xml 文件中的字符串资源“freshchat_file_provider_authority”和权限具有相同的包名称。
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="com.mypackage.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/freshchat_file_provider_paths" />
</provider>
<string name="freshchat_file_provider_authority">com.mypackage.provider</string>
但我仍然遇到相同的错误:“Freshchat 的 FileProvider 丢失/错误。在运行 Nougat 或更高版本操作系统的设备中,相机捕获将失败(错误代码 354)”
请帮忙。 谢谢。
最佳答案
AndroidManifest.xml
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="com.mypackage.provider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/freshchat_file_provider_paths" />
</provider>
值/strings.xml
<string name="freshchat_file_provider_authority">com.mypackage.provider</string>
关于android - 在 android 中集成 Freshdesk 时文件提供程序异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57069258/