Showing posts with label App Center. Show all posts
Showing posts with label App Center. Show all posts
Delpin Susai Raj Tuesday, 13 August 2019

Xamarin.Forms - Implement CI/CD using App Center

In this blog post, you will learn how to implement Continuous Integration(CI) and Deployment (CD) using App Center in Xamarin.Forms mobile app.


Introduction

Xamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files is most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app.

App Center 

App Center has multiple services that are most commonly used by mobile developers, where multiple services act as a single integrated product. With the use of a single integrated product, you can build, test, distribute, and monitor your mobile apps, and also implement push notifications.

Support Platforms

  • Android
  • iOS
  • React Native
  • UWP
  • Xamarin
  • macOS
  • Cordova

App Center Services

  1. Build
  2. Diagnostics (Formerly Crashes)
  3. Test
  4. Analytics
  5. Distribute
  6. Push Notifications


CI - Continuous integration is the process of merging all developers work into a single main repository.

CD - Continuous delivery is a process of automatically buid and deploying your Xamarin apps to testers, or end users.

More

https://docs.microsoft.com/en-us/appcenter/build/

Prerequisites

  • Visual Studio 2017 or later (Windows or Mac)
  • App Center Account
  • Any Git Repository

Create an app in the App Center (Android)

In this step, create an app in the App Center. Go to the following link. Now, sign in using your preferred account.

https://appcenter.ms/

Add New app

In this step, give your app name (Ex: MyApp). Select OS (Android) and Platform (Xamarin). Click Add new app.

Connect to Repository

In this step connecting your source repository. You can select which Repository you used. I'm going to select Azure Devops.

Now select your repository and working branch. Which branch you are going to build continuously. You should select. I used master branch.

Build Configuration

In this step I'm going to configure, build environment. After selecting git repository branches, You will see this window. Now you can click the setting icon in your branch.

Build

In this section you configure your app build details.

Configuration    = Release
SDK version    = select Stable sdk version
Build frequency = build this branch on every push (once you push code your remote repository it will automatically build)

Environment

In this section in your app have any environment variable you can configure here.

Sign builds

In this section, Configure signing details. Upload your Keystore file here. Check following link to get Keystore file.

https://docs.microsoft.com/en-us/xamarin/android/deploy-test/signing/keystore-signature?tabs=macos

Set keystore password here.

Distribute Builds 

In this step release your app to Store or Groups, I select groups (once my build success the apk will send selected group.

Now Save & Build.

Done. You can commit your code it will automatically build and distribute your respective group or store.

I hope you have understood how to implement Continuous Integration(CI) and Deployment (CD) using App Center in Xamarin.Forms mobile app.

Thanks for reading. Please share your comments and feedback. Happy Coding :)
Delpin Susai Raj Friday, 16 November 2018

Xamarin.Forms - Error Log in Visual Studio App Center

In this blog post, you will learn how to collect Error log Using Visual Studio App Center in Xamarin forms. 


Introduction



Xamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files is most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app.

Visual Studio App Center



App Center have multiple services, that are most commonly used by mobile developers, where multiple services are acts as a single integrated product. With the use of single integrated product you can build, test, distribute, and monitor your mobile apps, and also implement push notifications.

Support Platforms
  1. Android
  2. iOS
  3. React Native
  4. UWP
  5. Xamarin
  6. macOS
  7. Cordova

App Center Services
  • Build
  • Diagnostics (Formerly Crashes)
  • Test
  • Analytics
  • Distribute
  • Push Notifications



Errors

Errors will happens when a runtime exception occurs from an unexpected event, this errors will not terminates the app. These are the errors handled by a try/catch block. When a Error occurs, App Center will records the details of the error, then the state of the app and device are automatically generates a error log based on the records. These logs contains valuable information about the error and it will help you out to fix the error.


Prerequisites
  • Visual Studio 2017(Windows or Mac)
  • Visual Studio App Center Account
Setting up a Xamarin.Forms Project

Start by creating a new Xamarin.Forms project.  you’ll learn more by going through the steps yourself.
Choose the Xamarin.Forms App Project type under Cross-platform/App in the New Project dialog.



Name your app, select “Use Shared Library” for shared code, and target both Android and iOS.



You probably want your project and solution to use the same name as your app. Put it in your preferred folder for projects and click Create.



You now have a basic Xamarin.Forms app. Click the play button to try it out.



Create a app in App Center(iOS)

In this step, create a app in App Center. Go to the following link.

https://appcenter.ms/

Now, sign in using your preferred account.



Add New app.

In this step, give your app Name (Ex:MyApp) and description.

OS           :iOS
Platform  :Xamarin

Afterwards, click Add New app.



Now, your app center app is ready. You can use it now.



Setting up the User Interface

Go to MainPage.Xaml and write the following code.

MainPage.xaml

Click the play button to try it out.



Add AppCenter Crashes NuGet

