0
votes

I want to compress data in android devices and send it to an ASP.net server-side, but I don't want to consume much power and sacrifice device resources. I've tried compressing data using Deflate stream on android-side and decompressing using the same stream on the server side, but the decompressed string was not the same as the original one. I tried then using GZIP stream and the recovered data was the same as the original one. As I read, Deflate stream is faster than GZIP. So what should I do? Is it the best practice to use GZip stream for data compression and decompression between Android and C#? Is there a way to recover data that is compressed using Deflate stream?

1
Is Android app made with C#?Wanton
@Wanton No, Android app is programmed using Android Studio - Java. The server is implemented using ASP.net and the used classes are C#.A.J
Are you serializing to JSON, then getting UTF-8 bytes of it, then compressing it and sending it to ASP.NET api or what?Wanton
Yes, that is exactly what I am doing.A.J
GZipStream in ASP.NET? You don't happen to use some old .NET framework. If I remember there where bugs fixed in 4.5 for it.Wanton

1 Answers

1
votes

Try using DotNetZip (NuGet) instead of System.IO.Compression.GZipStream.