Class UrlHandler


  • public class UrlHandler
    extends java.lang.Object
    UrlHandler facilitates handling user clicks on different URLs, allowing configuration for which kinds of URLs to handle and then responding accordingly for a given URL.

    This class is designed to be instantiated for a single use by immediately calling its handleUrl(Context, String, List, boolean) method upon constructing it.

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean handleResolvedUrl​(android.content.Context context, java.lang.String url, java.util.List<java.lang.String> trackingUrlList, boolean isFromUserAction)
      Performs the actual url handling by verifying that the destinationUrl is one of the configured supported UrlActions and then handling it accordingly.
      void handleUrl​(android.content.Context context, java.lang.String url, java.util.List<java.lang.String> trackingUrls, boolean isFromUserAction)
      Follows any redirects from destinationUrl and then handles the URL accordingly.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • handleUrl

        public void handleUrl​(android.content.Context context,
                              java.lang.String url,
                              java.util.List<java.lang.String> trackingUrls,
                              boolean isFromUserAction)
        Follows any redirects from destinationUrl and then handles the URL accordingly.
        Parameters:
        context - The activity context.
        url - The URL to handle.
        isFromUserAction - Whether this handling was triggered from a user interaction.
        trackingUrls - Optional tracking URLs to trigger on success
      • handleResolvedUrl

        public boolean handleResolvedUrl​(android.content.Context context,
                                         java.lang.String url,
                                         java.util.List<java.lang.String> trackingUrlList,
                                         boolean isFromUserAction)
        Performs the actual url handling by verifying that the destinationUrl is one of the configured supported UrlActions and then handling it accordingly.
        Parameters:
        context - The activity context.
        url - The URL to handle.
        trackingUrlList - Optional tracking URLs to trigger on success
        isFromUserAction - Whether this handling was triggered from a user interaction.
        Returns:
        true if the given URL was successfully handled; false otherwise