i m new to Xamarin Forms, While Creating an Android Application using Xamarin Forms, I encountered a problem, I like to use Google Direction API , I can create Map using Xamarin Forms on Android but to use HTTPURLConnection and json Parsing, do i have to create Custom Renderer Class and then access in Android Dir and Code there, Or i can create a Class for HTTPURLConnection, Json Parsing and then pass to Xamarin Forms map as class object. Please Help !!
The Google direction APIs are not exposed in Xamarin.Forms because they are not available cross-platform. Baked into Forms is only the basic mapping support which abstracts away the differences between Google Maps, Apple Maps and Bing Maps.
For anything more specialised/more platform specific you will have to create a custom renderer and/or use some architectural design to connect your shared code and the platform code (you could use the DependencyService - https://developer.xamarin.com/guides/xamarin-forms/dependency-service/).
Related
I'm working on a Xamarin.ios app that requires a 3d model to be displayed throughout the app's runtime.
I'm hosting the model online, but it's not responding when I call it using its URI. I tried hosting it on Google Drive and glitch, but it still wouldn't let me use it.
Is there a method to bundle the model in the app and try to implement it? I know it can be done in Swift with NSBundle, but I'm using Xamarin in C#.
I'm totally new in xamarin.
I'm trying to use CoreNFC in my xamarin.forms multiplatform app.
But I don't know how to do it because i can only import CoreNfc in myapp.ios and not in myapp.
There is someone that know how to do it ?
Thanks in advance!
Core NFC belongs to the iOS Framework, so you can import and use it only in our iOS Project.
You could implement the NFC feature on each platform you want to support and use a interface and the Xamarin Dependency Service, to have access to these platform specific implementations in your shared code.
Or you look around for a plugin which did this work for you. A starting point could be NFCForms from poz1. But if I remember well it has so far only support for Android and Windows Phone.
I have an app developed for windows 10 on C# and now I want to move to IOS and Android. I have heard of xamarin and used some of there stuff in C# but would it be possible to embed the C# code and move it to apple xcode without having to redevelop the app from again?
would it be possible to embed the C# code and move it to apple xcode without having to redevelop the app from again?
No, it is not possible. Basically you can share some UIs across different platforms, but I think redevelop your app for each platform is necessary.
Not sure if you want to use Xamarin.Android and Xamarin.iOS or Xamarin.Forms to develop your app, you can use C# for development by using Xamarin, it provides a cross-platform implementation of the extensive features in .Net framework, but the actual implementation on each system is very different. For more information, you can refer to Understanding the Xamarin Mobile Platform.
For Xamarin.Android and Xamarin.iOS, you can refer to Android Architecture and iOS Architecture.
For Xamarin.Forms, you can have your UIs and some basic features designed in the PCL in order to share across different platforms, but for most features just for example like working with files, we need to access the native method of each platform, therefor, Xamarin.Forms provides a locator named DependencyService to achieve this.
I'm trying to use this method:
https://developer.xamarin.com/api/member/System.Type.GetInterfaces()/
like this:
public MainPage(Type type) {
if (type.GetInterfaces().contains("Form")) {
// go on
But my Xamarin Studio does not recognize the GetInterfaces method, why?
It sounds like you are using a PCL Xamarin Forms project. I suggest you read more about that here or watch some of the helpful videos around the internet (like this one, which talks about different PCL Profiles) but basically and PCL project attempts to allow many of the common APIs available on all platforms. This means that if a certain platform does not support GetInterfaces() or if the Forms team has not implemented that API yet, it will not be available to your from the Forms project.
The nice thing about Xamarin Forms is that you can still access all native APIs if you need to. To do this you would create an interface and use Xamarin Forms Dependency Service (link) which would probably allow you to access that API from your Forms project.
If you need an example of how to do that, just let me know.
I was trying to create an app using Bing Map. in which i need to add two reference libraries
Microsoft.Maps.MapControl.Common.dll
Microsoft.Maps.MapControl.dll
I followed the tutorial from : http://www.codeguru.com/csharp/csharp/cs_misc/article.php/c18305__1/Working-with-Bing-Maps-in-Silverlight-and-Windows-Phone-7-Applications.htm
But when i installed BingMapAppSDK from Bing Maps it didn't have these api.
It does have libraries
Microsoft.Maps.Core;
Microsoft.Maps.MapControl;
Microsoft.Maps.MapControl.Types;
Microsoft.Maps.Plugins;
But not the above ones.. Due to this i am not able to use Bing Maps.
I am using Visual Studio 2010 and creating Silverlight app and Silverlight 5 is installed.
Please suggest.
You have To add a Service Reference.
1 . Right click on "reference" and then Add Service Reference.
then copy one of the four links from here which you want to use.
http://msdn.microsoft.com/en-us/library/cc966738.aspx
Click on go .
Name it according to you .
Now try to add namespaces
like
using ProjectName.GeocodeService;
using ProjectName.ImageryService;
Hope This helps.
There are different Bing Maps SDKs for different platforms although, confusingly, they do share rather similar namespaces. It's really unclear from your post which platform you're trying to target...
To develop a Silverlight Bing Maps application, you need the Bing Maps Silverlight control SDK, available from http://www.microsoft.com/download/en/details.aspx?id=2949
To develop a Windows Phone 7 Bing Maps application, you need the Windows Phone 7 SDK, http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=27570
To develop a "Bing Maps App" (note the quotation marks), which is a special kind of Bing Maps application that is hosted by Microsoft on the bing.com/maps site, you need the Bing Maps App SDK: http://connect.microsoft.com/bingmapapps
Note that there are also dedicated Bing Maps SDKs for iOS, Android, and WPF development, as well as the traditional AJAX control.
The name of the dll's can be different from the namespaces they provide. If I understand your question correctly, you already have access to everything you need. The four libraries are what you need to make your apps, while the dll files are what you are already using to get access to those namespaces.
In the example link you listed, he shows how make a reference to the map control namespace by doing the following:
xmlns:m="clr-namespace:Microsoft.Maps.MapControl; assembly=Microsoft.Maps.MapControl"
In this case, the assembly (dll file) and the namespace are the same, but they don't have to be and thats why they are specified separately.
From here, just add the map control.
<m:Map CredentialsProvider="Your_Credentials" />