{"action":"created","comment":{"url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/comments/91165261","pull_request_review_id":11674798,"id":91165261,"diff_hunk":"@@ -0,0 +1,139 @@\n+package net.serkanbal.myapplication;\n+\n+import android.app.job.JobInfo;\n+import android.app.job.JobScheduler;\n+import android.content.BroadcastReceiver;\n+import android.content.ComponentName;\n+import android.content.Context;\n+import android.content.Intent;\n+import android.content.IntentFilter;\n+import android.os.Bundle;\n+import android.support.v4.content.LocalBroadcastManager;\n+import android.support.v7.app.AppCompatActivity;\n+import android.util.Log;\n+import android.widget.TextView;\n+\n+public class MainActivity extends AppCompatActivity {\n+    TextView mJob1Before, mJob1After, mJob2Before, mJob2After, mJob3Before, mJob3After;\n+    BroadcastReceiver mReceiver, mReceiver2, mReceiver3;\n+    Integer mFirstNumber = 0, mSecondNumber = 0;\n+    String mFirstDate = \"\", mSecondDate = \"\", mFirstToken = \"\", mSecondToken = \"\";\n+    public static final int FIRST_JOB_ID = 1;\n+    public static final int SECOND_JOB_ID = 2;\n+    public static final int THIRD_JOB_ID = 3;\n+\n+    @Override\n+    protected void onCreate(Bundle savedInstanceState) {\n+        super.onCreate(savedInstanceState);\n+        setContentView(R.layout.activity_main);\n+\n+        mJob1Before = (TextView) findViewById(R.id.job1_before);\n+        mJob1After = (TextView) findViewById(R.id.job1_after);\n+        mJob2Before = (TextView) findViewById(R.id.job2_before);\n+        mJob2After = (TextView) findViewById(R.id.job2_after);\n+        mJob3Before = (TextView) findViewById(R.id.job3_before);\n+        mJob3After = (TextView) findViewById(R.id.job3_after);\n+\n+        mReceiver = new BroadcastReceiver() {\n+            @Override\n+            public void onReceive(Context context, Intent intent) {\n+                Integer value = intent.getIntExtra(JobServiceRandomNumber.MESSAGE1, -1);\n+                Log.d(\"SERKANO\", \"onReceive: \" + value);\n+                if (mFirstNumber  == 0 && mSecondNumber == 0) {\n+                    mJob1Before.setText(\"Waiting...\");\n+                    mSecondNumber = value;\n+                    mJob1After.setText(mSecondNumber.toString());\n+                } else {\n+                    mFirstNumber = mSecondNumber;\n+                    mJob1Before.setText(mFirstNumber.toString());\n+                    mSecondNumber = value;\n+                    mJob1After.setText(mSecondNumber.toString());\n+                }\n+\n+            }\n+        };\n+\n+        mReceiver2 = new BroadcastReceiver() {\n+            @Override\n+            public void onReceive(Context context, Intent intent) {\n+                String date = intent.getStringExtra(JobServiceDateTime.MESSAGE2);\n+\n+                if (mFirstDate.equals(\"\") && mSecondDate.equals(\"\")) {\n+                    mJob2Before.setText(\"Waiting...\");\n+                    mSecondDate = date;\n+                    mJob2After.setText(mSecondDate);\n+                } else {\n+                    mFirstDate = mSecondDate;\n+                    mJob2Before.setText(mFirstDate);\n+                    mSecondDate = date;\n+                    mJob2After.setText(mSecondDate);\n+                }\n+\n+            }\n+        };\n+\n+        mReceiver3 = new BroadcastReceiver() {\n+            @Override\n+            public void onReceive(Context context, Intent intent) {\n+                String token = intent.getStringExtra(JobServiceRandomToken.MESSAGE3);\n+\n+                if (mFirstToken.equals(\"\") && mSecondToken.equals(\"\")) {\n+                    mJob3Before.setText(\"Waiting...\");\n+                    mSecondToken = token;\n+                    mJob3After.setText(mSecondToken);\n+                } else {\n+                    mFirstToken = mSecondToken;\n+                    mJob3Before.setText(mFirstToken);\n+                    mSecondToken = token;\n+                    mJob3After.setText(mSecondToken);\n+                }\n+            }\n+        };\n+\n+        JobInfo periodicJobInfo = new JobInfo.Builder(FIRST_JOB_ID,\n+                new ComponentName(this, JobServiceRandomNumber.class))\n+                .setPeriodic(5000)\n+                .build();\n+\n+        JobInfo periodicJobInfo2 = new JobInfo.Builder(SECOND_JOB_ID,\n+                new ComponentName(this, JobServiceDateTime.class))\n+                .setPeriodic(3000)\n+                .build();\n+\n+        JobInfo conditionJobInfo = new JobInfo.Builder(THIRD_JOB_ID,\n+                new ComponentName(this, JobServiceRandomToken.class))\n+                .setRequiresCharging(true)\n+                .setBackoffCriteria(1000, JobInfo.BACKOFF_POLICY_LINEAR)\n+                .build();\n+\n+        JobScheduler jobScheduler = (JobScheduler) getSystemService(JOB_SCHEDULER_SERVICE);\n+        jobScheduler.schedule(periodicJobInfo);\n+        jobScheduler.schedule(periodicJobInfo2);\n+        jobScheduler.schedule(conditionJobInfo);","path":"MyApplication/app/src/main/java/net/serkanbal/myapplication/MainActivity.java","position":112,"original_position":112,"commit_id":"b05f0a570f0cf4a71b75adfcfdcb99888d078625","original_commit_id":"b05f0a570f0cf4a71b75adfcfdcb99888d078625","user":{"login":"charlesdrews","id":6901943,"avatar_url":"https://avatars.githubusercontent.com/u/6901943?v=3","gravatar_id":"","url":"https://api.github.com/users/charlesdrews","html_url":"https://github.com/charlesdrews","followers_url":"https://api.github.com/users/charlesdrews/followers","following_url":"https://api.github.com/users/charlesdrews/following{/other_user}","gists_url":"https://api.github.com/users/charlesdrews/gists{/gist_id}","starred_url":"https://api.github.com/users/charlesdrews/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charlesdrews/subscriptions","organizations_url":"https://api.github.com/users/charlesdrews/orgs","repos_url":"https://api.github.com/users/charlesdrews/repos","events_url":"https://api.github.com/users/charlesdrews/events{/privacy}","received_events_url":"https://api.github.com/users/charlesdrews/received_events","type":"User","site_admin":false},"body":"You probably saw this coming... I suggest more descriptive names for each job. Something like `numberJob`, `tokenJob`, `dateTimeJob` would be much clearer than these names.","created_at":"2016-12-06T20:34:21Z","updated_at":"2016-12-06T20:34:34Z","html_url":"https://github.com/ga-adi-macaron/job-scheduler-lab/pull/3#discussion_r91165261","pull_request_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/3","_links":{"self":{"href":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/comments/91165261"},"html":{"href":"https://github.com/ga-adi-macaron/job-scheduler-lab/pull/3#discussion_r91165261"},"pull_request":{"href":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/3"}}},"pull_request":{"url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/3","id":95810061,"html_url":"https://github.com/ga-adi-macaron/job-scheduler-lab/pull/3","diff_url":"https://github.com/ga-adi-macaron/job-scheduler-lab/pull/3.diff","patch_url":"https://github.com/ga-adi-macaron/job-scheduler-lab/pull/3.patch","issue_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/issues/3","number":3,"state":"closed","locked":false,"title":"Job Scheduler Lab Done","user":{"login":"serkanbal","id":20479798,"avatar_url":"https://avatars.githubusercontent.com/u/20479798?v=3","gravatar_id":"","url":"https://api.github.com/users/serkanbal","html_url":"https://github.com/serkanbal","followers_url":"https://api.github.com/users/serkanbal/followers","following_url":"https://api.github.com/users/serkanbal/following{/other_user}","gists_url":"https://api.github.com/users/serkanbal/gists{/gist_id}","starred_url":"https://api.github.com/users/serkanbal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serkanbal/subscriptions","organizations_url":"https://api.github.com/users/serkanbal/orgs","repos_url":"https://api.github.com/users/serkanbal/repos","events_url":"https://api.github.com/users/serkanbal/events{/privacy}","received_events_url":"https://api.github.com/users/serkanbal/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-30T01:19:37Z","updated_at":"2016-12-06T20:34:34Z","closed_at":"2016-12-06T20:34:26Z","merged_at":null,"merge_commit_sha":"53ed72527676ae80ca5db604256502c0563d2f42","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/3/commits","review_comments_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/3/comments","review_comment_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/issues/3/comments","statuses_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/statuses/b05f0a570f0cf4a71b75adfcfdcb99888d078625","head":{"label":"serkanbal:master","ref":"master","sha":"b05f0a570f0cf4a71b75adfcfdcb99888d078625","user":{"login":"serkanbal","id":20479798,"avatar_url":"https://avatars.githubusercontent.com/u/20479798?v=3","gravatar_id":"","url":"https://api.github.com/users/serkanbal","html_url":"https://github.com/serkanbal","followers_url":"https://api.github.com/users/serkanbal/followers","following_url":"https://api.github.com/users/serkanbal/following{/other_user}","gists_url":"https://api.github.com/users/serkanbal/gists{/gist_id}","starred_url":"https://api.github.com/users/serkanbal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serkanbal/subscriptions","organizations_url":"https://api.github.com/users/serkanbal/orgs","repos_url":"https://api.github.com/users/serkanbal/repos","events_url":"https://api.github.com/users/serkanbal/events{/privacy}","received_events_url":"https://api.github.com/users/serkanbal/received_events","type":"User","site_admin":false},"repo":{"id":75102936,"name":"job-scheduler-lab","full_name":"serkanbal/job-scheduler-lab","owner":{"login":"serkanbal","id":20479798,"avatar_url":"https://avatars.githubusercontent.com/u/20479798?v=3","gravatar_id":"","url":"https://api.github.com/users/serkanbal","html_url":"https://github.com/serkanbal","followers_url":"https://api.github.com/users/serkanbal/followers","following_url":"https://api.github.com/users/serkanbal/following{/other_user}","gists_url":"https://api.github.com/users/serkanbal/gists{/gist_id}","starred_url":"https://api.github.com/users/serkanbal/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/serkanbal/subscriptions","organizations_url":"https://api.github.com/users/serkanbal/orgs","repos_url":"https://api.github.com/users/serkanbal/repos","events_url":"https://api.github.com/users/serkanbal/events{/privacy}","received_events_url":"https://api.github.com/users/serkanbal/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/serkanbal/job-scheduler-lab","description":null,"fork":true,"url":"https://api.github.com/repos/serkanbal/job-scheduler-lab","forks_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/forks","keys_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/teams","hooks_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/hooks","issue_events_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/issues/events{/number}","events_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/events","assignees_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/assignees{/user}","branches_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/branches{/branch}","tags_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/tags","blobs_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/git/refs{/sha}","trees_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/statuses/{sha}","languages_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/languages","stargazers_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/stargazers","contributors_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/contributors","subscribers_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/subscribers","subscription_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/subscription","commits_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/commits{/sha}","git_commits_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/git/commits{/sha}","comments_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/comments{/number}","issue_comment_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/issues/comments{/number}","contents_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/contents/{+path}","compare_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/merges","archive_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/downloads","issues_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/issues{/number}","pulls_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/pulls{/number}","milestones_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/milestones{/number}","notifications_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/labels{/name}","releases_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/releases{/id}","deployments_url":"https://api.github.com/repos/serkanbal/job-scheduler-lab/deployments","created_at":"2016-11-29T16:59:20Z","updated_at":"2016-11-30T01:18:46Z","pushed_at":"2016-11-30T01:18:45Z","git_url":"git://github.com/serkanbal/job-scheduler-lab.git","ssh_url":"git@github.com:serkanbal/job-scheduler-lab.git","clone_url":"https://github.com/serkanbal/job-scheduler-lab.git","svn_url":"https://github.com/serkanbal/job-scheduler-lab","homepage":null,"size":89,"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":"ga-adi-macaron:master","ref":"master","sha":"0a27fe9978d5d9ddfbc5b102f24fd34c3d6e9ffa","user":{"login":"ga-adi-macaron","id":22455948,"avatar_url":"https://avatars.githubusercontent.com/u/22455948?v=3","gravatar_id":"","url":"https://api.github.com/users/ga-adi-macaron","html_url":"https://github.com/ga-adi-macaron","followers_url":"https://api.github.com/users/ga-adi-macaron/followers","following_url":"https://api.github.com/users/ga-adi-macaron/following{/other_user}","gists_url":"https://api.github.com/users/ga-adi-macaron/gists{/gist_id}","starred_url":"https://api.github.com/users/ga-adi-macaron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga-adi-macaron/subscriptions","organizations_url":"https://api.github.com/users/ga-adi-macaron/orgs","repos_url":"https://api.github.com/users/ga-adi-macaron/repos","events_url":"https://api.github.com/users/ga-adi-macaron/events{/privacy}","received_events_url":"https://api.github.com/users/ga-adi-macaron/received_events","type":"Organization","site_admin":false},"repo":{"id":75087494,"name":"job-scheduler-lab","full_name":"ga-adi-macaron/job-scheduler-lab","owner":{"login":"ga-adi-macaron","id":22455948,"avatar_url":"https://avatars.githubusercontent.com/u/22455948?v=3","gravatar_id":"","url":"https://api.github.com/users/ga-adi-macaron","html_url":"https://github.com/ga-adi-macaron","followers_url":"https://api.github.com/users/ga-adi-macaron/followers","following_url":"https://api.github.com/users/ga-adi-macaron/following{/other_user}","gists_url":"https://api.github.com/users/ga-adi-macaron/gists{/gist_id}","starred_url":"https://api.github.com/users/ga-adi-macaron/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ga-adi-macaron/subscriptions","organizations_url":"https://api.github.com/users/ga-adi-macaron/orgs","repos_url":"https://api.github.com/users/ga-adi-macaron/repos","events_url":"https://api.github.com/users/ga-adi-macaron/events{/privacy}","received_events_url":"https://api.github.com/users/ga-adi-macaron/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ga-adi-macaron/job-scheduler-lab","description":null,"fork":false,"url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab","forks_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/forks","keys_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/teams","hooks_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/hooks","issue_events_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/issues/events{/number}","events_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/events","assignees_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/assignees{/user}","branches_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/branches{/branch}","tags_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/tags","blobs_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/git/refs{/sha}","trees_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/statuses/{sha}","languages_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/languages","stargazers_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/stargazers","contributors_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/contributors","subscribers_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/subscribers","subscription_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/subscription","commits_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/commits{/sha}","git_commits_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/git/commits{/sha}","comments_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/comments{/number}","issue_comment_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/issues/comments{/number}","contents_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/contents/{+path}","compare_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/merges","archive_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/downloads","issues_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/issues{/number}","pulls_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls{/number}","milestones_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/milestones{/number}","notifications_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/labels{/name}","releases_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/releases{/id}","deployments_url":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/deployments","created_at":"2016-11-29T14:10:06Z","updated_at":"2016-12-01T14:31:47Z","pushed_at":"2016-12-01T14:34:15Z","git_url":"git://github.com/ga-adi-macaron/job-scheduler-lab.git","ssh_url":"git@github.com:ga-adi-macaron/job-scheduler-lab.git","clone_url":"https://github.com/ga-adi-macaron/job-scheduler-lab.git","svn_url":"https://github.com/ga-adi-macaron/job-scheduler-lab","homepage":null,"size":250,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":5,"forks":11,"open_issues":5,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/3"},"html":{"href":"https://github.com/ga-adi-macaron/job-scheduler-lab/pull/3"},"issue":{"href":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/issues/3"},"comments":{"href":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/issues/3/comments"},"review_comments":{"href":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/3/comments"},"review_comment":{"href":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/pulls/3/commits"},"statuses":{"href":"https://api.github.com/repos/ga-adi-macaron/job-scheduler-lab/statuses/b05f0a570f0cf4a71b75adfcfdcb99888d078625"}}}}
{"actor":{"display_login":"charlesdrews"}}