Skip to content

parse-community/Parse-SDK-Android

Parse SDK for Android

Bintray License

Build Status Coverage Status

Join Chat

A library that gives you access to the powerful Parse cloud platform from your Android app. For more information about Parse and its features, see the website, blog and getting started.

Getting Started

Installation

  • Option 1: Gradle

    Add dependency to the application level build.gradle file.

    ext {
      parseVersion = "1.17.0"
    }
    dependencies {
      implementation "com.parse:parse-android:$parseVersion"
    
      // Add for push notification support -- add FCM or GCM but not both.
      implementation "com.parse:parse-fcm-android:$parseVersion" // migrate to FCM
      // implementation "com.parse:parse-gcm-android:$parseVersion" // deprecated GCM support
    
    }

    Migrating to Firebase

    If you are upgrading from a previous Parse SDK version and rely on push notifications, it is highly recommended you migrate to Firebase Cloud Messaging (FCM) since Google has announced it will be deprecated in April 2019. To migrate to FCM, you will only need to make changes to the client. No changes are needed on the Parse Server side.

    Verify you have done the following:

    • Added app to Firebase console.

    • Added the com.google.gms.google-services Gradle plugin (see setup guide)

      buildscript {
          // ...
          dependencies {
              // ...
              classpath 'com.google.gms:google-services:3.2.1' // google-services plugin
          }
      }
      
      allprojects {
          // ...
          repositories {
              // ...
              maven {
                  google() // Google's Maven repository
              }
          }
      }
    • Downloaded and added google-services.json to your app/ dir from your Firebase app.

    • Added ParseFirebaseInstanceIdService and ParseFirebaseMessagingService to your AndroidManifest.xml file (see docs)

    • Removed GcmBroadcastReceiver, PushService, com.parse.push.gcm_sender_id if upgrading from GCM.

    Assuming these major steps are done, adding the parse-fcm-android package will automatically instantiate a ParseFirebaseJobService that will register for a FCM token when the app starts. See the setup instructions below to verify that FCM registration works.

  • Option 2: Compiling for yourself into AAR file

    If you want to manually compile the SDK, begin by cloning the repository locally or retrieving the source code for a particular release. Open the project in Android Studio and run the following commands in the Terminal of Android Studio:

    ./gradlew clean build
    

    Output file can be found in Parse/build/outputs/ with extension .aar

    You can link to your project to your AAR file as you please.

Setup

Initialize Parse in a custom class that extends Application:

  import com.parse.Parse;
  import android.app.Application;

  public class App extends Application {
    @Override
    public void onCreate() {
      super.onCreate();

      // Remove for production, use to verify FCM is working
      // Look for ParseFCM: FCM registration success messages in Logcat to confirm.
      Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);

      Parse.initialize(new Parse.Configuration.Builder(this)
        .applicationId("YOUR_APP_ID")
        .clientKey("YOUR_CLIENT_KEY")
        .server("http://localhost:1337/parse/")
        .build()
      );
    }
  }

The custom Application class must be registered in AndroidManifest.xml:

<application
    android:name=".App"
    ...>
    ...
</application>

Usage

Everything can done through the supplied gradle wrapper:

Run the Tests

./gradlew clean testDebug

Results can be found in Parse/build/reports/

Get Code Coverage Reports

./gradlew clean jacocoTestReport

Results can be found in Parse/build/reports/

Snapshots

Snapshots of the development version can be obtained by using Jitpack:

Add the Maven link in your root build.gradle file:

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}					      

Add the dependency to your app/build.gradle:

dependencies {
  implementation 'com.github.parse-community:Parse-SDK-Android:master-SNAPSHOT'
}

How Do I Contribute?

We want to make contributing to this project as easy and transparent as possible. Please refer to the Contribution Guidelines.

Other Parse Projects

License

Copyright (c) 2015-present, Parse, LLC.
All rights reserved.

This source code is licensed under the BSD-style license found in the
LICENSE file in the root directory of this source tree. An additional grant
of patent rights can be found in the PATENTS file in the same directory.

As of April 5, 2017, Parse, LLC has transferred this code to the parse-community organization, and will no longer be contributing to or distributing this code.

Sponsor this project

  •  

Packages

No packages published

Contributors 58

Languages