Display a Liveblog
For displaying Liveblogs you need to add the TickarooSDKReadModule
and there are a few more options for the Builder
:
builder
.addModule(new TickarooSDKReadModule())
.setScoreboardImageMode(ScoreboardImageMode.ScoreboardImageModeOwner)
.setRefreshBehaviour(RefreshBehaviour.RefreshAuto)
.setAdProvider(new SampleAdProvider())
- refreshBehaviour
RefreshBehaviour.RefreshAuto
automated reload every 30 secondsRefreshBehaviour.RefreshUser
no automated reload. User has to press the refresh button or swipe down (pull to refresh)
- scoreboardImageMode
ScoreboardImageMode.ScoreboardImageModeOwner
image of organization or user in scorboard
ScoreboardImageMode.ScoreboardImageModeNone
no image
- SampleAdProvider: see How can custom Ads be displayed?
To initialize and display a Liveblog you have to create a TickerRef
, assign a tickerId and request an Intent from the SDK to present it in your app. When the Intent is ready, the TickarooSDKRefCallback
you provided will be called. If something goes wrong, the callback will be called with null
.
TickerRef tickerRef = new TickerRef();
tickerRef.setTickerId(…);
TickarooSDK.requestIntentForRef(SampleActivity.this, tickerRef, new TickarooSDKRefCallback() {
@Override
public void callback(@Nullable Intent intent) {
if (intent != null) {
startActivity(intent);
}
}
});
Relevant properties of the TickerRef
The following properties are used
Required
tickerId
The id of the Liveblog
Optional
limit
Limit the number of events per request, default 15loadMoreLimit
Limit the number of events per load more request, default 15eventLocalId
The deep linked event local idtagFilter
Comma separated list of tag ids to filtershowScoreboard
Indicates whether to include the scoreboeard in the screen, default trueshowMatches
Indicates whether to includes matches if any, default trueshowEvents
Indicates whether to include events in the screen, default trueshowLineup
Indicates whether to include the lineup in the screen, default trueshowEventMeta
Indicates whether to include reporter information in events, default “off”
Styling
fonts
the following fonts can be configured
<string name="tickaroo_font_family_medium" translatable="false">sans-serif-light</string>
<string name="tickaroo_font_family_light" translatable="false">sans-serif-light</string>
<string name="tickaroo_font_family_black" translatable="false">sans-serif-light</string>
<string name="tickaroo_font_family_regular" translatable="false">sans-serif-light</string>
<string name="tickaroo_font_file_live" translatable="false">Mono Test Font.ttf</string>
colors
the following colors can be configured
<color name="tickaroo_window_background">#f3f4f9</color>
<color name="tickaroo_primary_color">#234567</color>
<color name="tickaroo_primary_color_dark">#456789</color>
<color name="tickaroo_accent_color">#765432</color>
<color name="tickaroo_accent_color_dark">#98765432</color>
toolbar background gradient and scoreboard
- toolbar gradient colors
<color name="tickaroo_gradient_start">#000000</color>
<color name="tickaroo_gradient_end">#FFFFFF</color>
- scorboard toolbar height
<dimen name="tickaroo_scoreboard_toolbar_height">0dp</dimen>
- scoreboard margin to the left
<dimen name="tickaroo_scoreboard_margin_left">12dp</dimen>
- scoreboard background color
<color name="tickaroo_scoreboard_background">#D3D3D3</color>
row
- window background color
<color name="tickaroo_window_background">#f3f4f9</color>
- card background color
<color name="tickaroo_card_background">#FFFFFF</color>
- margin left
<dimen name="tickaroo_row_margin_left">14dp</dimen>
- additional
<dimen name="tickaroo_round_corners_radius">0dp</dimen>
<dimen name="tickaroo_round_corners_background_radius">0dp</dimen>
- color of the highlight line
<color name="tickaroo_event_highlight_color">#123456</color>
Hint: to disable the card style set tickaroo_window_background
and tickaroo_card_background
to the same color
milestone row
- text size
<dimen name="tickaroo_text_size_milestone">18sp</dimen>
- arrow visible
<bool name="tickaroo_milestone_arrow_visible">true</bool>
spacer row
Spacer rows are inserted after each configured row element.
- padding top
<dimen name="tickaroo_spacer_padding_top">50dp</dimen>
- padding bottom
dimen name="tickaroo_spacer_padding_bottom">80dp</dimen>
-
color of the line
<color name="tickaroo_spacer_color">#FF0000</color>
-
spacer rows are enabled with this settings
<bool name="tickaroo_spacer_after_milestone_row">false</bool>
<bool name="tickaroo_spacer_after_event_row">true</bool>
<bool name="tickaroo_spacer_after_ad_row">false</bool>
<bool name="tickaroo_spacer_after_section_headline_row">false</bool>
<bool name="tickaroo_spacer_after_button_row">false</bool>
<bool name="tickaroo_spacer_after_load_prev_row">false</bool>
<bool name="tickaroo_spacer_after_load_next_row">false</bool>
<bool name="tickaroo_spacer_after_team_game_highlight_row">false</bool>
<bool name="tickaroo_spacer_after_lineup_row">false</bool>
Handling of Links
If necessary, the application handle all links to websites or social media itself.
TickarooSDKDelegate.navigateToRef()
gets called when a ref was clicked
ref
to be handledcontext
Calling Context, typically but not necessarily derived from Activity.
return true if ref
was handled by the app, false if it should be handled by the SDK. Default implementation returns false.
A UrlRef
can be typically handled by the application itself.
url
the url
Tracking
class SampleDelegate extends TickarooSDKDelegate {
private String TAG = "SDK SAMPLE";
@Override
public void trackView(@NotNull String view, @NotNull LoadingType type, @Nullable Map<String, Object> userInfos) {
Log.d(TAG, "View Tracked: $view, $type, $userInfos");
}
@Override
public void trackEvent(@NotNull String category, @NotNull String action) {
Log.d(TAG, "Event Tracked: $category, $action");
}
@Override
public void didTrackEvent(@NotNull IEvent event) {
Log.d(TAG, "Did track Event: " + event.get_type());
}
@Override
public boolean navigateToRef(@NotNull IAbstractRef ref, @NotNull Context context) {
Log.d(TAG, "Navigated to Ref: " + ref.get_type());
return super.navigateToRef(ref, context);
}
}
trackView()
is called when a screen appeared
view
canonical name of the screentype
the way the screen was loadeduserInfos
additional information about the screen, including user specific trackingTikUserTrackingInfo
didTrackEvent()
gets called when an IEvent
was tracked
event
the tracked event
Sample tracking output:
SDK SAMPLE: View Tracked: /android/TickerRead, TYPE_LOAD, {userTrackInfo1=value 58e3b1ebf7596cf6cfae69c1, identifier=58e3b1ebf7596cf6cfae69c1, info=null}
SDK SAMPLE: Did track Event: Tik::ApiModel::Analytics::TickerLoadEvent
SDK SAMPLE: Navigated to Ref: Tik::ApiModel::MediaSlideshowRef
SDK SAMPLE: Did track Event: Tik::ApiModel::Analytics::MediaViewEvent
SDK SAMPLE: View Tracked: /android/Slideshow, TYPE_LOAD, {info=}
SDK SAMPLE: View Tracked: /android/TickerRead, TYPE_LOAD, {userTrackInfo1=value 58e3b1ebf7596cf6cfae69c1, identifier=58e3b1ebf7596cf6cfae69c1, info=null}
SDK SAMPLE: Did track Event: Tik::ApiModel::Analytics::TickerLoadEvent
SDK SAMPLE: View Tracked: /android/TickerRead, TYPE_REFRESH, {identifier=58e3b1ebf7596cf6cfae69c1}
SDK SAMPLE: Did track Event: Tik::ApiModel::Analytics::TickerLoadEvent
Userspecific Tracking Data
To receive user specific tracking data a list of TikUserTrackingInfo
can be passed when calling requestIntentForRef
ArrayList<TikUserTrackingInfo> userTrackInfos = new ArrayList<>();
userTrackInfos.add(new TikUserTrackingInfo("userTrackInfo1", "value track id"));
TickarooSDK.requestIntentForRef(SampleActivity.this, tickerRef, userTrackInfos, new TickarooSDKRefCallback() {…});
These TikUserTrackingInfo
are returned each time a trackView
occures
How can custom Ads be displayed?
To display custom ads in a liveblog you can set the TickarooSDKAdProvider
when initalizing the SDK.
builder.
.setAdProvider(new SampleAdProvider())
Your TickarooSDKAdProvider
gets called when an ad is displayed. You can use the parent
to inflate your custom view in it. Please do not add the view to the parent (leave the last parameter on .inflate to false) – this is done in the SDK itself.
To handle click events you need to set an onClickListener on the parent
. OnClickListeners inside of the View will not work.
class SampleAdProvider implements TickarooSDKAdProvider {
@NotNull
@Override
public View provideAdRow(@NotNull final ViewGroup parent, @NotNull IAdRow row, int position) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.ad_row_sample, parent, false);
//view.tickaroo_ad_row_example_text1.text = "AdRow position – ${position}"
//view.tickaroo_ad_row_example_text2.text = "${row.placementId}"
parent.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) {
Toast.makeText(parent.getContext(), "Clicked", Toast.LENGTH_LONG).show();
});
return view;
}
}