![]() |
The AppRollout Android SDK allows Android developers to easily integrate AppRollout features into their applications. This SDK helps in managing and automating app rollout processes, improving version control, and simplifying app updates.
To add the AppRollout SDK to your Android project, include the following line in your
app-level build.gradle
file under dependencies
:
implementation 'com.approllout.android-sdk:approllout-sdk:1.0.0'
Once you've added the dependency, sync your project with Gradle to download the SDK and its dependencies.
To initialize the AppRollout SDK, add the following code to your MainActivity
or
Application
class:
import com.approllout.sdk.AppRollout;
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// Initialize AppRollout SDK with your API key
AppRollout.initialize(this, "YOUR_API_KEY");
}
}
To check for app updates, use the following method:
AppRollout.checkForUpdates(new AppRollout.UpdateCallback() {
@Override
public void onUpdateAvailable(String newVersion) {
// Handle update available logic here
}
@Override
public void onUpToDate() {
// Handle app is up-to-date logic here
}
});
You can trigger an update manually like this:
AppRollout.triggerUpdate();
If an error occurs while checking for updates or managing the rollout, the SDK provides error callbacks to handle different cases. Use the following:
AppRollout.setErrorCallback(new AppRollout.ErrorCallback() {
@Override
public void onError(String errorMessage) {
// Handle error
Log.e("AppRollout", errorMessage);
}
});
import com.approllout.sdk.AppRollout;
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
// Initialize AppRollout SDK
AppRollout.initialize(this, "YOUR_API_KEY");
// Check for updates
AppRollout.checkForUpdates(new AppRollout.UpdateCallback() {
@Override
public void onUpdateAvailable(String newVersion) {
// Inform the user about the new version
Log.d("AppRollout", "New update available: " + newVersion);
}
@Override
public void onUpToDate() {
// Inform the user that the app is up to date
Log.d("AppRollout", "App is up-to-date");
}
});
}
}
For any issues or questions, please contact our support team at support@approllout.com.