dgkanatsios / AzureServicesForUnity

Accessing Azure services (App Service, Table Storage, CosmosDB with Table API, Event Hubs) from a Unity game
https://dgkanatsios.com/2016/04/14/use-azure-services-from-unity/
MIT License
55 stars 17 forks source link

Problem on Android export with insert #4

Closed dgkanatsios closed 8 years ago

dgkanatsios commented 8 years ago

Android seems to have an issue with the PATCH Http verb, which is necessary for Easy Tables' Update. Investigating

source: http://answers.unity3d.com/questions/1230067/trying-to-use-patch-on-a-unitywebrequest-on-androi.html

dgkanatsios commented 8 years ago

Unity has responded that this is by design, due to Android http client implementation that forbids PATCH.

http://androidxref.com/6.0.1_r10/xref/libcore/luni/src/main/java/java/net/HttpURLConnection.java#273

http://androidxref.com/6.0.1_r10/xref/libcore/luni/src/main/java/java/net/HttpURLConnection.java#680

Investigating potential other workarounds (apart from doing an Easy API call on Android just for Updates)

dgkanatsios commented 8 years ago

Azure team response: http://stackoverflow.com/questions/39023937/trying-to-use-patch-on-a-unitywebrequest-on-android-and-getting-unsupported-pro Unity team response: http://answers.unity3d.com/questions/1230067/trying-to-use-patch-on-a-unitywebrequest-on-androi.html

So, apparently PATCH is not going to work with Unity on Android. Implemented a workaround which requires EASY APIs, check these two gists: https://gist.github.com/dgkanatsios/b380d1ae4195b6592c1337c63c56b2ea

deadlyfingers commented 8 years ago

This is how the Mobile Services SDK for Android handles PATCH - wonder if Unity could do the same workaround for UnityWebRequest...? HttpPatch class

dgkanatsios commented 8 years ago

The Mobile Services team opted to use the Apache HttpClient for Android instead of the native Android Http client, probably for this very reason. Unity could potentially use that, but I think that this would require some refactoring on their side.