I'm trying to implement Azure Mobile Services in my Xamarin.Forms app.
I'm following this link and it works on iOS but not on Android.
It throws this exception:
MobileServiceInvalidOperationException - "The server did not provide a response with the expected content."
I have tried switching between HTTP and HTTPS but could not get it working.
It works on Android (native) as well, just not on Xamarin.Android
Any help?
Your issue is tracked here, and seems to be because of the following:
we don't support .Net Core 2.1 in the SDK today. Unfortunately, we don't have a workaround today and like Ela said, the we don't have an ETA for a new release or other SDK to use for .Net Core 2.1 compatibility yet, so your only workaround is to stick with .Net Core 2.0 for now.
There seems to be a temporary work around here, by brendanzagaeski to in the call to new MobileServiceClient():
Either pass in an HttpClientHandler instance
Or pass in an instance of AndroidClientHandler
It seems like AndroidClientHandler is the one that works the most often.
Check if "microsoft.azure.mobile.client" is referenced on your project. If not, try installing a lower version of the "microsoft.azure.mobile.client" through nuget package on your project add the using directive and then update the "microsoft.azure.mobile.client" through nuget package.
And update any pending package.
Related
I have implemented the application to read all the google contacts. The application was done by a .NET Core. I have used the Google.GData.Contacts(Version 2.2.0) Nuget package to read all the contacts. My application always show some warning messages like below
As per this document https://developers.google.com/contacts/v3, I believe the version 3.0 is there. But, I'm not sure how to include or use it.
It would be much appreciated if anyone help me on this.
There hasnt been any development on the GData library in years gdata. So I dont think its going to work with .net core.
This is due to the fact that most of the gdata apis have been shut down by now gdata.
As you can see from the nuget page Google.GData.Contacts the last update was 6/25/2013 which is before the release date of .net core.
What you should consider doing is checking the google people api which should contain similar response and supports the Google .net client library.
Install-Package Google.Apis.People.v1 -Version 1.25.0.830
It is still live
The google contacts api is still live so you can use it if you like you will just have to create your own system to access the endpoints. As google has no library that works with .net core for gdata.
Getting the following error in my MainActivity.cs in my Android project of a Xamarin.Forms solution:
CurrentPlatform is inacessbile due to its protection level
From the following line of code which is inside the OnCreate(), with only the CurrentPlaftorm portion underlined:
Microsoft.WindowsAzure.MobileServices.CurrentPlatform.Init();
I didn't receive this error until I upgraded my MonoAndroid to v7.0 from v6.0 and did all the necessary updates that come with that like JDK 1.8.
Wondering if someone can explain what this error means and why it is being invoke specifically for the CurrentPlatform.
I tried to recreate this error in a new project but once I typed Microsoft.WindowsAzure.MobileServices. it had the CurrentPlatform option available with no issue.
Also now a line using the MobileServiceClient type calling the LoginAsync() from the WindowsAzure component throws two errors on the parameters which used to be:
await client.LoginAsync(context, "facebook");
But I receive the following two errors now:
Argument 1: cannot convert from 'Android.Content.Context' to 'Microsoft.WindowsAzure.MobileServices.MobileServiceAuthenticationProvider'
Argument 2: cannot convert from 'string' to 'Newtonsoft.Json.Linq.JObject'
Not sure why these two areas of code broke when I changed my Android Target SDK as they were just part of the Microsoft.WindowsAzure components.
Not sure why these two areas of code broke when I changed my Android Target SDK as they were just part of the Microsoft.WindowsAzure components.
According to your description, I assumed that it dues to the version of Azure Mobile Client SDK you referenced.
For Azure Mobile Client SDK 3.1.0, you client would reference the lib from the following path:
Microsoft.Azure.Mobile.Client.3.1.0\lib\monoandroid\Microsoft.WindowsAzure.Mobile.Ext.dll
You could leverage ILSpy to check the extension methods for LoginAsync as follows:
While for Azure Mobile Client SDK 4.0.0-alpha-001, if your MonoAndroid >= 4.4, then the lib would be reference under:
Microsoft.Azure.Mobile.Client.4.0.0-alpha-001\lib\monoandroid44\Microsoft.Azure.Mobile.Client.dll
For Azure Mobile Client SDK 4.0.0, if your MonoAndroid >= 7.1, then the lib would be reference under:
Microsoft.Azure.Mobile.Client\4.0.0\lib\monoandroid71\Microsoft.Azure.Mobile.Client.dll
My previous project targets on Android 6.0, then the lib would only reference Microsoft.Azure.Mobile.Client.4.0.0\lib\netstandard1.4\Microsoft.Azure.Mobile.Client.dll, and there has no extension methods for LoginAsync via server-flow authentication.
In summary, from your code await client.LoginAsync(context, "facebook");, you are using Server-managed authentication, I would recommend that you could use Azure Mobile Client SDK 3.1.0 without upgrading your Android SDK version or use the latest Azure Mobile Client SDK 4.0.0 and upgrading your Android SDK version to 7.1 or higher.
Additionally, the code client.LoginAsync(MobileServiceAuthenticationProvider.Facebook,{JObject token}) is using Client-managed authentication, at this point, your app can independently contact the identity provider and then provide the returned token during login with your azure mobile backend.
I'm interested in figuring out how to use the Twilio API, and I am building an ASP.NET 5 application using the Twilio API with MVC6 (trying to follow this tutorial). So far, I have created an empty ASP.NET 5 application, and I added "Twilio" to the dependencies in project.json. I get the following error:
"The dependency Twilio 4.0.3 in project TwilioTest does not support framework DNXCore, Version v5.0"
I notice that when I remove "dnxcore50" from "frameworks", the error goes away.
I'm not sure what this means or how to approach it. I'm still pretty new to .NET and trying to wrap my head around how all of the pieces fit together. Does it mean that Twilio isn't compatible with DNXCore? Since all I want to do for now is learn how to use Twilio, could I essentially remove the dnxcore50 framework from the project and continue working through building the app?
The Twillio NuGet package is dependent on the full .NET stack, which in project.json frameworks terms is DNX451. What that means is, you can add the Twillio NuGet package and remove the DNXCORE50 reference and your project will run as expected and you will be able to use the Twillio API. As far as I know the only major drawback is that your ASP.NET Core project will no longer be cross platform as you are now dependent on the full .NET Framework stack which is only present in Windows.
In a nutshell, you should be fine unless you are planning to deploy to Linux/OSx. Hopefully as ASP.NET CORE becomes mainstream more 3rd party SDKs will be built to require only DNXCORE50 as a dependency.
Another option don't use the Twillio Libraries and code against their REST API. See documentation here: https://www.twilio.com/docs/api. But I wouldn't recommend this if you are deploying to a Windows environment.
Twilio is working on their .Net Standard (Core) library. In the meantime, I've published a .Net Core port of their library to unblock our current projects until we get the official update. Feel free to take it for a spin:
Install Twilio.NetCore from Nuget.
And you can check out the source on Github.
I want to add SignalR to my Windows service, written in C#, targetting .NET 4.0. The Microsoft.Owin.* packages appear to require .NET 4.5.
I'd also like to include NancyFX in the same process, for other reasons.
What's the best way to self-host SignalR?
I installed the signalR package (v. 1.1.2) using .net 4.0. Work as a charm. I cannot use 4.5 as I am still at VS2010.
I use it with a standard web project with a WebService handling the communication.
The only Microsoft OWIN package that requires 4.5 is owinhost.exe (used to be katana.exe), you can still use normal http listener (Microsoft.Owin.Host.HttpListener) to self host just fine.
If you install the packages as listed at https://github.com/SignalR/SignalR/wiki/Self-host they should work just fine under .NET 4.0. It's worth remembering that you can always use the package manager console to explicitly install older versions of packages if you need to - although for SignalR at the time of writing there is no need to do this.
When I first created my site, there were no .NET SDKs for Facebook so I wrote my own. It was pretty hacky, but it worked. Due to various Facebook changes, it's now broken beyond repair so I figured I'd use a real library. The one I found was the Facebook C# SDK.
However, it seems you can only download the source and compile it, and it seems it requires .NET 4.0 to compile. Also, looking through the code it seems to use .NET features such as System.Threading.Tasks. I'm still on .NET 3.5 and cannot upgrade at the moment. I'm wondering if there's a) a way to make this project work on 3.5, or b) another library that would be better in my case.
Facebook C# SDK supports .net 3.5sp1.
You can download using nuget.
If you are using VS 2008 where nuget package manager is not support, you can download using nuget command line tool. (http://nuget.codeplex.com/releases)
nuget install Facebook
For pre-release version you can download using the following command.
nuget install Facebook -pre
I have websites in .Net 3.5 using the latest code from the Facebook C# SDK. However, here's what I do. I use the "client" Facebook.dll to do all the stuff. Yeah, I don't get some of the wizbang session information, etc. But I do get full access to the API. I use javascript for authentication then AJAX the access token to the server.
I guess it depends on how committed to making the new SDK work with your codebase.
You could branch the code from Facebook C# SDK as you listed and replace all the task stuff with System.Threading.Threads, but that could result in a lot of work if there is extensive use of Tasks.
Or you could update your SDK to just address the areas you currently require until you can move to .NET 4. At least that way your project won't need reworking, just your internal library that your project is already referencing.