https://github.com/android/socialite
https://github.com/android/socialite
sample
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/android/socialite
- Owner: android
- License: apache-2.0
- Created: 2023-12-14T18:17:09.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-05-08T03:41:47.000Z (8 months ago)
- Last Synced: 2025-05-08T04:33:11.269Z (8 months ago)
- Topics: sample
- Language: Kotlin
- Size: 11.1 MB
- Stars: 496
- Watchers: 54
- Forks: 102
- Open Issues: 66
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# SociaLite: An Android Sample App
SociaLite demonstrates how to use various Android platform APIs to implement features that
are commonly seen in social network apps, leveraging a variety of
[Jetpack APIs](https://developer.android.com/jetpack/getting-started) to achieve complex
functionality that works reliably on more devices and requires less code. These are some of the
Jetpack APIs used:
- [Core](https://developer.android.com/jetpack/androidx/releases/core) Notifications and other platform features
- [Compose](https://developer.android.com/jetpack/androidx/releases/compose) Declarative UI generation
- [Media3](https://developer.android.com/jetpack/androidx/releases/media3) Displaying and editing photos and videos
- [CameraX](https://developer.android.com/jetpack/androidx/releases/camera) Capturing photos and videos
- [Room](https://developer.android.com/jetpack/androidx/releases/room) Persisting messages in a SQLite database
- [Window](https://developer.android.com/jetpack/androidx/releases/window) Detecting foldable device states
The app also integrates the Gemini API that powers chatbot capabilities:
- [Google AI Client SDK](https://developer.android.com/ai/google-ai-client-sdk) Generative AI with Gemini 1.5 Flash
> 🚧 **Work-in-Progress:** This sample is still in the early stage of development, and we're excited to add more features over time.
## App Overview

The main interaction in SociaLite centers around the animal avatars and their associated chat
threads. When you send a message to one of these avatars, they will respond in 5 seconds. If you
close the app within that time and you've granted notification permissions, you'll see a
notification for that reply.
Here are the screens that make up SociaLite:
- *Timeline Screen:* A vertical scrolling page of all of the photos and videos sent in chats.
- *Chat List Screen:* A list of all the chat threads with a variety of animal personalities.
- *Chat Screen:* An individual message thread where you can send text and media
messages (from the in-app camera or with a
[Photo Picker](https://developer.android.com/training/data-storage/shared/photopicker)).
- *Camera Screen:* Clicking the camera icon in the Chat Screen opens the in-app camera for taking photos and videos.
- *Video Edit Screen:* After taking a video with the in-app camera, users can do some minor edits on this screen.
- *Settings Screen:* A basic settings screen for tasks like resetting the chat history.
## How to run SociaLite
1. Clone the repository
2. Open the whole project in Android Studio.
3. Sync & Run `app` configuration
> Note: The Google AI client SDK for Android used in this code sample is
recommended for prototyping only. For non-prototyping use cases, we strongly
recommend that you use [Vertex AI for Firebase](https://firebase.google.com/docs/vertex-ai/migrate-to-vertex-ai?platform=android).
### (optional) Add Gemini API:
4. Create a Gemini API key in [Google AI studio](https://aistudio.google.com/app/apikey),
5. Add your Gemini API key as `API_KEY` to your [`local.properties`] file,
6. Sync & Run `app` configuration,
7. In the app, go to Settings and tap the "AI Chatbot" button.
## Reporting Issues
You can report an [issue with a sample](https://github.com/android/socialite/issues) using
this repository. When doing so, make sure to specify which sample you are referring to.
## Contributions
Please contribute! We will gladly review any pull requests.
Make sure to read the [Contributing](CONTRIBUTING.md) page first though.
> Note: make sure to run `./gradlew spotlessApply` before uploading a PR.
## License
```
Copyright 2023 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```