Skip to main content

Android SDK Setup

To integrate AppsOnAir Android SDK into your Android native Apps with Java or Kotlin, follow the below steps

Basic Requirements for Service Usage​

Essential Setup
  • Make sure to configure the App ID properly. For additional information Getting started
  • Install or update Android Studio to its latest version.
  • Make sure that your project meets these requirements:
    • Targets API level 24 (NOUGAT) or higher
    • Uses Android 7.0 or higher
    • Android Gradle Plugin (AGP): Version 8.0.2 or higher
    • Gradle: Version 8.0 or higher
    • Uses Jetpack (AndroidX), which includes meeting these version requirements:
      • compileSdkVersion 34 or later

Add AppsOnAir AppRemark in Gradle Plugin and SDK​

Newer versions of Android Studio

When creating a new project from Android Studio Arctic Fox (or newer) the allprojects{...} is no longer added in the project level gradle, so you need to add it in settings.gradle

settings.gradle

dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
...
maven { url 'https://jitpack.io' }
}
}

Docusaurus logo

gradle.properties
android.useAndroidX = true
android.enableJetifier = true

Open Your Root build.gradle File and Add the Following​

build.gradle

allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}

Add the Following to Your dependencies Section. ​

libs.versions.toml
    [versions]
appsonairAndroidAppremark = "Tag" // latest version

[libraries]
appsonair-android-appremark = { module = "com.github.apps-on-air:AppsOnAir-Android-AppRemark", version.ref = "appsonairAndroidAppremark" }
app/build.gradle
    dependencies {
implementation (libs.appsonair.android.appremark)
}

Docusaurus logo

Sync Gradle

Make sure to press "Sync Now" on the banner that pops up after saving!

Add the AppsOnAir Initialization Code and Usage​

You can call initialization at your preference however, we recommend that you add the initialization code in Main Launcher Activity(MainActivity.java) file onCreate method as follows:

MainActivity.java
import com.appsonair.appremark.services.AppRemarkService;

public class MainActivity extends AppCompatActivity {

private ActivityMainBinding binding;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

Map<String, Object> options = new HashMap<>();
options.put("appBarTitleText", "Add Remark");

//AppRemark service Initialization with customizes and handle shakeGestureEnable with feedback status listner
AppRemarkService.initialize(
this,
true,
options,
(JSONObject response) -> {
Log.d("AppRemark", response.toString());
return Unit.INSTANCE; // Required for Unit return type
}
);
}
}
  • This method initializes the AppRemark services.
  • context: The context of the activity in which the remark service is being initialized.
  • shakeGestureEnable: A boolean value that enables or disables the shake gesture for triggering the remark screen.
  • shakeSensitivity (optional): Controls how hard the device must be shaken to trigger the remark screen. Defaults to ShakeSensitivity.MEDIUM.
  • options: A Map that allows customization of the remark screen’s UI, such as setting the app bar title or other visual elements.
  • onRemarkResponse : The listener for the feedback status when feedback is submitted, such as success or failure responses.

shakeSensitivity values​

ValueDescription
ShakeSensitivity.VERY_LOWVery hard, deliberate shake required
ShakeSensitivity.LOWFirm shake required
ShakeSensitivity.MEDIUMNormal shake (default)
ShakeSensitivity.HIGHLight shake triggers feedback
ShakeSensitivity.VERY_HIGHAny motion triggers feedback

Pass shakeSensitivity in initialize:

MainActivity.java
AppRemarkService.initialize(
this,
true,
options,
ShakeSensitivity.MEDIUM,
(JSONObject response) -> {
Log.d("AppRemark", response.toString());
return Unit.INSTANCE;
}
);

onRemarkResponse listener response​

{
"message": "Remark added successfully.",
"status": "SUCCESS"
}
FieldTypeDescriptionExample
messagestringA descriptive message providing details about the feedback submission status."Remark added successfully."
status"SUCCESS" | "FAILURE"Indicates whether the feedback submission succeeded or failed in the onRemarkResponse listener."SUCCESS"

Available keys of options for Customization

KeyDataTypeValueDescription
pageBackgroundColorString"#E8F1FF"Set page background color
appBarBackgroundColorString"#E8F1FF"Set appbar background color
appBarTitleTextString"Add Remark"Set appbar title text
appBarTitleColorString"#000000"Set appbar title color
remarkTypeLabelTextString"Remark Type"Set remark type label text
descriptionLabelTextString"Description"Set description label text
descriptionHintTextString"Add description here..."Set description hint text
descriptionMaxLengthint255Set description max length
buttonTextString"Submit"Set button text
buttonTextColorString"#FFFFFF"Set button text color
buttonBackgroundColorString"#007AFF"Set button background color
labelColorString"#000000"Set text field label color
hintColorString"#B1B1B3"Set text field hint color
inputTextColorString"#000000"Set text field input text color

Manually Open AppRemark Screen​

MainActivity.java

import com.appsonair.appremark.services.AppRemarkService;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Help to open remark screen manually
AppRemarkService.addRemark(this);
}
}
  • This method is used to manually open the remark screen, allowing users to provide feedback.
  • context: The context of the activity in which the remark service is being initialized.

Manually Add Additional Meta​

MainActivity.java

import com.appsonair.appremark.services.AppRemarkService;

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//Help to add extra data about app
Map<String, Object> options = new HashMap<>();
options.put("userId", "USER_ID");
options.put("isShake", true);

AppRemarkService.setAdditionalMetaData(options);
}
}
  • The setAdditionalMetaData method is optional and can be used to pass additional metadata in extraPayload params, such as the app version, flavors, or any other contextual information. This data is sent along with the feedback to enhance tracking and categorization, making it easier to analyze and act on user inputs effectively. If you want to use this method, follow the examples above.

Run App & Verify App Remark Services​

Run your app by using Android Studio on Android simulators or any physical device to make sure it builds correctly.

note
All submitted screenshots and feedback will be displayed on a web portal.

For more details explore the example​