ebook img

Learn Microsoft Visual Studio App Center: With Xamarin Forms PDF

345 Pages·2019·14.145 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Learn Microsoft Visual Studio App Center: With Xamarin Forms

Learn Microsof t Visual Studio App Center With Xamarin Forms — Sunny Mukherjee Learn Microsoft Visual Studio App Center With Xamarin Forms Sunny Mukherjee Learn Microsoft Visual Studio App Center: With Xamarin Forms Sunny Mukherjee Tampa, FL, USA ISBN-13 (pbk): 978-1-4842-4381-7 ISBN-13 (electronic): 978-1-4842-4382-4 https://doi.org/10.1007/978-1-4842-4382-4 Copyright © 2019 by Sunny Mukherjee This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or part of the material is concerned, specifically the rights of translation, reprinting, reuse of illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way, and transmission or information storage and retrieval, electronic adaptation, computer software, or by similar or dissimilar methodology now known or hereafter developed. Trademarked names, logos, and images may appear in this book. Rather than use a trademark symbol with every occurrence of a trademarked name, logo, or image we use the names, logos, and images only in an editorial fashion and to the benefit of the trademark owner, with no intention of infringement of the trademark. The use in this publication of trade names, trademarks, service marks, and similar terms, even if they are not identified as such, is not to be taken as an expression of opinion as to whether or not they are subject to proprietary rights. While the advice and information in this book are believed to be true and accurate at the date of publication, neither the authors nor the editors nor the publisher can accept any legal responsibility for any errors or omissions that may be made. The publisher makes no warranty, express or implied, with respect to the material contained herein. Managing Director, Apress Media LLC: Welmoed Spahr Acquisitions Editor: Smriti Srivastava Development Editor: Matthew Moodie Coordinating Editor: Shrikant Vishwakarma Cover designed by eStudioCalamar Cover image designed by Freepik (www.freepik.com) Distributed to the book trade worldwide by Springer Science+Business Media New York, 233 Spring Street, 6th Floor, New York, NY 10013. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail orders-ny@springer- sbm.com, or visit www.springeronline.com. Apress Media, LLC is a California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc (SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation. For information on translations, please e-mail [email protected], or visit www.apress.com/ rights-permissions. Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook versions and licenses are also available for most titles. For more information, reference our Print and eBook Bulk Sales web page at www.apress.com/bulk-sales. Any source code or other supplementary material referenced by the author in this book is available to readers on GitHub via the book's product page, located at www.apress.com/978-1-4842-4381-7. For more detailed information, please visit www.apress.com/source-code. Printed on acid-free paper Dedicated to my late father, Dr. Arup Mukherjee My father, Dr. Arup Kumar Mukherjee 12/02/1953 – 12/17/2018 I am dedicating my first book to my dear and late father, Dr. Arup Kumar Mukherjee. I started writing this book in mid-2018 as part of a bigger project. My father knew about this project from the beginning, gave me solid advice, and encouraged me from start to finish. He passed away just a day after I finished writing this book, on December 17, 2018. It will be my life-long regret that I could not tell him that I finally finished this book. And I regret that I could not give him the happiness he deserved because, to my mother and me, he left this life at a young age before he could enjoy it with us fully. I want to share a few things about my father. Naturally, every son will say that their father is the greatest. As a father, he taught me mathematics and science, fought for me whenever I ran into trouble in life, helped me win multiple spelling bee competitions at school, helped me attain full-tuition scholarships, and taught me solid principles and ethics to be a good human being later in life. But I know objectively my father is an incredible soul, not from my experience, but from the words and experiences of those he touched in his life. He started his education at the Indian Institute of Technology in Kanpur, India. He completed his studies with the highest honors while fighting for student rights. He even spoke to the Prime Minister of India, Indira Gandhi, on behalf of student welfare at IIT. He married my mother when he was only 25. He moved to the U.S. soon after. With only a few dollars in his pocket, he started our lives in Knoxville, Tennessee where he was allowed to skip his Masters and begin his Ph.D in Management Science from the University of Tennessee. Later, our family moved throughout the country and eventually settled in Pensacola, Florida. I grew up in Pensacola and saw my father’s biggest impact when he became a full professor and the Chairperson of the Management Information Systems department at the University of West Florida. He wrote several journals and research articles on topics like Management Science and Decision Support Systems. He continued the practice of his youth, that of fighting for others, by inspiring his students to stand on their own two feet, utilize their talents, and pursue their dreams. Unfortunately, both my mother and my father struggled during the last few years of his life due to his multiple health problems; my mother was his constant caretaker. He lost his ability to see and take care of himself, so he fell back on using his mind the most during this time. It was during this time also that I finished my MBA and I was brainstorming multiple ideas and projects. I shared some of those ideas with my father. He brainstormed with me, steered me in the right direction, gave me words of wisdom and constructive criticism, and helped me grow my mind. He started seeing himself within me. I would eventually go on to write my first book based on the knowledge I learned on my own in mobile development, DevOps, and cloud services. Even though I could not give him all the joy he deserved at a late age, I hope to keep his name alive in this book and in future projects to come. My late father was more than just a father. He was my mentor, my friend, and my confidant. Words cannot express how much I love him and how much I will miss his advice and his jokes. Consequently, I dedicate this book to the most intelligent, wisest, most compassionate, and most patient man I have ever known, my late father, Dr. Arup Mukherjee. Table of Contents About the Author �����������������������������������������������������������������������������������������������������xi About the Technical Reviewer �������������������������������������������������������������������������������xiii Introduction �������������������������������������������������������������������������������������������������������������xv Chapter 1: Getting Started ����������������������������������������������������������������������������������������1 HockeyApp ������������������������������������������������������������������������������������������������������������������������������������1 Xamarin �����������������������������������������������������������������������������������������������������������������������������������������2 Understanding DevOps������������������������������������������������������������������������������������������������������������������3 What Is App Center? ����������������������������������������������������������������������������������������������������������������������6 Why Is App Center the Solution? ���������������������������������������������������������������������������������������������������8 Pricing �����������������������������������������������������������������������������������������������������������������������������������������10 Market Share ������������������������������������������������������������������������������������������������������������������������������12 Account Signups �������������������������������������������������������������������������������������������������������������������������12 Visual Studio App Center �������������������������������������������������������������������������������������������������������12 Azure DevOps (Visual Studio Team Services) ������������������������������������������������������������������������13 Azure �������������������������������������������������������������������������������������������������������������������������������������14 Apple Developer ��������������������������������������������������������������������������������������������������������������������14 Giphy��������������������������������������������������������������������������������������������������������������������������������������14 Software Installations �����������������������������������������������������������������������������������������������������������������15 Git ������������������������������������������������������������������������������������������������������������������������������������������15 NodeJS ����������������������������������������������������������������������������������������������������������������������������������18 Visual Studio ��������������������������������������������������������������������������������������������������������������������������18 Xcode �������������������������������������������������������������������������������������������������������������������������������������24 Visual Studio for Mac�������������������������������������������������������������������������������������������������������������25 Android Studio �����������������������������������������������������������������������������������������������������������������������25 v Table of ConTenTs GitHub Sample Project ����������������������������������������������������������������������������������������������������������������26 Getting the Sample App ���������������������������������������������������������������������������������������������������������26 Importing the Sample App into Azure DevOps (VSTS) �����������������������������������������������������������27 Getting the App Ready �����������������������������������������������������������������������������������������������������������32 The Technologies Used in the Sample App ����������������������������������������������������������������������������33 Tips, Tricks, and Links �����������������������������������������������������������������������������������������������������������������35 Summary�������������������������������������������������������������������������������������������������������������������������������������36 Roadmap �������������������������������������������������������������������������������������������������������������������������������������37 Chapter 2: Creating Builds ��������������������������������������������������������������������������������������39 Setting Up Your Organization ������������������������������������������������������������������������������������������������������40 Adding Collaborators �������������������������������������������������������������������������������������������������������������42 Creating Your Teams ��������������������������������������������������������������������������������������������������������������45 Setting Up Your Solution Configuration Mappings ����������������������������������������������������������������������49 Setting Up More Branches on Azure DevOps ������������������������������������������������������������������������������53 Setting Up Your App to Run Locally ���������������������������������������������������������������������������������������������56 Creating Your iOS Build ���������������������������������������������������������������������������������������������������������������60 Connecting Your GitHub Project ��������������������������������������������������������������������������������������������������62 Connecting Your VSTS Project �����������������������������������������������������������������������������������������������������65 Revoking App Center Privileges from VSTS���������������������������������������������������������������������������������67 Setting Up Your iOS Build ������������������������������������������������������������������������������������������������������������68 Setting Up Your Android Build �����������������������������������������������������������������������������������������������������75 Integrating App Center from GitHub ��������������������������������������������������������������������������������������������80 Revoking App Center Privileges from GitHub ������������������������������������������������������������������������������85 Setting Up Your Notifications to Slack �����������������������������������������������������������������������������������������85 Troubleshooting ��������������������������������������������������������������������������������������������������������������������������93 Visual Studio iPhone Simulators Are Not Showing in Debug Target Combo-box ����������������������������������������������������������������������������������������������������������������������������94 Visual Studio Android Emulator Does Not Start ���������������������������������������������������������������������94 Deployment failed: Mono�AndroidTools�InstallFailedException: Failure [INSTALL_FAILED_NO_MATCHING_ABIS ��������������������������������������������������������������������������������95 vi Table of ConTenTs Xamarin�Forms Tasks Do Not Match Targets �������������������������������������������������������������������������95 Error Java�Lang�OutOfMemoryError: Failed to Allocate a 132710412 Byte Allocation with 1048576 ��������������������������������������������������������������������������������������������������������96 Ibtool Exited with Code 1 �������������������������������������������������������������������������������������������������������96 Foundation�MonoTouchException: Objective-C Exception Thrown� Name: NSInternalInconsistencyException Reason: -[UISearchBar sizeThatFits:] Does Not Support Passing Non-Finite Values ({inf, 56}) ���������������������������������������������������������96 The “DebugType” Parameter Is Not Supported by the “XamlCTask” Task �����������������������������97 Summary�������������������������������������������������������������������������������������������������������������������������������������97 Chapter 3: Setting Up Distribution ��������������������������������������������������������������������������99 Creating Distribution Groups �����������������������������������������������������������������������������������������������������100 Creating Your iOS App ID �����������������������������������������������������������������������������������������������������������104 Registering Your Apple Device ��������������������������������������������������������������������������������������������������109 Creating a Certificate Signing Request �������������������������������������������������������������������������������������111 Creating a Developer Certificate �����������������������������������������������������������������������������������������������114 Creating an iOS Provisioning Profile �����������������������������������������������������������������������������������������120 Creating an Android Keystore ���������������������������������������������������������������������������������������������������125 Registering Devices in App Center ��������������������������������������������������������������������������������������������132 Configuring iOS Build for Distribution ���������������������������������������������������������������������������������������140 Configuring the Android Build for Distribution ��������������������������������������������������������������������������146 Troubleshooting Distribution Issues ������������������������������������������������������������������������������������������152 Setting Up the QA Branch for Build Scripts �������������������������������������������������������������������������������155 Setting Variables from App Center ��������������������������������������������������������������������������������������������158 Ignoring Git Tracked Files ����������������������������������������������������������������������������������������������������158 Working with App Center Variables �������������������������������������������������������������������������������������159 Setting Up Post-Build Scripts ����������������������������������������������������������������������������������������������160 Setting Up Your Post-Clone Build Script ������������������������������������������������������������������������������161 Summary�����������������������������������������������������������������������������������������������������������������������������������168 vii Table of ConTenTs Chapter 4: Reporting Analytics and Crashes ��������������������������������������������������������169 Covering the Basics ������������������������������������������������������������������������������������������������������������������169 Adding the App Center SDK for Crashes and Analytics �������������������������������������������������������������170 Adding Custom Events ��������������������������������������������������������������������������������������������������������������173 Simulating a Test Crash ������������������������������������������������������������������������������������������������������������177 Handling Crashes ����������������������������������������������������������������������������������������������������������������������182 Using the HasCrashedInLastSessionAsync Value ����������������������������������������������������������������182 Handling the ShouldAwaitUserConfirmation Event ��������������������������������������������������������������185 Handling the SendingErrorReport Event ������������������������������������������������������������������������������189 Handling the SentErrorReport Event ������������������������������������������������������������������������������������191 Handling the FailedToSendErrorReport Event ����������������������������������������������������������������������194 Setting Up Continuous Export to Azure �������������������������������������������������������������������������������������195 Querying Data Retention Settings ���������������������������������������������������������������������������������������195 Exporting Analytics to Application Insights ��������������������������������������������������������������������������201 Setting Up Export of Crashes to Blob Storage ���������������������������������������������������������������������208 Summary�����������������������������������������������������������������������������������������������������������������������������������216 Chapter 5: Sending Push Notifications �����������������������������������������������������������������217 Introducing Push Notifications ��������������������������������������������������������������������������������������������������218 Configuring the Apple Push Notification Service ����������������������������������������������������������������������220 Configuring Firebase Cloud Messaging ������������������������������������������������������������������������������������227 Setting Up Push Notifications on Xamarin ��������������������������������������������������������������������������������233 Sending Push Notifications �������������������������������������������������������������������������������������������������������239 Handling Push Notifications ������������������������������������������������������������������������������������������������������243 Sending Silent Push Notifications ���������������������������������������������������������������������������������������������246 Defining Notification Audiences ������������������������������������������������������������������������������������������������249 Sending Custom Data ���������������������������������������������������������������������������������������������������������������251 Setting the Badge Number ��������������������������������������������������������������������������������������������������252 Playing a Sound �������������������������������������������������������������������������������������������������������������������254 viii Table of ConTenTs Full Example������������������������������������������������������������������������������������������������������������������������������256 Automating Notifications with API ���������������������������������������������������������������������������������������������266 Summary�����������������������������������������������������������������������������������������������������������������������������������270 Chapter 6: Running Tests ��������������������������������������������������������������������������������������271 Why Choose App Center for UI Testing? ������������������������������������������������������������������������������������272 Pricing ���������������������������������������������������������������������������������������������������������������������������������������273 Migration �����������������������������������������������������������������������������������������������������������������������������������275 Configuring Projects for Xamarin�UITest �����������������������������������������������������������������������������������275 Installing the Necessary NuGet Packages ���������������������������������������������������������������������������276 Setting Up Android ���������������������������������������������������������������������������������������������������������������277 Setting Up iOS ���������������������������������������������������������������������������������������������������������������������278 Installing the App Center CLI Locally �����������������������������������������������������������������������������������������281 Setting Up Device Sets in App Center ���������������������������������������������������������������������������������������281 About App Center Variables �������������������������������������������������������������������������������������������������������285 Setting Up Post-Build Scripts ����������������������������������������������������������������������������������������������������286 Saving the Access Token into an Environment Variable ������������������������������������������������������������290 Testing on a Real Device �����������������������������������������������������������������������������������������������������������291 Getting the UITest Command Template �������������������������������������������������������������������������������������292 Configuring the iOS UITest Command ���������������������������������������������������������������������������������������297 Determining the --app-path Value ���������������������������������������������������������������������������������������298 Determining --build-dir Value ����������������������������������������������������������������������������������������������298 Determining the --uitest-tools-dir Value �����������������������������������������������������������������������������300 Logging In Automatically to Run UI Tests �����������������������������������������������������������������������������301 Final iOS UITest Command ��������������������������������������������������������������������������������������������������301 Viewing Test Run Results ����������������������������������������������������������������������������������������������������304 Configuring the Android UITest Command ��������������������������������������������������������������������������������309 Determining the --app-path Value ���������������������������������������������������������������������������������������309 Running the MS Build Command �����������������������������������������������������������������������������������������310 Final Android UITest Command ��������������������������������������������������������������������������������������������311 Viewing Test Run Results ����������������������������������������������������������������������������������������������������312 ix

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.