Cheetah CES Docs Portal

Navigation
Home
GitHub
Email
Corporate Site


Core and UI Kit

« Back to Kits References


On this page:

Core Kit

The Cheetah Digital SDK for Android help developers connect to the Cheetah Digital Services. The Core kit handles all the network calls and contains all the base classes used in the Cheetah Digital SDK. It also has a handler for errors, location managers and other helper classes that are substantial to the SDK. The Core kit is essentially included in all the other Kits in the Cheetah Digital SDK (see Getting Started Section.)

To include the Core kit, open the Gradle Scripts | build.gradle (Module: app) and add the following to the dependencies section:

   implementation 'com.cheetahdigital.android:corekit:<version>'

Network Classes

Core Kit uses Retrofit library for network calls. It also contains the following classes:

CacheControlInterceptor - add cache control to network calls for 1 hour

HeaderRequestInterceptor - add the required headers for doing Stellar API calls

RefreshAndRetryInterceptor - automatically refreshes access token when it is already expired(error 4002 from server)

TokenRevokedInterceptor - listener for revoked token (Error 4003: when user is deactivated from console) and when access token used is invalid (Error 4001)

NoConnectionInterceptor - listener for checking network connection

NullTokenInterceptor - Interceptor to check for null or empty Access token from server

Helper Classes

AnalyticsManager - helper class for Google analytics tracking of screen

ConversionHelper - helper class for convertion objects

ErrorEventsHelper - helper class for handling error codes

ModelParserHelper - helper class for parsing model related actions

LocationTrackingHelper - helper class for accessing and modifying location related data

SharedPrefsHelper - helper class for accessing and modifying shared preferences data.

NotificationsHelper - helper class for handling notification tracking with server

Notify - class for producing soft notifications suchs as Toast, Snackbar, Alert

RatingHelper - helper class for producing rating dialog used for app rating in playstore

RestHelper - helper class for rest dynamic settings

SharedPrefsHelper - helper class for accessing and modifying preference data

Model Classes

BaseData - represents single data for Cheetah Digital API

FavoritesData - represents a single data that can be favorited for Cheetah Digital API

PaginatedListData - represents paginated list data for Cheetah Digital API

**BaseListener** - represents the callback structure used for Cheetah Digital API

Controller - contains the network configuration used for initializing Sdk instances

Listener - handles retrofit callback without using BaseModel; extends BaseListener

ListenerModel - handles retrofit callback using BaseModel; extends BaseListener

BaseGenericModel - represents JSON objects from the Cheetah Digital API.

BaseModel - store response in map format instead of Cheetah models.

Authentication - represents authentication module. It handles user authentication and device registration calls for push notifications

Message - represents authentication responses

RegistrationData - represents the data used upong signup/registration.

Settings - configuration used for sending locations

UI Kit

To allow faster development, Cheetah Digital SDK uses the Model-View-Presenter (MVP) pattern in the whole architecture. All of the Kits under the SDK follows this pattern, the base classes for the pattern can be found in the UI kit. Reusable components and widgets were also created to make development faster and easier. All other module kits included in the SDK uses the UI Kit, there is no need to import the UI Kit if importing using the Gradle version (see Getting Started Section.)

To include the UI kit, open the Gradle Scripts | build.gradle (Module: app) and add the following to the dependencies section:

   implementation 'com.cheetahdigital.android:uikit:<version>'

Runtime Permissions Helper

AccountsPermissionHelper - runtime permissionshelper class for contacts

BasePermissionHelper - base helper class for runtime permissions

CameraPermissionHelper - runtime permissions helper for camera

CameraStoragePermissionHelper - runtime permissions helper for camera and storage

ContactsPermissionHelper - runtime permissions helper for writing and reading contacts

LocationPermissionHelper - runtime permissions helper for location

StoragePermissionHelper - runtime permissions helper for external storage

Helper Classes

AttachmentPicker - helper class in getting Intents for Newsfeed Attachment (for Newsfeed Post feature)

BarcodeGenerator - helper class for barcode image generation

Countdown - helper class for counting down a number of items, can be used for doing multiple tasks and the want

CountryDecoder - decodes country picker library

DateHelper - helper class for formatting and converting Date and Calendar objects

DimensionConverter - helper class for converting dimensions from one unit to another

FontHelper - helper class for fonts

GlideHelper - Helper class for displaying Bitmaps using Glide.

ImageIntent - helper class for launching an intent to acquire an image from the Camera or Gallery.

LinkHelper - helper class for spotify or youtube links

LocationManager - helper class for creating an instance of Google Api Client

LocalBroadcastHelper - helper class for sending local broadcast on modules with registered receivers

MediaFileHelper - helper class for anything related to media

PlayServicesUtils - helper class for google play services

SaveContactHelper - helper class for saving Member data

TextHelper - helper class for transforming different texts

ThemeSelector - helper class for changing themes

TransitionHelper - helper class for activity transitioning

ViewUtils - helper class for finding ids on a view

Location Tracking Configuration

Location tracking retrieves the last known location of the user. The current latitude and longitude are sent to server. The are four permissions considered before allowing location tracking. All of these needs to be enabled or set to true.

  • App level permission - declare access fine location in the AndroidManifest file, to allow the app to access precise location. Runtime permission check should also be handled by the client app.
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
  • SDK level permission - this permission is configurable on runtime. By default, this is disabled. To enable, override the sdk_location_tracking_enabled attribute on your strings.xml.
<bool name="sdk_location_tracking_enabled">true</bool>
  • User level permission - the user can enable or disable the location tracking via app level. This is configurable in the StellarLocationTrackingHelper class by using the following methods:

    setUserPermission(Context context, boolean isEnabled) - Sets the status of user permission in the app level

    isUserPermissionEnabled(Context context) - Returns the status of user permission in the app level. By default, this is set to true.

  • Server permission - Upon login, the send_location_anonymously attribute from the authentication response is also checked if sending of location is enabled or disabled. This is only configurable on the server side.

Permissions

There are custom views and features that require you to declare app permissions on your client app. Other necessary app permissions are stated in their respective modules. Please also note that runtime permission check should be handled by the client app.

  • EmailEditText - EditText widget which allows users to see list of options to choose from, either emails or phone number.
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
  • EditText - Custom EditText that has a shake animation and vibration when error text is set.
<uses-permission android:name="android.permission.VIBRATE"/>


« Back to Kits References