Created
October 28, 2016 13:43
-
-
Save piyushgupta27/c7ca7686c3550798547da7376a614d49 to your computer and use it in GitHub Desktop.
This Gist will help you enable opening HyperTrack eta.fyi tracking links in your app.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (uri != null) { | |
try { | |
// Check if Scheme & Path for this link matches the one specified in Dashboard settings | |
if (!TextUtils.isEmpty(uri.getScheme()) | |
&& uri.getScheme().equalsIgnoreCase("<scheme_specified_in_dashboard_settings>") | |
&& !TextUtils.isEmpty(uri.getPath()) | |
&& uri.getPath().equalsIgnoreCase("<path_specified_in_dashboard_settings>")) { | |
Set<String> queryParamNames = uri.getQueryParameterNames(); | |
if (queryParamNames == null || queryParamNames.isEmpty()) { | |
// Handle Failure Intent here (Invalid DeepLink Params) | |
return; | |
} | |
for (String paramName : queryParamNames) { | |
switch (paramName) { | |
case KEY_TASK_ID: | |
try { | |
taskID = String.valueOf(uri.getQueryParameter(paramName)); | |
// Handle Successful Intent here (Use Query Params like taskID etc.) | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} | |
break; | |
} | |
} | |
} | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment