Skip to content

Files

Latest commit

ef43d1d · Dec 9, 2016

History

History
80 lines (58 loc) · 4.15 KB

app-service-mobile-android-get-started-push.md

File metadata and controls

80 lines (58 loc) · 4.15 KB
title description services documentationcenter manager editor author ms.assetid ms.service ms.workload ms.tgt_pltfrm ms.devlang ms.topic ms.date ms.author
Add push notifications to your Android app with Mobile Apps | Microsoft Docs
Learn how to use Mobile Apps to send push notifications to your Android app.
app-service\mobile
android
erikre
ysxu
9058ed6d-e871-4179-86af-0092d0ca09d3
app-service-mobile
mobile
mobile-android
java
article
10/12/2016
yuaxu

Add push notifications to your Android app

[!INCLUDE app-service-mobile-selector-get-started-push]

Overview

In this tutorial, you add push notifications to the Android quick start project so that a push notification is sent to the device every time a record is inserted.

If you do not use the downloaded quick start server project, you need the push notification extension package. For more information, see Work with the .NET backend server SDK for Azure Mobile Apps.

Prerequisites

You need the following:

  • An IDE, depending on your project's back end:

  • Android 2.3 or later, Google Repository revision 27 or later, and Google Play Services 9.0.2 or later for Firebase Cloud Messaging.

  • Complete the Android quick start.

Create a project that supports Firebase Cloud Messaging

[!INCLUDE notification-hubs-enable-firebase-cloud-messaging]

Configure a notification hub

[!INCLUDE app-service-mobile-configure-notification-hub]

Configure Azure to send push notifications

[!INCLUDE app-service-mobile-android-configure-push]

Enable push notifications for the server project

[!INCLUDE app-service-mobile-dotnet-backend-configure-push-google]

Add push notifications to your app

In this section, you update your client Android app to handle push notifications.

Verify Android SDK version

[!INCLUDE app-service-mobile-verify-android-sdk-version]

Your next step is to install Google Play services. Google Cloud Messaging has some minimum API level requirements for development and testing, which the minSdkVersion property in the manifest must conform to.

If you are testing with an older device, consult Set Up Google Play Services SDK to determine how low you can set this value, and set it appropriately.

Add Google Play services to the project

[!INCLUDE Add Play Services]

Add code

[!INCLUDE app-service-mobile-android-getting-started-with-push]

Test the app against the published mobile service

You can test the app by directly attaching an Android phone with a USB cable, or by using a virtual device in the emulator.

Next steps

Now that you completed this tutorial, consider continuing on to one of the following tutorials:

  • Add authentication to your Android app. Learn how to add authentication to the todolist quickstart project on Android using a supported identity provider.
  • Enable offline sync for your Android app. Learn how to add offline support to your app by using a Mobile Apps back end. With offline sync, users can interact with a mobile app—viewing, adding, or modifying data—even when there is no network connection.