[Preview] New Bootstrapped Mobile Apps for Visual Studio

PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai
edited October 2016 in General

Hi everyone!

On the Xamarin blog, we introduced new bootstrapped mobile apps to help new mobile developers get started quickly that will eventually become a part of the File->New Project experience. These cross-platform apps have several different configurations (using Xamarin and Xamarin.Forms) that include tabbed navigation, an MVVM implementation, settings, and more.

For developers building connected mobile apps, there are cloud-connected bootstrapped apps that include a preconfigured data storage layer, complete with online/offline synchronization and automatic conflict resolution, as well as built-in support for five identity providers: Facebook, Twitter, Google, Microsoft accounts, and Azure Active Directory.

We would love for you to give them a try and let us know what you think! Every community member who leaves feedback on this thread after trying out the bootstrapped apps will be eligible for a randomly-selected license for Continuous - an IDE that brings mobile development in C# and F# to the iPad.

To get started:

  1. Download the bootstrapped apps
  2. Open one of the four bootstrapped apps in Visual Studio.
  3. Optional: Configure cloud data storage and authentication.

We look forward to hearing your feedback. :)

«1

Posts

  • BerayBentesenBerayBentesen TRUniversity ✭✭✭✭

    Tested on Windows successfully.

    I think local storage and cloud storage options should be asked separately. For example; I would prefer Realm for local storage but also want Azure Active Directory for auth. There were too many required library for a new created project.

    But would be great if I could choose Project type then Cloud / Local storage options. Also compiling on Mac was not as easy as Windows.

    Good to see improvement of default project types.

  • PooranPooran INUniversity
    edited October 2016

    Would love to see Push notification boilerplate code and related (master-detail) navigation code backed-in in the bootstrap :)

  • DavidTavarezDavidTavarez DOMember ✭✭✭

    type vm:AboutViewModel not found!
    type vm:LoginViewModel not found!
    You MUST call Xamarin.Forms.Init();

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    @DavidTavarez,

    Thanks for the feedback! Seems like this is an issue in the Xamarin.Forms Previewer, does the app build and run successfully on your end?

    Thanks,
    Pierce Boggan

  • DavidTavarezDavidTavarez DOMember ✭✭✭

    Yes, it's running successfully.

    @pierce.boggan said:
    @DavidTavarez,

    Thanks for the feedback! Seems like this is an issue in the Xamarin.Forms Previewer, does the app build and run successfully on your end?

    Thanks,
    Pierce Boggan

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai
    edited October 2016

    @DavidTavarez: Great! Would you mind filing a bug for the Xamarin.Forms Previewer over on Bugzilla? It's worth keeping in mind that it's still in preview, so feedback is greatly appreciated as always. :smile:

    @BerayBentesen: Agreed - there's definitely a lot of libraries. We want to find the perfect balance of convenience in the templates (like having app settings ready to go), while still keeping dependencies down.

    Having some flexibility in terms of data storage would also be great. The one thing that's useful with the current architecture is that you just have to implement IDataStore (for any provider, local or cloud) and no changes are required elsewhere in your app.

    @Pooran: Long-term, having a very configurable File->New Project experience is the goal. You can essentially File->New based on your requirements (say tabbed navigation, social authentication, data storage, and push notifications), or go plain vanilla. Built-in support for push would be a cool config option. :smile:

  • BrettMannersBrettManners AUMember

    I help maintain a Line of business (LOB) app and have been watching the Xamarin space. It is starting to get very interesting. For us it would be better to have a layered architecture so that we could add in a windows desktop application. For the LOB world the desktop application is still king and having it supported by mobile apps would be awesome.

    cheers
    Brett

  • I downloaded the bootstrapped mobile app and got it running on VS 2015.
    Running the MasterDetail.Droid app on my Android Phone...everything works.
    I added Windows Azure Active Directory authentication and reran the app, but I do not get prompted to authenticate in the mobile app anywhere...how does the authentication piece work?

  • GVxGVx USMember ✭✭✭

    Shared project for the Xamarin Forms example.

    Is this what we should be doing? As I have always created PCL for every Xamarin Forms App I've developed and I assumed it was going to be the way going forward..

  • @BrettManners said:
    I help maintain a Line of business (LOB) app and have been watching the Xamarin space. It is starting to get very interesting. For us it would be better to have a layered architecture so that we could add in a windows desktop application. For the LOB world the desktop application is still king and having it supported by mobile apps would be awesome.

    cheers
    Brett

    @BrettManners I'm pretty sure the Universal Windows Platform (UWP) covers this requirement.
    Universal Windows Platform (UWP), is a platform-homogeneous application architecture created by Microsoft and first introduced in Windows 10. The purpose of this software platform is to help develop Universal apps that run on both Windows 10 and Windows 10 Mobile without the need to be re-written for each.
    From what I can see, these samples already provide an UWP implementation.

  • @GVx said:
    Shared project for the Xamarin Forms example.

    Is this what we should be doing? As I have always created PCL for every Xamarin Forms App I've developed and I assumed it was going to be the way going forward..

    I had the same question as you, since most examples I've seen are PCL for shared code. I don't have a clear answer, but I did find this document which provides some insight on code sharing via Shared Projects or Portable Class Libraries:
    https://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    @BrettManners - I'll look more into it. I definitely agree a "layered" architecture would help people bring existing desktop code (say, their data access layer) to mobile. Any thoughts on what you'd like to see specifically in the templates to make this as easy as possible? As @MichaelSchulz.9315 said, the UWP/Windows 10 app is included, which should help fulfill the desktop requirement (check out the Evolve App for a full example).

    @MichaelSchulz.9315 - Great question. Following the instructions listed above, first you need to configure authentication in the Azure Portal for your Azure Active Directory app. After that, go to Services\AzureDataStore and set UseAuthentication to true, and the AuthProvider to MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory. The configuration for identity is a bit tedious at this point. What do you think is the easiest way to have users add identity? Obviously, a configurable wizard that configures the client-side mobile apps and server-side settings would be easiest, but after that... probably a config file where you can put your identity provider info?

    @GVx: It's really a matter of personal preference; there wasn't a deliberate technical reason we selected Shared Projects. It's possible that these templates could have the option of either Portable Class Libraries and/or Shared Projects, like our existing templates. Longer-term, I think it probably makes sense to default to .NET Standard libraries.

  • @pierce.boggan said:
    @MichaelSchulz.9315 - Great question. Following the instructions listed above, first you need to configure authentication in the Azure Portal for your Azure Active Directory app. After that, go to Services\AzureDataStore and set UseAuthentication to true, and the AuthProvider to MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory. The configuration for identity is a bit tedious at this point. What do you think is the easiest way to have users add identity? Obviously, a configurable wizard that configures the client-side mobile apps and server-side settings would be easiest, but after that... probably a config file where you can put your identity provider info?

    @pierce.boggan thanks for the feedback...the problem is that I've done all that, and yet I still am not prompted to authenticate when I open the app on my phone...
    Azure AD config screen shots attached...

    AzureDataStore changes:

    namespace MasterDetail.Services
    {
    public class AzureDataStore : IDataStore
    {
    public bool UseAuthentication => true;
    public MobileServiceAuthenticationProvider AuthProvider => MobileServiceAuthenticationProvider.WindowsAzureActiveDirectory;

        bool isInitialized;
        IMobileServiceSyncTable<Item> itemsTable;
    

    namespace MasterDetail.MobileAppService.Controllers
    {
    [Authorize]
    public class ItemController : TableController
    {

    then I published the MasterDetail.MobileAppService.
    when the mobile app is published, a browser opens and asks for credentials...which I enter successfully...but that is not what you mean by authentication right? I'm expecting that my mobile app on the phone will prompt me for credentials.

    Now I run the MasterDetail.Droid app...
    I have no prompt to auth...just the "Browse" page with a list of items.
    Even when I add an item, there is still no auth.

    Maybe a new tab is needed on the app: "status" which shows your logged in user name.

    So what am I missing?

  • MattClayMattClay USMember
    edited October 2016

    used successfully. In fact, its pushed me to organise my data layer in a much better way.

    FYI: on iOS I needed this in the info.plist for the authentication to work

    http://stackoverflow.com/questions/31254725/transport-security-has-blocked-a-cleartext-http/32560433#32560433

  • SergioKoSergioKo FIMember

    Some minor issues with MasterDetail-Native and MasterDetail-Native-Azure samples:
    1. README.txt under Solution cannot be opened from VisualStudio.
    2. Projects are not compilable unless you manually install SQLite for Universal Windows Platform extension.
    Otherwise, all samples are very useful for Xamarin newbies like me.

  • AllisterAllister USMember ✭✭

    Fantastic sample.
    Haven't tried iOS yet, but Android and UWP both build without any additional steps for me, and UWP just ran on local machine. Love it when a sample just works.
    Sure now you've given me a pile of ideas for how I want/need to refactor things in my projects, but that's life long learning for you I guess.
    Thanks for this sample good folk.

  • BrettMannersBrettManners AUMember

    @pierce.boggan said:
    @BrettManners - I'll look more into it. I definitely agree a "layered" architecture would help people bring existing desktop code (say, their data access layer) to mobile. Any thoughts on what you'd like to see specifically in the templates to make this as easy as possible? As @MichaelSchulz.9315 said, the UWP/Windows 10 app is included, which should help fulfill the desktop requirement (check out the Evolve App for a full example).

    Pierce, in terms of what specifics might make things easier....I think a layered approach designed so that various aspects can be swapped out (eg authentication, data access layer, business layer, local cache, back-end webservice, back-end database etc). That would enable each team to use what they can and only customise what they need to. Also I know cloud is the way of the future but we are on-prem still so on-prem options will help the migration process as well.

    Our data access layer is heavily dependant of datatables/datasets and is not clearly separated so converting it to be mobile friendly is not easy. For us a better approach might be to create a new mobile architecture to sit alongside our existing one and port our business objects over one at a time. This approach lets us tackle the problem in smaller chunks and as such is more likely to succeed.

    In terms of UWP we have about 80% win10 at the main office however the offsite locations are more like only 20% win10. Due to the remote locations of the offsite PC's (offshore oil rigs) it is not feasible to upgrade the OS so they get the latest OS when the PC dies and is replaced. This means for us a desktop application is still required.

    I have to say I think there is huge potential for Xamarin.Forms. I see many spreadsheets in many businesses that hold critical data and with ever increasing coding skills in the workforce, those spreadsheets could be replaced with apps built with Xamarin.Forms. I think Xarmain.Forms could fill the space Light Switch occupied and do a better job of it.

    Cheers
    Brett

  • MattClayMattClay USMember
    edited October 2016

    I would be tempted to add a "standard" http logging handler for the mobile server client instantiation. This should help alot of debugging issues with azure. Possibly only passed on debug.

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    @MichaelSchulz.9315 - Let me give this a try and see if I can figure out what's going wrong here.

    @MattClay - Ah, yes. Thanks for the heads up on ATS. The Azure Mobile Apps authentication bits should be using https; I need to make that clearer in App.xaml.cs. I think having a logger would be useful. Sometimes it's tricky to know exactly what's happening under the hood to help debug those issues. Great feedback. :smile:

    @SergioKo - Thanks for the feedback! I'll get that README working. I also will update the Azure bits to use Azure Mobile Apps Client SDK 3.0.0+, which doesn't require you have the SQLite for Universal Windows Platform extension installed and should help reduce some friction there. :)

  • RustyDoRustyDo USMember

    I got this error when running the project inside the folder "MasterDetail-Forms":
    System.MissingMethodException: Method 'System.Security.SecurityCriticalAttribute..ctor' not found.
    This exception is thrown in the AppDelegate.cs file of the ios project.

  • JUANMREIGOSAJUANMREIGOSA USMember

    @MichaelSchulz.9315 said:

    @GVx said:
    Shared project for the Xamarin Forms example.

    Is this what we should be doing? As I have always created PCL for every Xamarin Forms App I've developed and I assumed it was going to be the way going forward..

    I had the same question as you, since most examples I've seen are PCL for shared code. I don't have a clear answer, but I did find this document which provides some insight on code sharing via Shared Projects or Portable Class Libraries:
    https://developer.xamarin.com/guides/cross-platform/application_fundamentals/building_cross_platform_applications/sharing_code_options/

    Both ways are correct I think. Whether you use share projects or PCL projects is a preference.
    But I definitely like PCLs better and I thought that was the general feeling regarding the most current standards being implemented lately.

    It would be great to get both options when this eventually makes it to Visual Studio Templates in File --> New Project.

    I've been trying to get into Xamarin development and these project Templates really help so keep them coming @pierce.boggan. Using a pattern that is common and recognizable makes picking up new frameworks so much easier.

    I really like how easy to follow the project structure is.
    Its nice that you have a BaseViewModel that contains the dataStore and the ObservableObject repetitive code.
    I don't really like the way the variable AzureNeedsSetup is configured and I haven't fully hooked up the authentication and I'm not quite sure what to do with the variable LoginParameters.
    I've seen other templates where they use enums instead of strings for the MessagingCenter.Subscribe message, kind of like the enum approach.

    In the Service project, one thing I would love anyone's help with is implementing a EntityDomainManager for an entity type that has a custom implementation of ITableData. By this I mean, I would like to use the syncing functionally provided by Microsoft.Azure.Mobile sdk but I find it very difficult to leverage with existing sql database tables that use INT or GUID id's for the System properties.

  • JustinMorrisJustinMorris USUniversity

    Hi guys-

    I have been doing all the classes for the Xamarin certification and also finding many extra tutorials to add functionality. I have completed the Authentication and Push examples which are great individually. I struggle to understand the Authentication samples because there is no integration into an existing website provider via SQL or JSON and so on...is there still a need to integrate the mobile app with an existing database of users? Let's have them use the same login to the mobile and the website... and if the email matches, then consolidate the user for both or all 6 versions of a login.

    Maybe I have missed something, if so please send a link. Otherwise, let's show how to start a new .NET Core website with login, and use that DB for the mobile app and vice versa, start a mobile service and connect a website (SQL, json, and so on...).

    I found this...but nothing on custom/website login, like you find in asp.NET websites...
    https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-xamarin-forms-get-started-users/

    Any help appreciated for a walkthrough or best practices.

  • MattClayMattClay USMember

    Are you talking about here: https://github.com/pierceboggan/learn-azure/blob/master/README.md, section 3 where the user is saved locally?

  • BrianBoalsBrianBoals USMember

    I, too, would love to see a PCL option of these templates!

    Also, it would be more helpful to demonstrate a generic AzureDataStore implementation of the IDataStore interface that can be implemented for any data store objects the developer might add. It is unrealistic that a real connected application would synchronize only one type of data.

  • in the sample it is using server side authentication.https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-xamarin-forms-get-started-users/
    I wanted use Client flow authentication which is recommended one. can you please provide any sample or library for this.

    https://azure.microsoft.com/en-us/documentation/articles/app-service-mobile-dotnet-how-to-use-client-library/#clientflow

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    Awesome feedback so far. :smile: I'm going to work on incorporating all this into a new preview of the templates soon.

    For authentication, @SomnathShukla is correct, these apps use the server-flow approach. In this approach, the OAuth flow takes place on the server, not on the mobile device. If you've ever had to login to a social provider with a webview within a mobile app, that app is using the server-flow approach. This approach is great because it supports five identity providers out of the box, they all work the same way (so we can handle token caching and refresh in a uniform way), and you don't have to be concerned as a developer about the nuances that come with managing an OAuth flow.

    That being said, the superior approach is the client-flow approach. An example of this would be social authentication that opens up the native Facebook app, rather than using a webview. This is a far superior experience for users, so it's definitely recommended in a production app. From a developer perspective, it's much more difficult. You must integrate in all of the various SDK providers' SDKs you wish to potentially authenticate with, maintain these, and manage the authentication flow.

    In light of that, the server-flow approach is great for prototyping and beginning to build a mobile app without having to deal with various SDKs and worrying too much about login. For the templates, we will likely keep the server-flow approach (even if we refactor a bit) due to the overhead of managing various SDKs and writing separate authentication flows for them. We should probably expand our documentation/samples on authentication in general to assist developers with client-flow authentication, rather than introduce overhead and complexity into the templates

    TL;DR - Server-flow authentication is easy and configurable, but an inferior authentication experience for users. Client-flow authentication is a superior experience for users, but requires much more developer interaction.

  • RustyDoRustyDo USMember

    Can someone answer my question?
    I got this error when running the project inside the folder "MasterDetail-Forms":
    System.MissingMethodException: Method 'System.Security.SecurityCriticalAttribute..ctor' not found.
    This exception is thrown in the AppDelegate.cs file of the ios project.
    What is causing this error? Help please.

  • Hi @pierce.boggan thanks for the info. actually I am building app for production so I wanted a sample with client workflow. Note I am using Xamarin Forms

  • zahikramerzahikramer ILMember ✭✭✭

    hello @pierce.boggan
    I'm looking for this few days now.
    I want to authenticate my users through MULTI Identity provider , which
    on the login page should be FEW login buttons (one for google , one for facebook, one for windows etc.)
    like this:
    c-sharpcorner.com/article/oauth-login-authenticating-with-identity-provider-in-xamarin-forms/

    But, as i see on Azure, you can setup only ONE provider and if the user is not authenticated , there is an option to redirect only to ONE provider , and i want to redirect to the app login page with all the login buttons.
    Do you have template for that? some sample to do this with Azure?
    I can use the link i provide , but i want to use Azure for that.
    Thanks and Regards

  • ajaxerajaxer AUMember ✭✭

    I had a small problem when installing as the package contains files in the obj folder for one project. These caused my system to throw errors due to the full file path exceeding that which Windows can handle.
    Might be a good idea to exclude the obj directories for all projects when making up the zip file.

  • zahikramerzahikramer ILMember ✭✭✭

    I agree @ajaxer
    It might also be good to microsoft remove that 256 limit of path size.
    Heard it's coming on the next major update to win10....

  • RustyDoRustyDo USMember

    Can someone help me with the error message above?

  • haluuhaluu USMember ✭✭
    edited November 2016

    Pierce,

    Will you add this to github so that people can do a pull request if we dare? And also see the updates?

    Thanks, look forward to seeing more updates on this template.

  • kentucker.8475kentucker.8475 USUniversity, Developer Group Leader ✭✭

    @zahikramer and @ajaxer If you have the Anniversary update windows 10 pro or greater you can enable long file names in group policy.

    http://www.onteorasoftware.com/2016/08/how-to-enable-long-file-names-in.html

  • kentucker.8475kentucker.8475 USUniversity, Developer Group Leader ✭✭

    @pierce.boggan I have never been a fan of shared projects I would love a PCL or even better a new standard library version of the projects available. I have read the entity framework core will work with standard libraries and it would be nice if this template will make it easy to get started when available

  • zahikramerzahikramer ILMember ✭✭✭

    @kentucker.8475 Thanks ken!
    But , Unfortuntally i thinks it's not enough.
    I spend some time on it, and it seems that microsoft is doing only the first step.
    Windows explorer still won't support it and othere old programs (thinks also Visual Studio)
    here:
    tenforums.com/general-support/63081-note-refs-windows-long-file-names.html

    and
    ghacks.net/2016/05/27/microsoft-260-long-path-limit/

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai

    Apologies on the delayed responses, folks! Going to work on going through this feedback and iterating on a new preview of the templates. :smile:

  • TomWalkerTomWalker CAInsider, University, Developer Group Leader ✭✭

    @pierce.boggan can you please move this project into public GitHub repo. It would be great to have MIT license for it as well. Right, it's preventing me for actually using this code for demos. Once, it's up in GitHub we can have people contributing to it. I would like to see this broken down into small packages. This way developers can pull just he pieces they need for their application.

  • PierceBogganPierceBoggan USForum Administrator, Xamarin Team, Developer Group Leader Xamurai
    edited November 2016

    @tomwalker: That's the plan! Open source it on GitHub, allow community contributions. (Was a bit tied up in Microsoft Connect, so apologies for slow responses here.)

    The packages thing is exactly in line with the vision I have for the templates. An extremely configurable, modular approach. When you create the app, select what to build the app with (Xamarin or Xamarin.Forms) and pick from the configurable options (data storage, identity, push notifications, etc.).

    Long-term, it would be nice to have deeper integration with Azure so you can spin up these services when File->Newing. I think some of the work with our "Service Capabilities" should pave the way for this.

This discussion has been closed.