0%

Book Description

Over 50 hands-on recipes to help you get grips with Xamarin Studio and C# programming to develop market-ready Android applications

About This Book

  • Create Android applications with C# and Xamarin
  • Reuse your Android application to develop iOS and Windows Phone applications
  • Leverage the easy-to-succeed recipes to exploit the latest Android releases and develop new applications

Who This Book Is For

If you have already developed an Android applications with Java and you now intend to use C# and Xamarin Studio's capabilities, or if you have never taken the dive into mobiles, then this book is for you. It would be helpful to have some C# experience so you follow the recipes in this book, though knowledge of Android is not required.

What You Will Learn

  • Build a GUI for your Android applications
  • Explore Android activities and understand configuration changes
  • Manage multiscreens, icons, and multimedia in your applications
  • Start and bind Android services and create notifications
  • Create beautiful applications using the camera and animations
  • Effectively couple your phone's hardware with applications
  • Integrate advertisements and select the right advertisement providers for your applications

In Detail

Multiplatform applications have taken the development world by storm. This has revolutionized the selection of the right tools for the efficient development and deployment of applications. Xamarin studio is emerging as the preferred choice among .NET/C# developers. It enables them to design cross-platform applications using their favorite language and IDE. Xamarin studio is supported by the Mac OS and Windows platforms, and you can develop your own applications for iOS, Windows, or Android with its help.

This book takes you through all the stages of application development, right from getting started with Xamarin and developing a GUI to putting up your application on the store. The recipes will help you in acquiring sufficient knowledge to go about creating applications.

Starting with introducing Xamarin studio, its underlying technologies, and the Android ecosystem, the book goes on to cover the graphical aspects of creating Android applications. Moving on, you will learn more about data management with Android services. This is followed by techniques on how to interact with the Android OS and the phone's hardware, before finally concluding with mobile advertisements and Google Play. By the end of this book, you will have discovered all the specialties related to developing Android application with Xamarin Studio.

Style and approach

This book is organized around hands-on and practical recipes that focus on the development of Android applications using C# and Xamarin. Each recipe is easy to follow to help you progress efficiently through the book.

Table of Contents

  1. Xamarin Studio for Android Programming: A C# Cookbook
    1. Table of Contents
    2. Xamarin Studio for Android Programming: A C# Cookbook
    3. Credits
    4. About the Author
    5. About the Reviewers
    6. www.PacktPub.com
      1. Support files, eBooks, discount offers, and more
        1. Why subscribe?
        2. Free access for Packt account holders
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Sections
        1. Getting ready
        2. How to do it…
        3. How it works…
        4. There's more…
        5. See also
      5. Conventions
      6. Reader feedback
      7. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Getting Started
      1. Introduction
        1. A quick tour of Visual Studio
      2. Installing the Xamarin suite
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Testing the simulator
          2. Connecting Xamarin Studio and Visual Studio to a versioning control system
          3. Using another Android SDK
        5. See also
      3. Building a Hello World App!
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Testing on a physical device
          2. Source code
        5. See also
    9. 2. Mastering the Life and Death of Android Apps
      1. Introduction
      2. Understanding Android activities
        1. How to do it...
        2. How it works...
        3. There's more...
        4. See also.
      3. Practicing the activities' lifecycles
        1. Getting ready
        2. How to do it...
        3. How it works...
          1. OnCreate
        4. There's more...
          1. Events beyond the life cycle methods
        5. See also
      4. Going through state-saving management
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    10. 3. Building a GUI
      1. Introduction
      2. The multiscreen application
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Communicating data between activities
        5. See also
      3. Using form elements
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Using rotation
        1. Getting ready
        2. How to do it...
        3. There's more...
          1. Do not restart my activities while rotating
          2. Saving states during rotation
        4. See also
      5. Adding layouts
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Customizing components
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Customizing other components
        5. See also
    11. 4. Using Android Resources
      1. Introduction
      2. Creating a SplashScreen
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Using an icon for your application
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Google Play Store icons
          2. Designing trick
        5. See also
      4. Playing a song
        1. Getting ready
        2. How to do it…
        3. How it works...
        4. There's more...
          1. Playing sound that is not stored locally
          2. Playing online audio
        5. See also
      5. Playing a movie
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    12. 5. Using On-Phone Data
      1. Introduction
      2. Storing preferences
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Share preferences
      3. Simple file reading/writing
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Write on external storage
          2. Other file types
        5. See also
      4. Serializing and deserializing objects into files
        1. Getting ready
        2. How to do it...
        3. How it works...
      5. Using the SQLite database
        1. Getting ready
        2. How to do it…
        3. How it works...
        4. There's more...
          1. LinQ
          2. Direct SQL
        5. See also
    13. 6. Populating Your GUI with Data
      1. Introduction
      2. Populating simple objects
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Labels
          2. Retrieve the text
          3. Know if the text has been modified
        5. See also
      3. Populating the datepicker
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Date manipulation
        5. See also
      4. Populating the spinner
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Populating ListView
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Fast scroll
        5. See also
      6. Creating a custom adapter
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    14. 7. Using Android Services
      1. Introduction
      2. Implementing a started service
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      3. Implementing a bound service
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      4. Send notifications from your service
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Creating a news feed service
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    15. 8. Mastering Intents – A Walkthrough
      1. Introduction
      2. Opening external applications
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Dialing a number
          2. Opening a web page
        5. See also
      3. Monitoring time
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Application monitoring
        1. Getting ready
        2. How to do it...
        3. How it works...
      5. Solving equations
        1. How to do it...
        2. How it works...
        3. See also
      6. Sending an SMS
        1. How to do it...
        2. How it works...
    16. 9. Playing with Advanced Graphics
      1. Introduction
      2. Using the camera
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Deployment failed. FastDev directory creation failed
          2. A TextureView or a subclass can only be used with hardware acceleration enabled
          3. Black screen
        5. See also
      3. Taking screenshots with the camera
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Creating animations
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Property animations
          2. Drawable animations
        5. See also
      5. Creating your own gestures
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
    17. 10. Taking Advantage of the Android Platform
      1. Introduction
      2. Mastering fragments
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Programmatically adding Fragments
          2. Adding fragments to the backstack
      3. Exploring Jelly Bean
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Ice Cream Sandwich
          2. GingerBread
        5. See also
      4. Exploring KitKat
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Integrating maps
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    18. 11. Using Hardware Interactions
      1. Introduction
      2. Beaming messages with NFC
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      3. Using the accelerometer and other sensors
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Motion sensors
          2. Position sensors
          3. Environment sensors
          4. Refresh rate of sensors
          5. Listen only when needed
        5. See also
      4. Using Bluetooth
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      5. Using GPS
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Reverse geocode address
        5. See also
    19. 12. Debugging and Testing
      1. Introduction
      2. Debugging in an emulator
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
          1. Parameterizing breakpoints
      3. Debugging on a phone
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Unit testing
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
    20. 13. Monetizing and Publishing Your Applications
      1. Introduction
      2. Creating an Ad unit
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      3. Installing the required SDKs
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      4. Integrating advertisements in your applications
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more
        5. See also
      5. Preparing your application for publishing
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. See also
      6. Publishing your application
        1. Getting ready
        2. How to do it...
        3. How it works...
        4. There's more...
        5. See also
      7. Conclusion
    21. A. Mono – The Underlying Technology
    22. Index
54.163.200.109