Mobile Cross-Platform Camera Frames Extraction - xamarin

Is there any cross-platform framework for mobile apps (Xamarin, Flutter, React-Native, etc.) that allows accessing frames from the camera's feed live?
In other words, is there any way to perform manipulations on live video (frame-by-frame) in cross-platform environments? (Similarly to this tutorial for iOS).
From what it seems, in Flutter for example, it's possible to display a live preview of the camera, but not to access the frames; and beside some ghost-town questions I couldn't find much online about it.

Xamarin allows you to access and use each and every feature of all platforms.
The code will be platform specific but C#. I have one project in my repo where I'm using Xamarin.iOS to overlay rectangle detection onto the camera live feed. You can implement something similar using Xamarin.Android (using Android specific APIs).
You can then create an abstraction which will be consumed from a Xamarin.Forms app or you go with two separate C# based native apps.

Related

Migrate existing UWP app to work as Xamarin APP

I have existing UWP apps that I would now like to migrate to Xamarin, so that I can run them on Android devices. What are the most viable and/or practical approaches for doing this?
In some cases I will also want to continue to run these apps on Microsoft devices. I'd prefer not to have two code-bases to maintain, but that might be an option for some apps. A couple of the apps are available on the MS Apps Store.
The UWP apps are relatively cleanly architected, with separate layers and physical projects separating the UI from data access, logic, etc.
Worse-case I can make a new (Xamarin) project and UI from scratch, but what about the other projects / layers? What are my options for those? E.g. copy and paste - retain the old code/solutions (for future UWP-based support if necessary), create copies of the old (non-UI) code/projects in the new Xamarin solution (with a new Xamarin UI).
This post How do I add Xamarin Forms to an existing UWP XAML app? talks about "multiple types of Xamarin code sharing strategies and UI strategies" but doesn't provide any details or references.
This post Adding UWP option to Xamarin cross-platform application seems to be talking about doing it the other way around: taking a Xamarin app and delivering it as UWP.
What are the most viable and/or practical approaches for doing this?
Currently, there is no tool that could directly convert a UWP app into a Xarmain App. Based on your description, you will need to create a new Xamarin app to make your app available in both Android and Windows, or even more on IOS.
You could build a Xamarin.Forms app for your scenario. Xamarin.Forms allows developers to build Xamarin.iOS, Xamarin.Android, and Windows applications from a single shared codebase. As #Jason mentioned, if your app is well architected with data, domain, and service layers, those can probably be reused in Xamarin.Forms app. And the Xamarin.Forms app will convert the code into performant native controls on each platform. So you don't need to write extra code for each platform for the same function.

How to get/set current volume level in Xamarin froms?

How to get device's current volume level and use that inside our application play sound? Also how to get notified about sound level changed by hardware button or software seekbar?
Xamarin.Forms doesn't have Audio API's yet, so you will need to implement the functionality for each platform on your own. However, there seems to be a library called Xamarin Audio Manager and it should do at least some of the things that you require, take a look at it here on GitHub.
You can then use the project as a good starting point for extending it to meet all your needs. Audio API's in both Android and iOS are relatively easy to understand.

Porting android app to xamarin or windows native questions

