LiveLike

The LiveLike Developer Hub

Welcome to the LiveLike developer hub. You'll find comprehensive guides and documentation to help you start working with LiveLike as quickly as possible, as well as support if you get stuck. Let's jump right in!

Get Started    

Widget Configuration

Intercept Widgets

Widgets can be intercepted to add a Toast before showing the widget or delaying them until the user approve to see them.

  1. Create a WidgetInterceptor

  2. widgetWantsToShow() will be called by the SDK when a widget is ready to be shown on screen.

  3. At this time Call ShowWidget() to show the widget or dismissWidget() to dismiss it.

// Example of Widget Interceptor showing a dialog
    private val interceptor = object : WidgetInterceptor() {
            override fun widgetWantsToShow() {
                AlertDialog.Builder(context).apply {
                    setMessage("You received a Widget, what do you want to do?")
                    setPositiveButton("Show") { _, _ ->
                        showWidget() // Releases the widget
                    }
                    setNegativeButton("Dismiss") { _, _ ->
                        dismissWidget() // Discards the widget
                    }
                    create()
                }.show()
            }
        }
    
    // You just need to add it on your session instance
    session.widgetInterceptor = interceptor
// Example of Widget Interceptor showing a dialog
WidgetInterceptor interceptor =  new WidgetInterceptor() {
             @Override
             public void widgetWantsToShow(@NotNull LiveLikeWidgetEntity widgetData) {
                 new AlertDialog.Builder(context)
                     .setMessage("You received a Widget, what do you want to do?")
                     .setPositiveButton("Show", new DialogInterface.OnClickListener() {
                                 @Override
                                 public void onClick(DialogInterface dialog, int which) {
                                     showWidget(); // Releases the widget                                     
                                 }
                             })
                     .setNegativeButton("Dismiss", new DialogInterface.OnClickListener() {
                         @Override
                         public void onClick(DialogInterface dialog, int which) {
                             dismissWidget(); // Discards the widget
                         }
                     })
                     .create()
                    .show();
             }
         };

// You just need to add it on your session instance
session.setWidgetInterceptor(interceptor);

Interaction History

📘

Available on SDK version 2.17.2 and above

For many use-cases you may be interested in loading the user’s interaction history on a widget. You can do this by calling the loadInteractionHistory method on individual Widget Models.
For eg :

pollWidgetModel?.loadInteractionHistory( object : LiveLikeCallback<List<PollWidgetUserInteraction>>(){
    override fun onResponse(interactionList: List<PollWidgetUserInteraction>?, error: String?) {
    }
})
  // it will return the list of interactions of user on the widget

Incase you are using our timeline view, you can get the last user interaction on a widget by calling getUserInteraction() method on individual Widget Models
For eg :

pollWidgetModel.getUserInteraction()
// it will return the last interaction of user on the widget

Interactions for which rewards have not been claimed yet

Now, you can get all those interactions, for which rewards haven't been claimed yet.
You can do this by calling the 'getWidgetInteractionsWithUnclaimedRewards' method on content session.
For eg:

session?.getWidgetInteractionsWithUnclaimedRewards(LiveLikePagination.FIRST,
    object : LiveLikeCallback<List<PredictionWidgetUserInteraction>>() {
       override fun onResponse(
         result: List<PredictionWidgetUserInteraction>?,error: String?){
                     
                }
            })
          // it will return all the unclaimed interactions

Updated 2 months ago

Widget Configuration


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.