{"action":"created","comment":{"url":"https://api.github.com/repos/kdhl/collector-integration/pulls/comments/90715285","pull_request_review_id":11234331,"id":90715285,"diff_hunk":"@@ -0,0 +1,96 @@\n+/*\n+ Copyright 2016 Esri\n+\n+ Licensed under the Apache License, Version 2.0 (the \"License\");\n+ you may not use this file except in compliance with the License.\n+ You may obtain a copy of the License at\n+\n+ http://www.apache.org/licenses/LICENSE-2.0\n+\n+ Unless required by applicable law or agreed to in writing, software\n+ distributed under the License is distributed on an \"AS IS\" BASIS,\n+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+ See the License for the specific language governing permissions and\n+ limitations under the License.\n+ */\n+\n+import android.app.Activity;\n+import android.content.Context;\n+import android.content.Intent;\n+import android.content.pm.PackageManager;\n+import android.net.Uri;\n+\n+/**\n+ * <p>\n+ * Helper class to generate a Uri or to launch Collector for ArcGIS App.\n+ * </p>\n+ * Documented at <a href=\"https://github.com/ArcGIS/collector-integration#documentation\">Collector integration</a>\n+ */\n+public final class CollectorUrlSchemeUtil {\n+    private static final String COLLECTOR_URI = \"com.esri.arcgis.collector\";\n+\n+    private static final String ARCGIS_COLLECTOR_SCHEME = \"arcgis-collector\";\n+\n+    private static final String MAP_ITEM_ID = \"itemID\";\n+\n+    private static final String MAP_CENTER = \"center\";\n+\n+    private CollectorUrlSchemeUtil() {\n+    }\n+\n+    /**\n+     * Convenience method to test whether the Collector application is installed on the device or not\n+     *\n+     * @param context an application context\n+     * @return true if Collector is installed on the device, false otherwise\n+     */\n+    public static boolean isCollectorInstalled(Context context) {\n+        PackageManager pm = context.getPackageManager();\n+        try {\n+            pm.getPackageInfo(COLLECTOR_URI, PackageManager.GET_ACTIVITIES);\n+            return true;\n+        } catch (PackageManager.NameNotFoundException ignore) {\n+        }\n+\n+        return false;\n+    }\n+\n+\n+    /**\n+     * Open the specified map in Collector for ArcGIS.\n+     *\n+     * @param activity  the activity Launching Collector for ArcGIS.\n+     * @param mapItemId The web map item ID to open within Collector.\n+     * @param mapCenter Specified as a set of latitude, longitude (y,x) coordinates. Coordinates must be in WGS84 coordinates. (optional)\n+     * @throws IllegalArgumentException if the map item id passed in is null or empty\n+     */\n+    public static void openMapInCollector(Activity activity, String mapItemId, String mapCenter) {\n+        Uri uriBuilder = generateUri(mapItemId, mapCenter);\n+\n+        Intent mapIntent = new Intent(Intent.ACTION_VIEW, uriBuilder);\n+        activity.startActivity(mapIntent);\n+    }\n+\n+    /**\n+     * Generate a Uri to launch Collector for ArcGIS App.\n+     *\n+     * @param mapItemId The web map item ID to open within Collector.\n+     * @param mapCenter Specified as a set of latitude, longitude (y,x) coordinates. Coordinates must be in WGS84 coordinates. (optional)\n+     * @return A properly formatted Uri to launch Collector\n+     * @throws IllegalArgumentException if the map item id passed in is null or empty\n+     */\n+    public static Uri generateUri(String mapItemId, String mapCenter) {\n+        if (mapItemId == null || mapItemId.isEmpty()) {\n+            throw new IllegalArgumentException(\"You must pass in a valid map item id\");\n+        }\n+\n+        Uri.Builder uriBuilder = new Uri.Builder();\n+\n+        uriBuilder.scheme(ARCGIS_COLLECTOR_SCHEME);","path":"src/java/CollectorUrlSchemeUtil.java","position":89,"original_position":89,"commit_id":"2fe39e68cd3be482769c695922f541402b08534e","original_commit_id":"3a4b2fb646b67cddad03c837745e0291c2126bc3","user":{"login":"hansonchris","id":2294270,"avatar_url":"https://avatars.githubusercontent.com/u/2294270?v=3","gravatar_id":"","url":"https://api.github.com/users/hansonchris","html_url":"https://github.com/hansonchris","followers_url":"https://api.github.com/users/hansonchris/followers","following_url":"https://api.github.com/users/hansonchris/following{/other_user}","gists_url":"https://api.github.com/users/hansonchris/gists{/gist_id}","starred_url":"https://api.github.com/users/hansonchris/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hansonchris/subscriptions","organizations_url":"https://api.github.com/users/hansonchris/orgs","repos_url":"https://api.github.com/users/hansonchris/repos","events_url":"https://api.github.com/users/hansonchris/events{/privacy}","received_events_url":"https://api.github.com/users/hansonchris/received_events","type":"User","site_admin":false},"body":"I think that I may have seen an email that this was already recommended, but could you use the fluent interface here?","created_at":"2016-12-02T20:36:01Z","updated_at":"2016-12-02T20:38:11Z","html_url":"https://github.com/kdhl/collector-integration/pull/1#discussion_r90715285","pull_request_url":"https://api.github.com/repos/kdhl/collector-integration/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/kdhl/collector-integration/pulls/comments/90715285"},"html":{"href":"https://github.com/kdhl/collector-integration/pull/1#discussion_r90715285"},"pull_request":{"href":"https://api.github.com/repos/kdhl/collector-integration/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/kdhl/collector-integration/pulls/1","id":96346681,"html_url":"https://github.com/kdhl/collector-integration/pull/1","diff_url":"https://github.com/kdhl/collector-integration/pull/1.diff","patch_url":"https://github.com/kdhl/collector-integration/pull/1.patch","issue_url":"https://api.github.com/repos/kdhl/collector-integration/issues/1","number":1,"state":"open","locked":false,"title":"App integration sample code for Android","user":{"login":"pladoc","id":10661391,"avatar_url":"https://avatars.githubusercontent.com/u/10661391?v=3","gravatar_id":"","url":"https://api.github.com/users/pladoc","html_url":"https://github.com/pladoc","followers_url":"https://api.github.com/users/pladoc/followers","following_url":"https://api.github.com/users/pladoc/following{/other_user}","gists_url":"https://api.github.com/users/pladoc/gists{/gist_id}","starred_url":"https://api.github.com/users/pladoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pladoc/subscriptions","organizations_url":"https://api.github.com/users/pladoc/orgs","repos_url":"https://api.github.com/users/pladoc/repos","events_url":"https://api.github.com/users/pladoc/events{/privacy}","received_events_url":"https://api.github.com/users/pladoc/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-02T20:23:40Z","updated_at":"2016-12-02T20:38:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8782f990330680374f1f6063a229c0b490169a30","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/kdhl/collector-integration/pulls/1/commits","review_comments_url":"https://api.github.com/repos/kdhl/collector-integration/pulls/1/comments","review_comment_url":"https://api.github.com/repos/kdhl/collector-integration/pulls/comments{/number}","comments_url":"https://api.github.com/repos/kdhl/collector-integration/issues/1/comments","statuses_url":"https://api.github.com/repos/kdhl/collector-integration/statuses/2fe39e68cd3be482769c695922f541402b08534e","head":{"label":"pladoc:master","ref":"master","sha":"2fe39e68cd3be482769c695922f541402b08534e","user":{"login":"pladoc","id":10661391,"avatar_url":"https://avatars.githubusercontent.com/u/10661391?v=3","gravatar_id":"","url":"https://api.github.com/users/pladoc","html_url":"https://github.com/pladoc","followers_url":"https://api.github.com/users/pladoc/followers","following_url":"https://api.github.com/users/pladoc/following{/other_user}","gists_url":"https://api.github.com/users/pladoc/gists{/gist_id}","starred_url":"https://api.github.com/users/pladoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pladoc/subscriptions","organizations_url":"https://api.github.com/users/pladoc/orgs","repos_url":"https://api.github.com/users/pladoc/repos","events_url":"https://api.github.com/users/pladoc/events{/privacy}","received_events_url":"https://api.github.com/users/pladoc/received_events","type":"User","site_admin":false},"repo":{"id":75427274,"name":"collector-integration","full_name":"pladoc/collector-integration","owner":{"login":"pladoc","id":10661391,"avatar_url":"https://avatars.githubusercontent.com/u/10661391?v=3","gravatar_id":"","url":"https://api.github.com/users/pladoc","html_url":"https://github.com/pladoc","followers_url":"https://api.github.com/users/pladoc/followers","following_url":"https://api.github.com/users/pladoc/following{/other_user}","gists_url":"https://api.github.com/users/pladoc/gists{/gist_id}","starred_url":"https://api.github.com/users/pladoc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pladoc/subscriptions","organizations_url":"https://api.github.com/users/pladoc/orgs","repos_url":"https://api.github.com/users/pladoc/repos","events_url":"https://api.github.com/users/pladoc/events{/privacy}","received_events_url":"https://api.github.com/users/pladoc/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pladoc/collector-integration","description":"Multi Language repository that contains documentation and sample code for creating custom URL schemes in Collector for ArcGIS.","fork":true,"url":"https://api.github.com/repos/pladoc/collector-integration","forks_url":"https://api.github.com/repos/pladoc/collector-integration/forks","keys_url":"https://api.github.com/repos/pladoc/collector-integration/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pladoc/collector-integration/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pladoc/collector-integration/teams","hooks_url":"https://api.github.com/repos/pladoc/collector-integration/hooks","issue_events_url":"https://api.github.com/repos/pladoc/collector-integration/issues/events{/number}","events_url":"https://api.github.com/repos/pladoc/collector-integration/events","assignees_url":"https://api.github.com/repos/pladoc/collector-integration/assignees{/user}","branches_url":"https://api.github.com/repos/pladoc/collector-integration/branches{/branch}","tags_url":"https://api.github.com/repos/pladoc/collector-integration/tags","blobs_url":"https://api.github.com/repos/pladoc/collector-integration/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pladoc/collector-integration/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pladoc/collector-integration/git/refs{/sha}","trees_url":"https://api.github.com/repos/pladoc/collector-integration/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pladoc/collector-integration/statuses/{sha}","languages_url":"https://api.github.com/repos/pladoc/collector-integration/languages","stargazers_url":"https://api.github.com/repos/pladoc/collector-integration/stargazers","contributors_url":"https://api.github.com/repos/pladoc/collector-integration/contributors","subscribers_url":"https://api.github.com/repos/pladoc/collector-integration/subscribers","subscription_url":"https://api.github.com/repos/pladoc/collector-integration/subscription","commits_url":"https://api.github.com/repos/pladoc/collector-integration/commits{/sha}","git_commits_url":"https://api.github.com/repos/pladoc/collector-integration/git/commits{/sha}","comments_url":"https://api.github.com/repos/pladoc/collector-integration/comments{/number}","issue_comment_url":"https://api.github.com/repos/pladoc/collector-integration/issues/comments{/number}","contents_url":"https://api.github.com/repos/pladoc/collector-integration/contents/{+path}","compare_url":"https://api.github.com/repos/pladoc/collector-integration/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pladoc/collector-integration/merges","archive_url":"https://api.github.com/repos/pladoc/collector-integration/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pladoc/collector-integration/downloads","issues_url":"https://api.github.com/repos/pladoc/collector-integration/issues{/number}","pulls_url":"https://api.github.com/repos/pladoc/collector-integration/pulls{/number}","milestones_url":"https://api.github.com/repos/pladoc/collector-integration/milestones{/number}","notifications_url":"https://api.github.com/repos/pladoc/collector-integration/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pladoc/collector-integration/labels{/name}","releases_url":"https://api.github.com/repos/pladoc/collector-integration/releases{/id}","deployments_url":"https://api.github.com/repos/pladoc/collector-integration/deployments","created_at":"2016-12-02T20:10:07Z","updated_at":"2016-12-02T20:19:52Z","pushed_at":"2016-12-02T20:36:12Z","git_url":"git://github.com/pladoc/collector-integration.git","ssh_url":"git@github.com:pladoc/collector-integration.git","clone_url":"https://github.com/pladoc/collector-integration.git","svn_url":"https://github.com/pladoc/collector-integration","homepage":null,"size":35,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"kdhl:master","ref":"master","sha":"5ce4e788b2a1a3851045a109418d211bb1352a61","user":{"login":"kdhl","id":10278001,"avatar_url":"https://avatars.githubusercontent.com/u/10278001?v=3","gravatar_id":"","url":"https://api.github.com/users/kdhl","html_url":"https://github.com/kdhl","followers_url":"https://api.github.com/users/kdhl/followers","following_url":"https://api.github.com/users/kdhl/following{/other_user}","gists_url":"https://api.github.com/users/kdhl/gists{/gist_id}","starred_url":"https://api.github.com/users/kdhl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdhl/subscriptions","organizations_url":"https://api.github.com/users/kdhl/orgs","repos_url":"https://api.github.com/users/kdhl/repos","events_url":"https://api.github.com/users/kdhl/events{/privacy}","received_events_url":"https://api.github.com/users/kdhl/received_events","type":"User","site_admin":false},"repo":{"id":69253814,"name":"collector-integration","full_name":"kdhl/collector-integration","owner":{"login":"kdhl","id":10278001,"avatar_url":"https://avatars.githubusercontent.com/u/10278001?v=3","gravatar_id":"","url":"https://api.github.com/users/kdhl","html_url":"https://github.com/kdhl","followers_url":"https://api.github.com/users/kdhl/followers","following_url":"https://api.github.com/users/kdhl/following{/other_user}","gists_url":"https://api.github.com/users/kdhl/gists{/gist_id}","starred_url":"https://api.github.com/users/kdhl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kdhl/subscriptions","organizations_url":"https://api.github.com/users/kdhl/orgs","repos_url":"https://api.github.com/users/kdhl/repos","events_url":"https://api.github.com/users/kdhl/events{/privacy}","received_events_url":"https://api.github.com/users/kdhl/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kdhl/collector-integration","description":"Multi Language repository that contains documentation and sample code for creating custom URL schemes in Collector for ArcGIS.","fork":true,"url":"https://api.github.com/repos/kdhl/collector-integration","forks_url":"https://api.github.com/repos/kdhl/collector-integration/forks","keys_url":"https://api.github.com/repos/kdhl/collector-integration/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kdhl/collector-integration/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kdhl/collector-integration/teams","hooks_url":"https://api.github.com/repos/kdhl/collector-integration/hooks","issue_events_url":"https://api.github.com/repos/kdhl/collector-integration/issues/events{/number}","events_url":"https://api.github.com/repos/kdhl/collector-integration/events","assignees_url":"https://api.github.com/repos/kdhl/collector-integration/assignees{/user}","branches_url":"https://api.github.com/repos/kdhl/collector-integration/branches{/branch}","tags_url":"https://api.github.com/repos/kdhl/collector-integration/tags","blobs_url":"https://api.github.com/repos/kdhl/collector-integration/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kdhl/collector-integration/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kdhl/collector-integration/git/refs{/sha}","trees_url":"https://api.github.com/repos/kdhl/collector-integration/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kdhl/collector-integration/statuses/{sha}","languages_url":"https://api.github.com/repos/kdhl/collector-integration/languages","stargazers_url":"https://api.github.com/repos/kdhl/collector-integration/stargazers","contributors_url":"https://api.github.com/repos/kdhl/collector-integration/contributors","subscribers_url":"https://api.github.com/repos/kdhl/collector-integration/subscribers","subscription_url":"https://api.github.com/repos/kdhl/collector-integration/subscription","commits_url":"https://api.github.com/repos/kdhl/collector-integration/commits{/sha}","git_commits_url":"https://api.github.com/repos/kdhl/collector-integration/git/commits{/sha}","comments_url":"https://api.github.com/repos/kdhl/collector-integration/comments{/number}","issue_comment_url":"https://api.github.com/repos/kdhl/collector-integration/issues/comments{/number}","contents_url":"https://api.github.com/repos/kdhl/collector-integration/contents/{+path}","compare_url":"https://api.github.com/repos/kdhl/collector-integration/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kdhl/collector-integration/merges","archive_url":"https://api.github.com/repos/kdhl/collector-integration/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kdhl/collector-integration/downloads","issues_url":"https://api.github.com/repos/kdhl/collector-integration/issues{/number}","pulls_url":"https://api.github.com/repos/kdhl/collector-integration/pulls{/number}","milestones_url":"https://api.github.com/repos/kdhl/collector-integration/milestones{/number}","notifications_url":"https://api.github.com/repos/kdhl/collector-integration/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kdhl/collector-integration/labels{/name}","releases_url":"https://api.github.com/repos/kdhl/collector-integration/releases{/id}","deployments_url":"https://api.github.com/repos/kdhl/collector-integration/deployments","created_at":"2016-09-26T13:39:27Z","updated_at":"2016-09-26T13:39:28Z","pushed_at":"2016-12-02T20:36:12Z","git_url":"git://github.com/kdhl/collector-integration.git","ssh_url":"git@github.com:kdhl/collector-integration.git","clone_url":"https://github.com/kdhl/collector-integration.git","svn_url":"https://github.com/kdhl/collector-integration","homepage":null,"size":35,"stargazers_count":0,"watchers_count":0,"language":"C#","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/kdhl/collector-integration/pulls/1"},"html":{"href":"https://github.com/kdhl/collector-integration/pull/1"},"issue":{"href":"https://api.github.com/repos/kdhl/collector-integration/issues/1"},"comments":{"href":"https://api.github.com/repos/kdhl/collector-integration/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/kdhl/collector-integration/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/kdhl/collector-integration/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/kdhl/collector-integration/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/kdhl/collector-integration/statuses/2fe39e68cd3be482769c695922f541402b08534e"}}}}
{"actor":{"display_login":"hansonchris"}}