So, I have been developing an android app for some time, and I was requested to try porting this app to windows phone too. In order to reduce the hassle in trying to maintain two separate versions of the same app, I decided to try to port this app into xamarin, because I have heard that its performance is better than hybrid apps. These are my questions with regard to xamarin:-
I want to maintain the same look and feel which I had in my original app into my cross platform app, and at the same time, make it distinct in the windows version. What are the things I can do to achieve this effect?
Is it rather better for me to port this app to windows phone native, because of added problems in trying to create a common app?
Are there any restrictions with regard to Windows store when publishing xamarin apps?
Xamarin doesn't really cover Windows UWP apps, only in the notion that they have the UI Framework Xamarin.Forms running on that platform. Meaning, that what you are making is a native Windows UWP app.
What Xamarin is great at is when you start targeting more than one platform and you have structured your code in a way that it can be reused on the supported platforms. This could for instance be done by putting most of your logic and behavior into a Portable Class Library/NETStandard library and consume it in your apps.
A Typical pattern for making platform agnostic logic and behavior for your apps, is the pattern known as Model-View-ViewModel, where the View is platform specific, while the Model and ViewModel usually are platform agnostic. The ViewModel is where the behavior resides and it is what ties the Model together with the View.
Usually the ViewModel wouldn't directly know the View, but there would be a layer in between (glue), such as XAML or a binding engine from MvvmCross, MvvmLight or ReactiveUI to name some MVVM libraries.
What Xamarin provides is the ability to write C# code for Android and iOS, which greatly enables you to share code between those two platforms, but also all the Windows platforms. Hence, UI, is very much dependent on each of the platforms on their own.
You can, of course, use Xamarin.Forms as a UI abstraction layer, which produces a native UI using the native UI controls to get a similar app on all the targeted platforms.
First of all you need to know there are different styles of Xamarin development, who will share more or less content.
If you use Xamarin Forms you have a Main project non-related to any platform (where you create the views and clases), and specific platform projects who adapt the controls to each native style.
If you develop using Xamarin Classic, you have a Shared project where you only develop data-related classes, and specific platform project with their own views and classes with native-friendly controls and native similar functions, but I think, there is no direct Xamarin Clasic Windows Project.
So if you only want to have two apps who look native both, but with same structure and functionalities Xamarin Forms will be the best option for you, cause you only develop "one single app" who becomes native-style like this:
If what you want is to have different apps, with different functionalities and diferent content, then you need to go for Xamarin Classic. What I recomend you to do then is develop the windows phone in native, but put all of the code you can in a shared library. Then you can create a Xamarin classic Android app and use the shared library. You will still need to mantain two different apps, but you will only need to change the "core" code only one time.
If you use Xamarin Forms to do a UWP windows app I don't think you have any problem to publish it, think Xamarin is from Microsoft.

Implement map into application

I would like to ask if there is any free solution ready to implement it to my application? I'm aiming into Open Street Map as I want free solution. I know about OsmSharp which is neat but lack of documentation and there is a question:
is there possibility to change for example pin design or map layout?
I heard that it's possible but you have to write your own render...
I am targeting iOS, Android and WP with our geolocalisation game app.
Xamarin Forms has a built in Map control. TKCustomMap is a third-party renderer that adds functionality to the built in map.
About leak documentation I have written a blogpost about it: http://zchpit.blogspot.com/2017/10/open-street-map-in-xamarin-forms.html
You can find source code on my github: https://github.com/zchpit/OPM_in_XamarinForms
About:
is there possibility to change for example pin design or map layout?
Yes. You can change map (one from many) or generate your own map (same like in standard xamarin)
As with other OSM library/framework solutions, you will need to provide your own tile server or use a commercial OSM tile service.
Mapsui is a C# map component for apps
Supported platforms: WPF, UWP, Android, iOS
https://github.com/pauldendulk/Mapsui

is there a library for xamarin for platform specific features?

I'm developing a cross platform (ios/android/wp) app that needs to do basic things like dialing a number, sending a message, sending an email, reading/writing events in the calendar, taking a picture, etc. All those things have different APIs on the different platforms. Is there a library that abstracts those things and implements them on each platform in the platform's native way?
Have a look at these components:
Xamarin.Mobile
Xamarin.Auth
Xamarin.Social
You could also have a look at this project which is intended for use from within Xamarin.Forms projects:
Xamarin.Forms.Labs
Whilst this project includes a lot of GUI controls intended for Xamarin.Forms apps, it does include abstractions for platform specific services such as:
Accelerometer
Cache
Camera (Picture and Video picker, Take Picture, Take Video)
Device (battery info, device info, sensors, accelerometers)
Display
Geolocator
Phone Service (cellular network info, make phonecalls)
SoundService
Text To Speech
Which you could make use of to abstract out your phone calling / taking photo concerns as needed.

Resources