Class UrlHandler
java.lang.Object
org.prebid.mobile.rendering.utils.url.UrlHandler
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classUrlHandler.Builderprovides an API to configureUrlHandlerand create it.static interfaceUrlHandler.UrlHandlerResultListenerdefines the methods thatUrlHandlercalls when handling a certain click succeeds or fails. -
Method Summary
Modifier and TypeMethodDescriptionbooleanhandleResolvedUrl(android.content.Context context, String url, List<String> trackingUrlList, boolean isFromUserAction) Performs the actual url handling by verifying that thedestinationUrlis one of the configured supportedUrlActions and then handling it accordingly.voidhandleUrl(android.content.Context context, String url, List<String> trackingUrls, boolean isFromUserAction) Follows any redirects fromdestinationUrland then handles the URL accordingly.
-
Method Details
-
handleUrl
public void handleUrl(android.content.Context context, String url, List<String> trackingUrls, boolean isFromUserAction) Follows any redirects fromdestinationUrland then handles the URL accordingly.- Parameters:
context- The activity context.url- The URL to handle.trackingUrls- Optional tracking URLs to trigger on successisFromUserAction- Whether this handling was triggered from a user interaction.
-
handleResolvedUrl
public boolean handleResolvedUrl(android.content.Context context, String url, List<String> trackingUrlList, boolean isFromUserAction) Performs the actual url handling by verifying that thedestinationUrlis one of the configured supportedUrlActions and then handling it accordingly.- Parameters:
context- The activity context.url- The URL to handle.trackingUrlList- Optional tracking URLs to trigger on successisFromUserAction- Whether this handling was triggered from a user interaction.- Returns:
- true if the given URL was successfully handled; false otherwise
-