Added instructions in README.md file to show how devs can use latest binaries in their project.

This commit is contained in:
MohitMali 2023-08-21 18:45:05 +05:30 committed by Emmanuel Engelhart
parent 574fc630b2
commit ee1f2b4ff0
No known key found for this signature in database
GPG Key ID: 120B30D020B553D3

View File

@ -24,7 +24,29 @@ Library for accessing [libkiwix](https://github.com/kiwix/libkiwix) and [libzim]
AAR file will be generated in directory `lib/build/outputs/aar` AAR file will be generated in directory `lib/build/outputs/aar`
### Load zim file ### Use the library in your project
First, locate the compiled/generated `lib-debug.aar` in the
`lib/build/outputs/aar` directory. Then open your project's Gradle
configuration file and import the .aar file as a dependency.
If you are using Kotlin for your Gradle file, add the following code snippet:
```kotlin
dependencies {
implementation(files("path-of-aar-file/lib-debug.aar"))
}
```
If you are using Groovy for your Gradle file, use this code snippet:
```kotlin
dependencies {
implementation files("path-to-your-aar-file/lib-debug.aar")
}
```
### Load ZIM file
To load a ZIM file you need to create an `Archive` object. To load a ZIM file you need to create an `Archive` object.
@ -32,12 +54,13 @@ To load a ZIM file you need to create an `Archive` object.
val archive = Archive("your-file-path") val archive = Archive("your-file-path")
``` ```
### Load main page ### Load ZIM main page
The `mainPage` property is used to retrieve the path of the main entry page for a Kiwix content archive. The `mainPage` property is used to retrieve the path of the main entry
If the main entry is a redirect, it will fetch the path of the redirected item; page for a Kiwix content archive. If the main entry is a redirect, it
otherwise, it will return the path of the main entry itself. will fetch the path of the redirected item; otherwise, it will return
If the main entry is not found, the archive will throw an `EntryNotFoundException`. the path of the main entry itself. If the main entry is not found,
the archive will throw an `EntryNotFoundException`.
```kotlin ```kotlin
val mainPage: String? val mainPage: String?
@ -53,7 +76,7 @@ val mainPage: String?
} }
``` ```
### Load an article via title ### Load a ZIM article via title
```kotlin ```kotlin
try { try {
@ -67,7 +90,7 @@ val mainPage: String?
} }
``` ```
### Load an Article via Path ### Load a ZIM article via path
Ensure that the URL path is properly decode before passing it to `hasEntryByPath`, Ensure that the URL path is properly decode before passing it to `hasEntryByPath`,
as `Libzim` does not support encoded URLs. as `Libzim` does not support encoded URLs.