Product
Introducing License Enforcement in Socket
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
org.mongodb:stitch-android-core
Advanced tools
The official MongoDB Stitch SDK for Android/Java.
Add the following to the build.gradle for your app module:
implementation 'org.mongodb:stitch-android-sdk:4.0.0'
This will start you off with the core SDK functionality as well as the remote MongoDB service.
For customized dependencies use the following:
implementation 'org.mongodb:stitch-android-core:4.0.0'
implementation 'org.mongodb:stitch-android-services-aws-s3:4.0.0'
implementation 'org.mongodb:stitch-android-services-aws-ses:4.0.0'
implementation 'org.mongodb:stitch-android-services-fcm:4.0.0'
implementation 'org.mongodb:stitch-android-services-http:4.0.0'
implementation 'org.mongodb:stitch-android-services-mongodb-remote:4.0.0'
implementation 'org.mongodb:stitch-android-services-twilio:4.0.0'
Add the following to the build.gradle for your module:
implementation 'org.mongodb:stitch-server-sdk:4.0.0'
This will start you off with the core SDK functionality as well as the remote MongoDB service.
For customized dependencies use the following:
implementation 'org.mongodb:stitch-server-core:4.0.0'
implementation 'org.mongodb:stitch-server-services-aws-s3:4.0.0'
implementation 'org.mongodb:stitch-server-services-aws-ses:4.0.0'
implementation 'org.mongodb:stitch-server-services-fcm:4.0.0'
implementation 'org.mongodb:stitch-server-services-http:4.0.0'
implementation 'org.mongodb:stitch-server-services-mongodb-local:4.0.0'
implementation 'org.mongodb:stitch-server-services-mongodb-remote:4.0.0'
implementation 'org.mongodb:stitch-server-services-twilio:4.0.0'
Download and install Android Studio.
Start a new Android Studio project.
In your build.gradle for your app module, add the following to your dependencies block:
implementation 'org.mongodb:stitch-android-sdk:4.0.0'
Android Studio will prompt you to sync your changes in your project; hit Sync Now.
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="stitch_client_app_id">YOUR_APP_ID</string>
</resources>
Since we enabled anonymous log in, let's log in with it; add the following anywhere in your code:
final StitchAppClient client = Stitch.getDefaultAppClient();
client.getAuth().loginWithCredential(new AnonymousCredential()).addOnCompleteListener(
new OnCompleteListener<StitchUser>() {
@Override
public void onComplete(@NonNull final Task<StitchUser> task) {
if (task.isSuccessful()) {
Log.d("myApp", String.format(
"logged in as user %s with provider %s",
task.getResult().getId(),
task.getResult().getLoggedInProviderType()));
} else {
Log.e("myApp", "failed to log in", task.getException());
}
}
});
Now run your app in Android Studio by going to run, Run 'app'. Use the Android Virtual Device you created previously
Once the app is running, open up Logcat in the bottom of Android studio and you should see the following log message:
logged in as user 5b0483778f25b978044aca76 with provider anon-user
In the case that you don't want a default initialized StitchAppClient by setting up the resource values, you can use the following code once to initialize a client for a given app id that you copied earlier:
final StitchAppClient client = Stitch.initializeAppClient("YOUR_APP_ID");
You can use the client returned there or anywhere else in your app you can use the following:
final StitchAppClient client = Stitch.getAppClient("YOUR_APP_ID");
FAQs
MongoDB Stitch Android/Java SDK - Android Core
We found that org.mongodb:stitch-android-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Ensure open-source compliance with Socket’s License Enforcement Beta. Set up your License Policy and secure your software!
Product
We're launching a new set of license analysis and compliance features for analyzing, managing, and complying with licenses across a range of supported languages and ecosystems.
Product
We're excited to introduce Socket Optimize, a powerful CLI command to secure open source dependencies with tested, optimized package overrides.