[英]What is the best way to upload a file from android app if server is apollo graphql server
I should upload a file to server from Android app using Apollo framework. 我应该使用Apollo框架从Android应用程序上传文件到服务器。 The problem is that I couldn't find any library and any example for that. 问题是我找不到任何库和任何示例。 Is there any solution that you can provide? 你能提供什么解决方案吗? How to upload a file from mobile using Apollo framework? 如何使用Apollo框架从移动设备上传文件? Any idea? 任何想法?
If you are using apollo client for android to consume graphql queries and mutations you have to add customTypeMapping in your build.gradle file 如果您使用apollo client for android来使用graphql查询和突变,则必须在build.gradle文件中添加customTypeMapping
apollo {
customTypeMapping = [
"Upload" : "com.apollographql.apollo.api.FileUpload"
]
}
The Upload is a scalar recognized by graphql for uploading files to a server. 上传是graphql识别的标量,用于将文件上载到服务器。
Here is how to upload a file with a apollo client for android link 以下是如何使用apollo客户端上传文件以获取android 链接
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.