{"id":5443,"date":"2024-12-28T16:23:08","date_gmt":"2024-12-28T16:23:08","guid":{"rendered":"https:\/\/obsidiansofteducation.com\/?page_id=5443"},"modified":"2024-12-28T16:23:08","modified_gmt":"2024-12-28T16:23:08","slug":"age-verification-for-neutral-age-screen","status":"publish","type":"page","link":"https:\/\/obsidiansofteducation.com\/index.php\/age-verification-for-neutral-age-screen\/","title":{"rendered":"Age Verification for Neutral Age Screen"},"content":{"rendered":"\n<p>Hello friends and welcome to Obsidian Soft,<\/p>\n\n\n\n<p>Recently, one of my viewers commented on my video and queried about the age verification check in an app. So, this piqued my curiosity and I couldn\u2019t stop myself from coding a short app for this purpose. So, here it goes:<\/p>\n\n\n\n<p>Start a new project in MIT App Inventor. I will name it AgeVerificationApp. I will check in this app if the user is 18 or not but you can change it to any year you want e.g. 13 for COPPA-compliant neutral age screens.<\/p>\n\n\n\n<p>Design the screen by adding a DatePicker and Button from the User Interface Palette. Rename the datepicker to birthDatePicker and the button to submitBtn. Change the text on them accordingly.<\/p>\n\n\n\n<p>Add a notifier from the user interface. Also, add a clock from the Sensors palette. Turn off the timer enabled checkbox as we just need the clock for getting the current date and not for running any timers.<\/p>\n\n\n\n<p>This is what my screen looks like:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/xUKXL9VUQcXR598_Xclty9VSqK3McANQ1HEowKr4_rFbu2eJrYLJ_SLJQefRXzIpxKoFDetltPtPqoSLmMwFICPH5wApBgaiPI5SBMbE8DudNms8qXQoomL4x2O22IlFxH7c7A11bvDi6THRHuKXosIw289-h400.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>The components:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/IY5SgFXXUo7ZUvlttzgbxeCDG6pxdEvvZoBpkkMG4Uc9XGpI-dT0L0phInjeIJY_LAp8aQ1dx0MLvd74RO_wJ2UsmF5UAEkacWOQw8UN9r3-6S7PCoYR3LAhpjgm2v9pLfUhy1WqdemiXtPwsgWEdfUw358-h400.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Go to the blocks section. Add a global variable for age.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/pjaeVKueQfznlpBhiA34Q0rh2lDjba_C5_fYHcy0BtUoEsHVog0IFzsBft8gB8YzB3GTFbk2Zr65Sq9EpKTzYsuvBWUvTrDtQ-5HZY7zfLKFSkeUs4ro752PxFxM5T_tS149_TuxO2ko17AyLnGrpcIw400-h50.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Next, add a procedure from Procedures (use the one without the result). Rename to \u201ccalculateAge\u201d. Keep it empty for the moment.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/vOzHrXjP8EyBZtyi9kjJSqdT_cCMaJNujBjJYjb3MYr-xPR2WA_7qbt9YXS3CYXyFEKrt8TCndAYjpP2BxQ-I8Q3Ufx3HLC4p6JToyY4jgAU4WWUowEqnXirtFYwtMM8qQ6EooJdiW54QdTOSZUIs3Qw400-h156.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>And call the procedure every time, the user changes his\/her birth date.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/CfCL1vFTye-5odZUtLFTakzUs7ad5nAAzNG7dgRBJvdXxn5BnhcHmBg7vjz0wJq8Iov2HPOYdMF2B30YTqPmcS7Q2nJFhMcAdnWF8VAMmr2N7xqOuC63tJRg1INFA-1uqs4HvcwDjvrHayyo31CPD2Yw400-h92.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Inside the submitBtn click event, add an if\/else block from Control to check if the age is &gt;= 18. Show alerts using the notifier accordingly. You can change this 18 number block to whatever age you want to verify against.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/6lcZxD6K4bAGQgoxU0z-2js7YcKkbhO_Fv3sGkTCuyDEpp3nwgmS3MhfDHUHSRkRIT3KtxIcWwJ1eKSoL2wlTtzwEwe8KN7OHuxHplGrsoOZCMvhLWHVLuo_Qy34HnHuWEW_9brpKmU-HCnJ0zXHGJIw578-h230.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Last but not least, work on the custom procedure: calculateAge. Add a local variable within it.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/zsLlERlcQR1MUiRNYO4f7NoKTsrR9J2v9Qh6iWGI5KQoF9GsaIt6rKrtMI9wqEXROG-lbwDK8btOqCcamu87benxdMVKf5WKMnCaizeo0Qkxe10JAwadLnjPDv5plHhcvm5p1IIccmc2bJH17RLQ6UIw400-h159.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Click on the clog wheel of the local variable and add 6 variables to it.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/i4Mplg3IVdj4eCzzxmsuTIb5w6fr0fPGdrwB70RMZPWnvnah4Eeni236Rs0ACsVB4UivYTV80U2wYqVptt7Aq3mtPksKULTKSxA8lGSiooYFC2WsDrBO0b7YAMDsGZFet2iMKrUYLQs2K-jS_eeW8Lsw309-h400.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Once done, it will look similar to this:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/K06B0KjVbWEH-M1VBpP13aQlCm-mzcFeHfHuQLyuDVvN0Sv-J3a3IfzSXkeuk88PjVA5uyjdqUpA7t-JYJZNVbo-rL2aRODcuNdoJ_odKFpXakmlKowHWwydQfX-LekoPGq3THe0ODGrMciqxO7lKrQw407-h366.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Rename the first variable i.e. name to birthDay, x to currentDay, x2 to birthMonth, x3 to currentMonth, x4 to birthYear, and x5 to currentYear.<\/p>\n\n\n\n<p>Now, assign them values accordingly by looking at how I am doing below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/d9Xc7ZTUTrkXFEquK296BfNfzHBqC4jjb_RoivEk0b-Rc7gIBY3RUV9dKNxK7AcyY_ncgE0Joc0oW2RImoly1VV822I3CY8DPgnjx_FugbMBi7u7CeGk1UumFKWhRRhkTQS5-6iVzGf9-xG879lytdQw559-h261.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>Now, our logic is that if the current month is &gt; than the birth month OR it is the same AND the current day is &gt; = birthday then this means that the birthday has already passed so we can calculate age as current year minus birth year. In the other situation, the person\u2019s age is current year minus birth year minus 1.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/us2HfUNJV8gL7Ec8mtLjeyuf9SDSqA454gphMUbBcJwUEjTum2L-3wXxcEZhE4O_Y1AA5awm6vsukgQ1z1x0_6tKrexn13tDt1VcKsVUWPZZ2ngPEXmDtmZbukPcKFZGw9L5XN3FMMq77avjgVS4EFow676-h215.png\" alt=\"\"\/><\/figure>\n\n\n\n<p>So, this is done and I hope you liked this short tutorial on an important topic i.e. verifying user-provided birthdate.<\/p>\n\n\n\n<p>If you like my tutorials, consider supporting me:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><a href=\"https:\/\/obsidiansoft.gumroad.com\/l\/cxdft\" target=\"_blank\" rel=\"noopener\"><img loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"196\" src=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png\" alt=\"\" class=\"wp-image-5381\" style=\"width:226px;height:auto\" srcset=\"https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1.png 372w, https:\/\/obsidiansofteducation.com\/wp-content\/uploads\/2024\/12\/donate-button-1-300x158.png 300w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/a><\/figure>\n<\/div>\n\n\n<figure class=\"wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<p class=\"responsive-video-wrap clr\"><iframe loading=\"lazy\" title=\"App Inventor Age Calculator | Calculate Age in MIT App Inventor | Age Screen in MIT App Inventor\" width=\"1200\" height=\"675\" src=\"https:\/\/www.youtube.com\/embed\/HFaq29FAxns?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><\/p>\n<\/div><\/figure>\n\n\n\n<p>Check out my other written tutorials for MIT App Inventor\u00a0<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mit-app-inventor-projects\/\"><strong>here<\/strong><\/a>.<\/p>\n\n\n\n<p>Please like my social media pages for more educational resources and tips.<\/p>\n\n\n\n<p>Facebook:<a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.facebook.com\/ObsidianSoftClasses<\/a><\/p>\n\n\n\n<p>Instagram:<a href=\"https:\/\/www.blogger.com\/blog\/page\/edit\/4947000819484484884\/7140650632339107612#\" target=\"_blank\" rel=\"noopener\">&nbsp;https:\/\/www.instagram.com\/obsidiansoftapps\/<\/a><\/p>\n\n\n\n<p>Pinterest:<\/p>\n\n\n\n<p><a href=\"https:\/\/www.pinterest.co.uk\/obsidiansoft\/_created\" target=\"_blank\" rel=\"noopener\">https:\/\/www.pinterest.co.uk\/obsidiansoft\/_created<\/a><\/p>\n\n\n\n<p>For links to free educational apps, have a look at the\u00a0<a href=\"https:\/\/obsidiansofteducation.com\/index.php\/mobile-apps\/\">educational apps page<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello friends and welcome to Obsidian Soft, Recently, one of my viewers commented on my video and queried about the age verification check in an app. So, this piqued my curiosity and I couldn\u2019t stop myself from coding a short app for this purpose. So, here it goes: Start a new project in MIT App [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-5443","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5443","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/comments?post=5443"}],"version-history":[{"count":2,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5443\/revisions"}],"predecessor-version":[{"id":5848,"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/pages\/5443\/revisions\/5848"}],"wp:attachment":[{"href":"https:\/\/obsidiansofteducation.com\/index.php\/wp-json\/wp\/v2\/media?parent=5443"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}