On This Page
Content Tokens
Overview
The Content Tokens kit allows a marketer to define a reusable and dynamic content for clients to use. Content tokens are basically dynamic tokens. It is like variables with certain values that the clients can use. It also supports localization, allowing clients to not worry on the content and just retrieve the message or values. Common applications of this are support emails and links/url’s.
To include the Content Pages kit, open the Gradle Scripts | build.gradle (Module: app)
and add the following to the
dependencies section:
implementation 'com.cheetahdigital.android:content:<version>'
Content Token Implementation
Call the ContentTokenAPI
’ getContentTokens
method
getContentTokens(ContentTokenParams contentTokenParams, boolean clearCache,
ListenerModel<BaseModel<HashMap<String, ContentToken>>,
HashMap<String, ContentToken>> listener)
Content Pages
Overview
The Content Pages kit retrieves content pages, specifically url, from the console (via Admin -> Content-> Content Pages) and displays it on the app.
UI Layout of Content Pages from HTML
Launching the Content Page Activity
To launch a Content Page, you can follow these steps:
-
Add
ContentPageActivity
to theAndroidManifest.xml
.<activity android:name="com.cheetahdigital.content.ui.contentpage.detail.ContentPageActivity" android:screenOrientation="portrait"> <intent-filter> <action android:name="${applicationId}.CONTENT_PAGE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity>
-
Before starting the
ContentPageActivity
, pass the necessary information using the following extra keys:Parameters:
IntentKey.PRIMARY_ID
- the context of the calling activity (ex. ParentActivity.this)IntentKey.CONTENT_PAGE_SCREEN_NAME
- the file name that will appear as the title of the activity.IntentKey.CONTENT_PAGE_TITLE
- the file name saved on the console.IntentKey.CONTENT_PAGE_OPEN_URL_EXTERNALLY
- allows the url link to be opened externally.IntentKey.CONTENT_PAGE_ALLOW_ZOOM
-true
to allow zooming otherwisefalse
IntentKey.CONTENT_PAGE_APPEND_STRING_TO_URL
- append this string to the retrieved urlIntentKey.CONTENT_PAGE_WRAP_CONTENT
-true
to zoom out the content when it is larger thatn the web view window, otherwisefalse
IntentKey.PRIMARY_PARAMS
-ContentPagesParams
to use forContentPagesAPI
Fully Custom UI
The ContentPagesAPI
class contains different GET
methods for querying Content Pages data. Each get
method has a corresponding refresh
method, which just removes the cached response prior to sending the actual request.
Querying Content Pages Data
getContentPages(ContentPagesParams contentPagesParams, boolean clearCache,
ListenerModel<BaseModel<ContentPages>, ContentPages> listener)
getContentPage(ContentPagesParams contentPagesParams, boolean clearCache,
ListenerModel<BaseModel<ContentPage>, ContentPage> listener)
Static Files
Overview
The Static Files kit retrieves HTML or images from the console (via Admin -> Content-> Static Files) and displays it on the application.
UI Layout of Static Files from HTML
UI Layout of Static Files from Image
Launching the StaticFileActivity
To launch a Static File, you can follow these steps:
-
Add
StaticFileActivity
to theAndroidManifest.xml
.<activity android:name="com.cheetahdigital.content.ui.staticfiles.detail.StaticFileActivity" android:screenOrientation="portrait"> <intent-filter> <action android:name="${applicationId}.STATIC_FILE" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> <activity
-
Launch
StaticFileActivity
using intent. To add more information, use the following keys as intent extras:Parameters:
IntentKey.PRIMARY_ID
- internal name of the content pageIntentKey.PRIMARY_PARAMS
-StaticFileParams
to useIntentKey.STATIC_FILE_TITLE
- title for the content page. Displayed on the toolbarIntentKey.STATIC_FILE_ALLOW_ZOOM
-true
to allow zooming otherwisefalse
IntentKey.STATIC_FILE_OPEN_URL_EXTERNALLY
-true
to open link externally otheriwse false.
Fully Custom UI
The StaticFilesAPI
contains methods to call necessary APIs to query information regarding a specific static file or to query all available static files.
Querying Static Files Data
getStaticFile(StaticFilesParams staticFilesParams, boolean clearCache,
Listener<String> listener)
getStaticFiles(StaticFilesParams staticFilesParams, boolean clearCache,
ListenerModel<BaseModel<StaticFiles>, StaticFiles> listener)