We have an android application written in Kotlin. It's our presentation layer. Most of the back-end is written in .NET Core. We have Azure Web services and Blob storage open. It's very simple to upload files from .NET Core to the Blob storage yet my question is how would one transfer them from the Kotlin app to the back-end? Currently we have Kotlin code setup to get photos from the phone's camera or gallery. We already can transfer such data as login information between the app and the back-end but how to do this with actual files? Are there any external libraries that could help us with that? There doesn't seem to be any mention of this in any of the documentations.
Asked
Active
Viewed 316 times
2 Answers
0
You can refer to this post for ideas. Here are my suggestions:
- Get the bitmap from assets(camera or gallery)
- Save bitmap to a file
- Upload File to Azure Blob Storage by RestApi

Jason Pan
- 15,263
- 1
- 14
- 29
0
You just can convert image to byte array and send it to the REST API.
- How to convert image to byte array: How to convert imageview to bytearray in kotlin
- Kotlin POST request sample: HTTP Request in Kotlin
- ASP.NET Core API, that accept byte array: c# webrequest post image to web api
At the back-end you can use something like SignalR to notify accepting of the image.

Vladislav Horbachov
- 176
- 1
- 8