{"action":"created","comment":{"url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/comments/70186167","id":70186167,"diff_hunk":"@@ -1,9 +1,93 @@\n # Lesson 4 - Data Storage App Life Cycle\n \n ##  Data Storage\n+Everytime you close an app and reopen it, a new session of app is created. This means that any data that wasn't saved cannot be retrieved again. This is where persistent storage comes in. Android provides you with 5-6 options to choose from. While choosing an option, you should consider complexity of data being stored, privacy (if it can be read by the app only, the users or other apps on the device), and location (if it is local or on the cloud). We'll be mainly discussing Shared Preferences and SQLite databases. But here are many of the options available to Android:\n+\n+1. [Shared Preferences](https://developer.android.com/guide/topics/data/data-storage.html#pref):\n+\n+   Useful for writing small amount of data as key-value pairs.\n+2. [Firebase](https://www.firebase.com/docs/android/quickstart.html):\n+\n+   A cool way to store data, run tests and analytics, authenticate, and monetize. The quickstart page linked here gives you a very good idea about how to use Firebase.\n+3. [Internal Storage](https://developer.android.com/guide/topics/data/data-storage.html#filesInternal):\n+\n+   This memory chunk is private by default and is only available to the app. This data gets deleted when the app is uninstalled from the Android device. You can use methods like `openFileInput()`, `read()`, and `close()` on a [FileOutputStream](https://developer.android.com/reference/java/io/FileOutputStream.html)","path":"lesson4/README.md","position":14,"original_position":14,"commit_id":"2c381ad1c8554bbe72318e0c4fbd04c0f3757d2e","original_commit_id":"2c381ad1c8554bbe72318e0c4fbd04c0f3757d2e","user":{"login":"shrutiyer","id":9905402,"avatar_url":"https://avatars.githubusercontent.com/u/9905402?v=3","gravatar_id":"","url":"https://api.github.com/users/shrutiyer","html_url":"https://github.com/shrutiyer","followers_url":"https://api.github.com/users/shrutiyer/followers","following_url":"https://api.github.com/users/shrutiyer/following{/other_user}","gists_url":"https://api.github.com/users/shrutiyer/gists{/gist_id}","starred_url":"https://api.github.com/users/shrutiyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shrutiyer/subscriptions","organizations_url":"https://api.github.com/users/shrutiyer/orgs","repos_url":"https://api.github.com/users/shrutiyer/repos","events_url":"https://api.github.com/users/shrutiyer/events{/privacy}","received_events_url":"https://api.github.com/users/shrutiyer/received_events","type":"User","site_admin":false},"body":"In shared preference, you can only store primitive data types. But for everything else, Internal storage is used.","created_at":"2016-07-10T18:13:57Z","updated_at":"2016-07-10T18:13:57Z","html_url":"https://github.com/MobileProto16/Mobile-Proto-16/pull/10#discussion_r70186167","pull_request_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/comments/70186167"},"html":{"href":"https://github.com/MobileProto16/Mobile-Proto-16/pull/10#discussion_r70186167"},"pull_request":{"href":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/10","id":76535593,"html_url":"https://github.com/MobileProto16/Mobile-Proto-16/pull/10","diff_url":"https://github.com/MobileProto16/Mobile-Proto-16/pull/10.diff","patch_url":"https://github.com/MobileProto16/Mobile-Proto-16/pull/10.patch","issue_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues/10","number":10,"state":"open","locked":false,"title":"Lesson 4","user":{"login":"shrutiyer","id":9905402,"avatar_url":"https://avatars.githubusercontent.com/u/9905402?v=3","gravatar_id":"","url":"https://api.github.com/users/shrutiyer","html_url":"https://github.com/shrutiyer","followers_url":"https://api.github.com/users/shrutiyer/followers","following_url":"https://api.github.com/users/shrutiyer/following{/other_user}","gists_url":"https://api.github.com/users/shrutiyer/gists{/gist_id}","starred_url":"https://api.github.com/users/shrutiyer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shrutiyer/subscriptions","organizations_url":"https://api.github.com/users/shrutiyer/orgs","repos_url":"https://api.github.com/users/shrutiyer/repos","events_url":"https://api.github.com/users/shrutiyer/events{/privacy}","received_events_url":"https://api.github.com/users/shrutiyer/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-07-07T03:47:32Z","updated_at":"2016-07-10T18:13:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2ed2ceb9a2ba01aeab4ebf5d85b6c9d8dba2a88c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/10/commits","review_comments_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/10/comments","review_comment_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues/10/comments","statuses_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/statuses/2c381ad1c8554bbe72318e0c4fbd04c0f3757d2e","head":{"label":"MobileProto16:lesson-4","ref":"lesson-4","sha":"2c381ad1c8554bbe72318e0c4fbd04c0f3757d2e","user":{"login":"MobileProto16","id":19765476,"avatar_url":"https://avatars.githubusercontent.com/u/19765476?v=3","gravatar_id":"","url":"https://api.github.com/users/MobileProto16","html_url":"https://github.com/MobileProto16","followers_url":"https://api.github.com/users/MobileProto16/followers","following_url":"https://api.github.com/users/MobileProto16/following{/other_user}","gists_url":"https://api.github.com/users/MobileProto16/gists{/gist_id}","starred_url":"https://api.github.com/users/MobileProto16/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobileProto16/subscriptions","organizations_url":"https://api.github.com/users/MobileProto16/orgs","repos_url":"https://api.github.com/users/MobileProto16/repos","events_url":"https://api.github.com/users/MobileProto16/events{/privacy}","received_events_url":"https://api.github.com/users/MobileProto16/received_events","type":"Organization","site_admin":false},"repo":{"id":60479894,"name":"Mobile-Proto-16","full_name":"MobileProto16/Mobile-Proto-16","owner":{"login":"MobileProto16","id":19765476,"avatar_url":"https://avatars.githubusercontent.com/u/19765476?v=3","gravatar_id":"","url":"https://api.github.com/users/MobileProto16","html_url":"https://github.com/MobileProto16","followers_url":"https://api.github.com/users/MobileProto16/followers","following_url":"https://api.github.com/users/MobileProto16/following{/other_user}","gists_url":"https://api.github.com/users/MobileProto16/gists{/gist_id}","starred_url":"https://api.github.com/users/MobileProto16/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobileProto16/subscriptions","organizations_url":"https://api.github.com/users/MobileProto16/orgs","repos_url":"https://api.github.com/users/MobileProto16/repos","events_url":"https://api.github.com/users/MobileProto16/events{/privacy}","received_events_url":"https://api.github.com/users/MobileProto16/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MobileProto16/Mobile-Proto-16","description":"Repository for Olin College's Fall 2016 Mobile Prototyping class","fork":false,"url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16","forks_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/forks","keys_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/teams","hooks_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/hooks","issue_events_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues/events{/number}","events_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/events","assignees_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/assignees{/user}","branches_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/branches{/branch}","tags_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/tags","blobs_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/refs{/sha}","trees_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/statuses/{sha}","languages_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/languages","stargazers_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/stargazers","contributors_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/contributors","subscribers_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/subscribers","subscription_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/subscription","commits_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/commits{/sha}","git_commits_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/commits{/sha}","comments_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/comments{/number}","issue_comment_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues/comments{/number}","contents_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/contents/{+path}","compare_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/merges","archive_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/downloads","issues_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues{/number}","pulls_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls{/number}","milestones_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/milestones{/number}","notifications_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/labels{/name}","releases_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/releases{/id}","deployments_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/deployments","created_at":"2016-06-05T20:35:11Z","updated_at":"2016-06-05T21:14:39Z","pushed_at":"2016-07-10T17:55:01Z","git_url":"git://github.com/MobileProto16/Mobile-Proto-16.git","ssh_url":"git@github.com:MobileProto16/Mobile-Proto-16.git","clone_url":"https://github.com/MobileProto16/Mobile-Proto-16.git","svn_url":"https://github.com/MobileProto16/Mobile-Proto-16","homepage":"","size":299,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"MobileProto16:master","ref":"master","sha":"8572de446eb491a225eac49adb62f3ac559c0991","user":{"login":"MobileProto16","id":19765476,"avatar_url":"https://avatars.githubusercontent.com/u/19765476?v=3","gravatar_id":"","url":"https://api.github.com/users/MobileProto16","html_url":"https://github.com/MobileProto16","followers_url":"https://api.github.com/users/MobileProto16/followers","following_url":"https://api.github.com/users/MobileProto16/following{/other_user}","gists_url":"https://api.github.com/users/MobileProto16/gists{/gist_id}","starred_url":"https://api.github.com/users/MobileProto16/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobileProto16/subscriptions","organizations_url":"https://api.github.com/users/MobileProto16/orgs","repos_url":"https://api.github.com/users/MobileProto16/repos","events_url":"https://api.github.com/users/MobileProto16/events{/privacy}","received_events_url":"https://api.github.com/users/MobileProto16/received_events","type":"Organization","site_admin":false},"repo":{"id":60479894,"name":"Mobile-Proto-16","full_name":"MobileProto16/Mobile-Proto-16","owner":{"login":"MobileProto16","id":19765476,"avatar_url":"https://avatars.githubusercontent.com/u/19765476?v=3","gravatar_id":"","url":"https://api.github.com/users/MobileProto16","html_url":"https://github.com/MobileProto16","followers_url":"https://api.github.com/users/MobileProto16/followers","following_url":"https://api.github.com/users/MobileProto16/following{/other_user}","gists_url":"https://api.github.com/users/MobileProto16/gists{/gist_id}","starred_url":"https://api.github.com/users/MobileProto16/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MobileProto16/subscriptions","organizations_url":"https://api.github.com/users/MobileProto16/orgs","repos_url":"https://api.github.com/users/MobileProto16/repos","events_url":"https://api.github.com/users/MobileProto16/events{/privacy}","received_events_url":"https://api.github.com/users/MobileProto16/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MobileProto16/Mobile-Proto-16","description":"Repository for Olin College's Fall 2016 Mobile Prototyping class","fork":false,"url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16","forks_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/forks","keys_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/teams","hooks_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/hooks","issue_events_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues/events{/number}","events_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/events","assignees_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/assignees{/user}","branches_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/branches{/branch}","tags_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/tags","blobs_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/refs{/sha}","trees_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/statuses/{sha}","languages_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/languages","stargazers_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/stargazers","contributors_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/contributors","subscribers_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/subscribers","subscription_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/subscription","commits_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/commits{/sha}","git_commits_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/git/commits{/sha}","comments_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/comments{/number}","issue_comment_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues/comments{/number}","contents_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/contents/{+path}","compare_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/merges","archive_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/downloads","issues_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues{/number}","pulls_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls{/number}","milestones_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/milestones{/number}","notifications_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/labels{/name}","releases_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/releases{/id}","deployments_url":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/deployments","created_at":"2016-06-05T20:35:11Z","updated_at":"2016-06-05T21:14:39Z","pushed_at":"2016-07-10T17:55:01Z","git_url":"git://github.com/MobileProto16/Mobile-Proto-16.git","ssh_url":"git@github.com:MobileProto16/Mobile-Proto-16.git","clone_url":"https://github.com/MobileProto16/Mobile-Proto-16.git","svn_url":"https://github.com/MobileProto16/Mobile-Proto-16","homepage":"","size":299,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/10"},"html":{"href":"https://github.com/MobileProto16/Mobile-Proto-16/pull/10"},"issue":{"href":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues/10"},"comments":{"href":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/MobileProto16/Mobile-Proto-16/statuses/2c381ad1c8554bbe72318e0c4fbd04c0f3757d2e"}}}}
{"actor":{"display_login":"shrutiyer"}}