Storing domain events with Xamarin - xamarin

I'm looking for a way to store events using Xamarin on a mobile device.
On the server there are event stores I can use, but I don't know what is possible with Xamarin mobile.
(e.g. https://geteventstore.com/)
Event store says it can run on mono, but I'm not sure if that means xamarin mobile.
I suppose I could use sqlite database to store events, but I'm new to all this and I'm not sure how that would work.

Related

How can Xamarin be used to wrap a web app as if it were a native app for Android?

Say I build a super mobile friendly web application that I want in the Play Store for Android users to be able to download.
Could I use Xamarin to:
Wrap the entire mobile app as a single WebView
Register for mobile push notifications
Essentially shortlining an MVP of an android app by using an existing web app? If so, is there any well-known process or documentation that demonstrates this?
Probably the best approach for you would be using Xamarin Forms with one or more pages containing only web views.
I don't love Xamarin Forms because usually for me Xamarin Android+iOS gives a better result in similar time, but your app would be so simple that doesn't make sense to do it with Xamarin Android.
Make sure that your web app will show only what makes sense to be shown in your app, otherwise you risk to see double header/footer, useless buttons... but if the website is yours adding a few parameters to change a bit the UI won't be a problem I guess.
Have a look at this example:
https://github.com/xamarin/xamarin-forms-samples/tree/master/WorkingWithWebview
Another approach is the use of Razor to build your pages in html directly inside your app, but if I understood well it's not what you need:
https://developer.xamarin.com/guides/cross-platform/advanced/razor_html_templates/
Although it is technically possible to do this as the previous answer has suggested. I would recommended firstly reviewing, the relevant stores guidelines on submissions. Apple for example will not allow a submission to their store of any application that simply mirrors the functionality of a website. I suspect Google's would likely be the same.
However that said, to answer your question, Xamarin.Forms would be appropriate for a simple application like the one you are suggesting. Or if you prefer to build to a specific OS, then in iOS with Xamarin you would use the Safari View Controller that was added in it's xcode 8.1 release. Android uses something similar as does windows.
EDIT:
You can use the Web View control in Xamarins Andorid native PCL project to encapsulate your mobile friendly website within an application here is the documentation:
Xamarin Android Developer link to Android Web View
As for push notifications, yes this is perfectly possible using Xamarin.Android. and varies on implementation depending on what you want to use as the back end to handle them, I.E. Azure's notification hub etc.

How can I create a method to detect when a notification is clicked using xamarin coss-platform portable?

I´m a bit new to Xamarin Forms development, but not to Android (Java) development. Here´s the scenario:
I´ve developed an app for android, which schedules notifications (NotificationManager) and adds an intent to each notification in order to redirect the user to a specific url inside a webview. The url came from the notification intent.
So, I´m doing exactly the same thing in xamarin, in order to build the iOS version. Since I´m also an ASP.NET, I chose this method.
I´ve done all the basic stuff, so far:
created the webview with the right address;
created the routine which sets the cross-platform notifications using CrossLocalNotifications (Xam.Plugins.Notifier)
This is the problem:
I need to create a method in which the app redirects (webview) the user, once he clicks the notifications, in the portable solution level. I think I can manage to develop the logic to use the webview I currently have. I just can´t seem to find anywhere on the web a tip for creating a method to "listen" to the user click and catch information (or just the ID) of the notification created, so I can build the routine.
Anyone can help or have a better solution?

Xamarin - create an environment to view HTML files

I have only written PC programs using C#, .NET, and WinForms, and am new to app development.
I have written a program that uses HTML files (as a type of "form"), that will then be passed to an app, which can then be used to read/record data. I.e.
On the PC, a user creates a HTML "form"
This is loaded onto a mobile device (phone or tablet)
The user can then open the app, and access each individual (or individual copies) a HTML form to read/record data.
This is then transferred back to the PC, and stored.
Now, I'm not too concerned with the transfer between the PC/device, or the storage of the data, or any of that at this point. What I am concerned about is the ability to open/view these HTML files within a single app.
As the program has already been written using .NET and WinForms, it needs to be converted to be used on a mobile device, and I have chosen Xamarin for this purpose. However I only have limited knowledge of this package, so I am not sure if I can achieve this within a single app (i.e. without having to pass it to a separate app to view the HTML files).
So: is there an environment in Xamarin that I can use to view HTML files within my app?
Xamarin.Forms has a WebView class that you can use to display HTML content, so viewing the content is rarely an issue.
Interacting with the HTML content can sometimes be a bit tricky because of the links not conforming to what the app expects. But you can often solve these issues using the WebView.Navigating event handler that will allow you to catch and change the navigation behavior.
Xamarin.Forms's WebView relies on the native UIWebView (iOS) and WebView (Android) and Xamarin.Forms allows you to override the native Renderers. Overriding the native renderer will give you access to the native WebView with full flexibility.
You also have the possibility to completely ignore Xamarin.Forms's WebView and write your own view using native views.
It would probably be smart to test your WinForms app on iOS using Safari and on Android using Chrome as they are using the same rendering engines that will be used in respectively UIWebView (iOS) and WebView (Android)

Does Xamarin support to develop apps for Windows surface and how well?

I want to develop an app for Windows surface tablet and iOS mobile and iPad.
As I am a new user to Xamarin, when I created my first project,it shows 3 projects:-
hello.driod, hello.ios and hello.winPhone.
I have 3 questions based on this:-
How will I be able to write the same code and share for windows 8.1 and iOS?
and whenever I drag and drop the elements to the UI page, will the same elements be copied to both windows and iOS simultaneously or I got to add them seperately?
Currently I dont have a MAC to connect to my PC. Can I write the code and and there while testing it, connect it to a MAC or should it be connected during the whole process?
Please Help!
Using the same code depends on how your structure your app.
You can go the native route where you can share the bulk of your logic by containing it in a shared / PCL project (more on that here), but have platform specific code for your UI.
For example, if you have a cross platform app targeting iOS and Android you would still create the UI in a storyboard for iOS and AXML files for Android. Any code you want to "connect" to your UI would be specific to that platform as you would use the platform APIs. Any code that is not platform specific (i.e., not calling iOS or Android APIs) can go in your shared / PCL project.
Or you can choose Xamarin.Forms which adds a layer of abstraction by allowing you to write the UI in XAML once and have it work on all platforms. The advantage is increased code sharing as now your UI is also shared. The downside is to utilise platform specific features you'll need to implement DependencyService or custom renderers. Read more about Xamarin.Forms here.
As above, it depends. If you are going the native route, then no. If you are going with Xamarin.Forms, then you are using the same XAML code for the UI across platforms, but there is no drag and drop designer.
To build an iOS app you need to be connected to a Mac. You will also need to be connected to a Mac to use the iOS Designer.

Is it possible to create custom Android Wear notifications?

I have been doing lots of research trying to figure out if it is possible to create wear notifications with custom layouts over the past few months, but am struggling to find a solution.
I have tried to implement the following suggestions to no luck:
https://possiblemobile.com/2014/07/create-custom-ongoing-notification-android-wear/
http://android-wear-docs.readthedocs.org/en/latest/sync.html
Custom UI for Android Wear Notifications
Most of what I have read have instructed that in order to do this, I should create an android wear app with a data listener. The idea being the phone would send certain data to the watch (say a string) based on the type of notification it wants to send. I would disable the automatically generated wear notification. In its place, the Android Wear app listener would know what type of notification it is based on the string and display my custom pages for that notification instead.
My first problem I have run into is I have no idea how to debug code like this. Since in Android studio you can only launch the device app or the wear app, but not both at the same time.
The other question I have is, does the Android Wear app run in the background when the Device App is running? Do you have to open the Android Wear App first for the listener to be even working (if so then I guess this is not a solution to custom notifications)?
Is it actually possible to create custom layout android wear notifications?
If you want to use a custom layout for your notifications, you should create the notification on the watch, following Creating Custom Layouts. You can even make the custom notifications clickable, you can add actions that will open activities on the watch, etc.
For that, you can send a message from your phone to your watch and the listener implemented on your watch will receive it and then, create and display the notification using the correct layout corresponding to the message sent, for example.
In this case, the best way is to implement a WearableListenerService on your wearable. Its lifecycle is handled by the system which binds it only when necessary.
To debug, you install the wear app on the wear emulator or your watch, you install the mobile app on your phone and finally you connect the two following this tutorial if you're using the emulator or via bluetooth if you're using a watch (link in the tutorial).
The Android Wear app connects your phone to your watch, whether it is an emulator or not. So, in order for your message to be received, you must have connected wear and mobile via Android Wear. Then, once the connection is established, you don't necessarily need to keep it open. So yes, the Android Wear app runs in background.

Resources