Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.B2MSolutions:reyna:'
}
dependencies {
implementation("com.github.B2MSolutions:reyna:")
}
<dependency>
<groupId>com.github.B2MSolutions</groupId>
<artifactId>reyna</artifactId>
<version></version>
</dependency>
libraryDependencies += "com.github.B2MSolutions" % "reyna" % ""
:dependencies [[com.github.B2MSolutions/reyna ""]]
An android store and forward library for http post requests. Reyna will store your requests and post them when there is a valid connection.
Reyna is a standard android library and can be referenced as a jar in your project.
If you don't want to build your own, you can download the latest version from the artifacts directory.
You will need to add the following entries into your AndroidManifest.xml in order for reyna to have the correct permissions, services and receivers.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package.my"
android:versionCode="1"
android:versionName="1.0.0.0">
<uses-sdk android:minSdkVersion="8" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<application>
<service android:name="com.b2msolutions.reyna.services.StoreService" />
<service android:name="com.b2msolutions.reyna.services.ForwardService" />
<receiver android:name="com.b2msolutions.reyna.receivers.ForwardServiceReceiver">
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
</application>
</manifest>
import com.b2msolutions.reyna.services.StoreService;
// Add any headers if required
Header[] headers = new Header[] {
new Header("Content-Type", "application/json"),
new Header("myheader", "header content"),
// gzip content when posting
new Header("Content-Encoding", "gzip")
};
// Create the message to send
Message message = new Message(
new URI("http://server.tosendmessageto.com"),
"body of post, probably JSON",
headers);
// Send the message to Reyna
StoreService.start(context, message);
// set Reyna logging level, same constant values as android.util.log (ERROR, WARN, INFO, DEBUG, VERBOSE)
StoreService.setLogLevel(level);
From the Reyna root folder
reyna/bin
you will find classes.jar, rename it according to semverPair programmed by Roy Lines and James Bloomer. Ivan Bokii and Youhana Hana.