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);

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.