{"action":"created","comment":{"url":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/comments/69878073","id":69878073,"diff_hunk":"@@ -0,0 +1,90 @@\n+package org.mozilla.magnet;\n+\n+import android.content.ComponentName;\n+import android.content.Context;\n+import android.content.Intent;\n+import android.content.ServiceConnection;\n+import android.os.IBinder;\n+\n+import android.util.Log;\n+\n+import com.facebook.react.bridge.Arguments;\n+import com.facebook.react.bridge.ReactApplicationContext;\n+import com.facebook.react.bridge.ReactContextBaseJavaModule;\n+import com.facebook.react.bridge.ReactMethod;\n+import com.facebook.react.bridge.WritableMap;\n+import com.facebook.react.modules.core.DeviceEventManagerModule;\n+\n+import org.mozilla.magnet.net.scanner.MagnetScannerItem;\n+\n+public class MagnetScannerReact extends ReactContextBaseJavaModule implements ScannerService.ScannerServiceCallback {\n+    String TAG = \"MagnetScannerReact\";\n+    Boolean mNeedsStarting = false;\n+    ScannerService mService;\n+    Boolean mBound = false;\n+\n+    private ServiceConnection mConnection = new ServiceConnection() {\n+\n+        @Override\n+        public void onServiceConnected(ComponentName className, IBinder service) {\n+            mBound = true;\n+            ScannerService.LocalBinder binder = (ScannerService.LocalBinder) service;\n+            mService = binder.getService();\n+            mService.addListener(MagnetScannerReact.this);\n+            if (mNeedsStarting) {\n+                start();\n+            }\n+        }\n+\n+        @Override\n+        public void onServiceDisconnected(ComponentName arg0) {\n+            mBound = false;\n+        }\n+    };\n+\n+    public MagnetScannerReact(ReactApplicationContext context) {\n+        super(context);\n+        Intent intent = new Intent(context, ScannerService.class);\n+        context.bindService(intent, mConnection, Context.BIND_AUTO_CREATE);\n+    }\n+\n+    @Override\n+    public String getName() {\n+        return TAG;\n+    }\n+\n+    @ReactMethod\n+    public void start() {\n+        if (!mBound) {\n+            mNeedsStarting = true;\n+            return;\n+        }\n+\n+        mService.start();\n+        mNeedsStarting = false;\n+    }\n+\n+    @ReactMethod\n+    public void stop() {\n+        if (!mBound) {\n+            return;\n+        }\n+\n+        mService.stop();\n+    }\n+\n+    @Override\n+    public void onItemFound(MagnetScannerItem item) {","path":"android/app/src/main/java/org/mozilla/magnet/MagnetScannerReact.java","position":77,"original_position":77,"commit_id":"5ecd4e11d244b22d489924b0cd479be8be561105","original_commit_id":"cc13b96c212180582de934aecef46b7031e0e960","user":{"login":"wilsonpage","id":1020551,"avatar_url":"https://avatars.githubusercontent.com/u/1020551?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonpage","html_url":"https://github.com/wilsonpage","followers_url":"https://api.github.com/users/wilsonpage/followers","following_url":"https://api.github.com/users/wilsonpage/following{/other_user}","gists_url":"https://api.github.com/users/wilsonpage/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonpage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonpage/subscriptions","organizations_url":"https://api.github.com/users/wilsonpage/orgs","repos_url":"https://api.github.com/users/wilsonpage/repos","events_url":"https://api.github.com/users/wilsonpage/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonpage/received_events","type":"User","site_admin":false},"body":"Should we do the telemetry in JS land where we only have to write once and already have the metrics libraries in place?","created_at":"2016-07-07T09:36:58Z","updated_at":"2016-07-07T09:36:58Z","html_url":"https://github.com/mozilla-magnet/magnet-client/pull/176#discussion_r69878073","pull_request_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/176","_links":{"self":{"href":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/comments/69878073"},"html":{"href":"https://github.com/mozilla-magnet/magnet-client/pull/176#discussion_r69878073"},"pull_request":{"href":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/176"}}},"pull_request":{"url":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/176","id":76438372,"html_url":"https://github.com/mozilla-magnet/magnet-client/pull/176","diff_url":"https://github.com/mozilla-magnet/magnet-client/pull/176.diff","patch_url":"https://github.com/mozilla-magnet/magnet-client/pull/176.patch","issue_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/issues/176","number":176,"state":"open","locked":false,"title":"Implemented Android background notifications using magnet-scanner-android","user":{"login":"wilsonpage","id":1020551,"avatar_url":"https://avatars.githubusercontent.com/u/1020551?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonpage","html_url":"https://github.com/wilsonpage","followers_url":"https://api.github.com/users/wilsonpage/followers","following_url":"https://api.github.com/users/wilsonpage/following{/other_user}","gists_url":"https://api.github.com/users/wilsonpage/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonpage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonpage/subscriptions","organizations_url":"https://api.github.com/users/wilsonpage/orgs","repos_url":"https://api.github.com/users/wilsonpage/repos","events_url":"https://api.github.com/users/wilsonpage/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonpage/received_events","type":"User","site_admin":false},"body":null,"created_at":"2016-07-06T14:09:57Z","updated_at":"2016-07-07T09:36:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3963b6122e9ded7d188042f888a4117f91dd78a8","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/176/commits","review_comments_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/176/comments","review_comment_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/issues/176/comments","statuses_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/statuses/5ecd4e11d244b22d489924b0cd479be8be561105","head":{"label":"wilsonpage:android-scanner-service","ref":"android-scanner-service","sha":"5ecd4e11d244b22d489924b0cd479be8be561105","user":{"login":"wilsonpage","id":1020551,"avatar_url":"https://avatars.githubusercontent.com/u/1020551?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonpage","html_url":"https://github.com/wilsonpage","followers_url":"https://api.github.com/users/wilsonpage/followers","following_url":"https://api.github.com/users/wilsonpage/following{/other_user}","gists_url":"https://api.github.com/users/wilsonpage/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonpage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonpage/subscriptions","organizations_url":"https://api.github.com/users/wilsonpage/orgs","repos_url":"https://api.github.com/users/wilsonpage/repos","events_url":"https://api.github.com/users/wilsonpage/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonpage/received_events","type":"User","site_admin":false},"repo":{"id":56323623,"name":"magnet-client","full_name":"wilsonpage/magnet-client","owner":{"login":"wilsonpage","id":1020551,"avatar_url":"https://avatars.githubusercontent.com/u/1020551?v=3","gravatar_id":"","url":"https://api.github.com/users/wilsonpage","html_url":"https://github.com/wilsonpage","followers_url":"https://api.github.com/users/wilsonpage/followers","following_url":"https://api.github.com/users/wilsonpage/following{/other_user}","gists_url":"https://api.github.com/users/wilsonpage/gists{/gist_id}","starred_url":"https://api.github.com/users/wilsonpage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wilsonpage/subscriptions","organizations_url":"https://api.github.com/users/wilsonpage/orgs","repos_url":"https://api.github.com/users/wilsonpage/repos","events_url":"https://api.github.com/users/wilsonpage/events{/privacy}","received_events_url":"https://api.github.com/users/wilsonpage/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wilsonpage/magnet-client","description":"","fork":true,"url":"https://api.github.com/repos/wilsonpage/magnet-client","forks_url":"https://api.github.com/repos/wilsonpage/magnet-client/forks","keys_url":"https://api.github.com/repos/wilsonpage/magnet-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wilsonpage/magnet-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wilsonpage/magnet-client/teams","hooks_url":"https://api.github.com/repos/wilsonpage/magnet-client/hooks","issue_events_url":"https://api.github.com/repos/wilsonpage/magnet-client/issues/events{/number}","events_url":"https://api.github.com/repos/wilsonpage/magnet-client/events","assignees_url":"https://api.github.com/repos/wilsonpage/magnet-client/assignees{/user}","branches_url":"https://api.github.com/repos/wilsonpage/magnet-client/branches{/branch}","tags_url":"https://api.github.com/repos/wilsonpage/magnet-client/tags","blobs_url":"https://api.github.com/repos/wilsonpage/magnet-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wilsonpage/magnet-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wilsonpage/magnet-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/wilsonpage/magnet-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wilsonpage/magnet-client/statuses/{sha}","languages_url":"https://api.github.com/repos/wilsonpage/magnet-client/languages","stargazers_url":"https://api.github.com/repos/wilsonpage/magnet-client/stargazers","contributors_url":"https://api.github.com/repos/wilsonpage/magnet-client/contributors","subscribers_url":"https://api.github.com/repos/wilsonpage/magnet-client/subscribers","subscription_url":"https://api.github.com/repos/wilsonpage/magnet-client/subscription","commits_url":"https://api.github.com/repos/wilsonpage/magnet-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/wilsonpage/magnet-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/wilsonpage/magnet-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/wilsonpage/magnet-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/wilsonpage/magnet-client/contents/{+path}","compare_url":"https://api.github.com/repos/wilsonpage/magnet-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wilsonpage/magnet-client/merges","archive_url":"https://api.github.com/repos/wilsonpage/magnet-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wilsonpage/magnet-client/downloads","issues_url":"https://api.github.com/repos/wilsonpage/magnet-client/issues{/number}","pulls_url":"https://api.github.com/repos/wilsonpage/magnet-client/pulls{/number}","milestones_url":"https://api.github.com/repos/wilsonpage/magnet-client/milestones{/number}","notifications_url":"https://api.github.com/repos/wilsonpage/magnet-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wilsonpage/magnet-client/labels{/name}","releases_url":"https://api.github.com/repos/wilsonpage/magnet-client/releases{/id}","deployments_url":"https://api.github.com/repos/wilsonpage/magnet-client/deployments","created_at":"2016-04-15T13:50:36Z","updated_at":"2016-05-11T10:38:07Z","pushed_at":"2016-07-06T16:13:56Z","git_url":"git://github.com/wilsonpage/magnet-client.git","ssh_url":"git@github.com:wilsonpage/magnet-client.git","clone_url":"https://github.com/wilsonpage/magnet-client.git","svn_url":"https://github.com/wilsonpage/magnet-client","homepage":null,"size":44260,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"mozilla-magnet:master","ref":"master","sha":"b3b59933c4df339c45098052bd751b85b143c400","user":{"login":"mozilla-magnet","id":17905978,"avatar_url":"https://avatars.githubusercontent.com/u/17905978?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-magnet","html_url":"https://github.com/mozilla-magnet","followers_url":"https://api.github.com/users/mozilla-magnet/followers","following_url":"https://api.github.com/users/mozilla-magnet/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-magnet/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-magnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-magnet/subscriptions","organizations_url":"https://api.github.com/users/mozilla-magnet/orgs","repos_url":"https://api.github.com/users/mozilla-magnet/repos","events_url":"https://api.github.com/users/mozilla-magnet/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-magnet/received_events","type":"Organization","site_admin":false},"repo":{"id":50177593,"name":"magnet-client","full_name":"mozilla-magnet/magnet-client","owner":{"login":"mozilla-magnet","id":17905978,"avatar_url":"https://avatars.githubusercontent.com/u/17905978?v=3","gravatar_id":"","url":"https://api.github.com/users/mozilla-magnet","html_url":"https://github.com/mozilla-magnet","followers_url":"https://api.github.com/users/mozilla-magnet/followers","following_url":"https://api.github.com/users/mozilla-magnet/following{/other_user}","gists_url":"https://api.github.com/users/mozilla-magnet/gists{/gist_id}","starred_url":"https://api.github.com/users/mozilla-magnet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mozilla-magnet/subscriptions","organizations_url":"https://api.github.com/users/mozilla-magnet/orgs","repos_url":"https://api.github.com/users/mozilla-magnet/repos","events_url":"https://api.github.com/users/mozilla-magnet/events{/privacy}","received_events_url":"https://api.github.com/users/mozilla-magnet/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mozilla-magnet/magnet-client","description":"A nearby content discovery client for Android & iOS","fork":false,"url":"https://api.github.com/repos/mozilla-magnet/magnet-client","forks_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/forks","keys_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/teams","hooks_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/hooks","issue_events_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/issues/events{/number}","events_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/events","assignees_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/assignees{/user}","branches_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/branches{/branch}","tags_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/tags","blobs_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/statuses/{sha}","languages_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/languages","stargazers_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/stargazers","contributors_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/contributors","subscribers_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/subscribers","subscription_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/subscription","commits_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/contents/{+path}","compare_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/merges","archive_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/downloads","issues_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/issues{/number}","pulls_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls{/number}","milestones_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/milestones{/number}","notifications_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/labels{/name}","releases_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/releases{/id}","deployments_url":"https://api.github.com/repos/mozilla-magnet/magnet-client/deployments","created_at":"2016-01-22T11:32:12Z","updated_at":"2016-06-16T14:51:20Z","pushed_at":"2016-07-07T04:00:13Z","git_url":"git://github.com/mozilla-magnet/magnet-client.git","ssh_url":"git@github.com:mozilla-magnet/magnet-client.git","clone_url":"https://github.com/mozilla-magnet/magnet-client.git","svn_url":"https://github.com/mozilla-magnet/magnet-client","homepage":"","size":45774,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":6,"mirror_url":null,"open_issues_count":51,"forks":6,"open_issues":51,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/176"},"html":{"href":"https://github.com/mozilla-magnet/magnet-client/pull/176"},"issue":{"href":"https://api.github.com/repos/mozilla-magnet/magnet-client/issues/176"},"comments":{"href":"https://api.github.com/repos/mozilla-magnet/magnet-client/issues/176/comments"},"review_comments":{"href":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/176/comments"},"review_comment":{"href":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mozilla-magnet/magnet-client/pulls/176/commits"},"statuses":{"href":"https://api.github.com/repos/mozilla-magnet/magnet-client/statuses/5ecd4e11d244b22d489924b0cd479be8be561105"}}}}
{"actor":{"display_login":"wilsonpage"}}