Welcome to the PassEntry Android application repository! This project is designed to showcase a simple Android application integrated with a mock HTTP API.
The application features a login page that accepts a username and password. Upon submission, the credentials are validated against the /login
endpoint of the included mock API.
Authenticated users can access the tap history page, displaying a list of pass taps retrieved from the /taps
endpoint of the mock API.
You can download the precompiled APK file of the debug version from HERE.
-
For looking at the last document code version of this project, you can generate it by
Dokka section.Also, you can see the first document version of the project on this link
Documentation. -
-
I recommend Html document type
-
I recommend to use the JAVA JDK 18 and set it in your JAVA_HOME environment. after putting it in the system needs a restart
-
Type Syntax Html ./gradlew.bat dokkaHtml Java doc ./gradlew.bat dokkaJavadoc Gfm ./gradlew.bat dokkaGfm -
app -> build -> dokka
-
-
🌐 I've hosted the mock API on an online server accessible at http://154.62.108.207:3000
. This server will be available until December 31, 2023. You can use this IP address for API integration. 🌐
Alternatively, if you prefer to run the mock API locally, execute the following command:
docker-compose up --build
This will launch the mock HTTP API, accessible at http://localhost:3000
.
Authenticate a user and generate an API token.
- Method:
POST
- URL:
/login
- Headers:
- Content-Type:
application/json
- Content-Type:
{
"username": "[email protected]",
"password": "securepass"
}
If correct credentials are provided, the response body contains an API token for use with the /taps
endpoint.
- Status Code:
200 OK
{
"api-token": "your-api-token"
}
If incorrect credentials are provided, no token is returned.
- Status Code:
401 Unauthorized
{
"error": "Unauthorized"
}
Retrieve a collection of pass tap history data.
Note: Include the bearer token returned by the /login
endpoint in the request header for successful authentication.
- Method:
GET
- URL:
/taps
- Headers:
- Authorization:
Bearer your-api-token
- Authorization:
- Status Code:
200 OK
- Body:
[
{
"tappedAt": "2023-12-22T12:34:56.789Z",
"status": "success",
"readerId": "someReaderId"
},
{
"tappedAt": "2023-12-23T12:34:56.789Z",
"status": "fail",
"readerId": "someReaderId"
}
// ... more data
]
If the authorization token is missing or invalid, no data is returned.
- Status Code:
401 Unauthorized
{
"error": "Unauthorized"
}
The PassEntry Android application is built using the following technologies and libraries:
-
Kotlin: A modern and concise programming language for Android development.
-
Hilt: A dependency injection library for Android that simplifies the process of injecting dependencies into Android components.
-
LiveData: A lifecycle-aware data holder class in Android Jetpack that allows data to be observed for changes and provides automatic updates to the UI.
-
Dokka: A documentation generation tool for Kotlin and Java that generates API documentation in various formats, including HTML and Markdown.
-
Junit: A popular unit testing framework for Java and Kotlin that provides a set of annotations and assertions for writing automated tests.
-
Mockito: A mocking framework for unit testing in Java and Kotlin that allows the creation of mock objects to simulate dependencies and behavior during testing.
-
Room: An SQLite database library for Android that provides an abstraction layer over SQLite and enables efficient database operations using annotations and generated code.
-
Moshi: A modern JSON parsing and serialization library for Kotlin and Java that makes it easy to convert JSON data to Kotlin/Java objects and vice versa.
-
Gson: Gson is a powerful JSON library that simplifies JSON parsing and serialization in Android through a flexible reflection-based approach.
-
RxJava:RxJava is a Java VM library that provides a reactive programming model for composing asynchronous and event-based programs using observable sequences.
-
Retrofit:Retrofit is a type-safe HTTP client for Android and Java, making it easier to consume RESTful web services.