In this step, add AppCenter Crashes to your project. You can install Microsoft.AppCenter.Crashes via NuGet, or you can browse the source code on GitHub.

Go to Solution Explorer and select your solution. Right-click and select "Manage NuGet Packages for Solution". Search "Microsoft.AppCenter.Crashes" and add Package. Remember to install it for each project (PCL, Android, iO, and UWP).



AppCenter.Crashes requires platform-specific setup

Xamarin.forms PCL

The following steps are necessary for PCL.

In the PCL project's App.xaml.cs that is launched AppCenter.Crashes must be initialized in the OnStart() method.

App.xaml.cs


iOS

The following steps are necessary for iOS.

In the iOS project's AppDelegate that is launched AppCenter.Crashes must be initialized in the FinishedLaunching() method.

AppDelegate.cs

Android

You need to create another app in App Center with os option Android.
https://appcenter.ms/

UWP

You need to create another app in App Center with os option Winodws.
https://appcenter.ms/

Error

In this step, write the following code for simple exception.

MainPage.xaml.cs

Click the play button to try it out.



Errors



Error Details



I hope you have understood how to collect Error log Using Visual Studio App Center in Xamarin.Forms.

Thanks for reading. Please share comments and feedback.
Delpin Susai Raj Wednesday, 14 November 2018

Xamarin.Forms - Crashes in Visual Studio App Center

In this blog,  you will learn how to collect Crash reports Using Visual Studio App Center in Xamarin forms. 

Introduction



Xamarin.Forms code runs on multiple platforms - each of which has its own filesystem. This means that reading and writing files is most easily done using the native file APIs on each platform. Alternatively, embedded resources are a simpler solution to distribute data files with an app.

Visual Studio App Center



App Center have multiple services, that are most commonly used by mobile developers, where multiple services are acts as a single integrated product. With the use of single integrated product you can build, test, distribute, and monitor your mobile apps, and also implement push notifications.

Support Platforms
  1. Android
  2. iOS
  3. React Native
  4. UWP
  5. Xamarin
  6. macOS
  7. Cordova



Services
  • Build
  • Diagnostics (Formerly Crashes)
  • Test
  • Analytics
  • Distribute
  • Push Notifications




Crashes

Crashes will happens when a runtime exception occurs from an unexpected event, this crashes will terminates the app. These are the errors not handled by a try/catch block. When a crash occurs, App Center will records the details of the crash, then the state of the app and device are automatically generates a crash log based on the records. These logs contains valuable information about the crash and it will help you out to fix the crash.


Prerequisites
  • Visual Studio 2017(Windows or Mac)
  • Visual Studio App Center Account
Setting up a Xamarin.Forms Project

Start by creating a new Xamarin.Forms project.  you’ll learn more by going through the steps yourself.
Choose the Xamarin.Forms App Project type under Cross-platform/App in the New Project dialog.



Name your app, select “Use Shared Library” for shared code, and target both Android and iOS.



You probably want your project and solution to use the same name as your app. Put it in your preferred folder for projects and click Create.



You now have a basic Xamarin.Forms app. Click the play button to try it out.



Create a app in App Center(iOS)

In this step, create a app in App Center. Go to the following link.

https://appcenter.ms/

Now, sign in using your preferred account.



Add New app.

In this step, give your app Name (Ex:MyApp) and description.

OS             : iOS
Platform   : Xamarin

Afterwards, click Add New app.



Now, your app center app is ready. You can use it now.



Setting up the User Interface

Go to MainPage.Xaml and write the following code.

MainPage.xaml

Click the play button to try it out.



Add AppCenter Crashes NuGet

In this step, add AppCenter Crashes to your project. You can install Microsoft.AppCenter.Crashes via NuGet, or you can browse the source code on GitHub.

Go to Solution Explorer and select your solution. Right-click and select "Manage NuGet Packages for Solution". Search "Microsoft.AppCenter.Crashes" and add Package. Remember to install it for each project (PCL, Android, iO, and UWP).



AppCenter.Crashes requires platform-specific setup

Xamarin.forms PCL

The following steps are necessary for PCL.

In the PCL project's App.xaml.cs that is launched AppCenter.Crashes must be initialized in the OnStart() method.

App.xaml.cs

iOS

The following steps are necessary for iOS.

In the iOS project's AppDelegate that is launched AppCenter.Crashes must be initialized in the FinishedLaunching() method.

AppDelegate.cs

Android

You need to create another app in App Center with os option Android.
https://appcenter.ms/

UWP

You need to create another app in App Center with os option Winodws.
https://appcenter.ms/

Crash

In this step, write the following code for simple crash.

MainPage.xaml.cs

Click the play button to try it out.



Crash Details



Crash Group Details



I hope you have understood how to collect Crash reports Using Visual Studio App Center in Xamarin.Forms.

Thanks for reading. Please share comments and feedback.