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.
Related
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 am creating my first Cross-Platform Xamarin Forms application (PCL) using VS 2015. Application needs some native views/controls so I decided to use PageRenderer. I know, I cannot override Activity operations (onBackPressed, finish, onResume) in PageRenderer for Android project. So is there any alternative to achieve same functionality? For example, I need to start some animation in onResume and want to show some messagebox in onBackPressed operation.
Please guide me.
Also existing native application used xml files for offline data support. Will it be a good option to use SQLite with Xamarin Forms (cross-platform) application for storing data? Please need expert opinion.
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/).
I have a Windows Phone 8 app that makes use of real time server push via SignalR.
I started to create a Native Android and iOS version of my app, but got stuck at implementing my SignalR component in native Android Java and iOS obj-C.
I have conceptually thought of a way to achieve this by making ONLY JUST the SignalR component portable via Xamarin.
Is it possible to create a Hybrid app in this way ?
And are there any resources online where people have done such.
Thanks for your help.
Xamarin would be kind of an all in sort of thing. So all of your Objective-C and JAVA would need to be ported to Xamarin's framework. That might not be a bad idea though ;).
Alternatively, if you are looking for a more cross platform way to implement a SignalR client, you maybe could wrap the logic up in a UIWebView (iOS) or WebView (Android) and use the JavaScript components. Here is an example from Microsoft on implementing a SignalR client via JavaScript. I don't know how integrated the SignalR functionality is in your app, but this may be an easy way to use it for simple display purposes.