{"id":2274,"date":"2014-08-25T19:16:45","date_gmt":"2014-08-25T07:16:45","guid":{"rendered":"https:\/\/www.deltics.co.nz\/blog\/?p=2274"},"modified":"2014-08-25T19:16:45","modified_gmt":"2014-08-25T07:16:45","slug":"small-post-for-a-very-small-app","status":"publish","type":"post","link":"https:\/\/www.deltics.co.nz\/blog\/posts\/2274\/","title":{"rendered":"Small Post, for a (Very) Small App"},"content":{"rendered":"<span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span><p>On Saturday I was out and about with my family and found myself inspired to write an app.  By Sunday evening, it was done and in the Google Play store.<\/p>\n<p><!--more--><\/p>\n<p>We were in an area of Auckland called Parnell and needed to park the car on street, where a fairly standard &#8220;pay and display&#8221; system is operated.  Since (I think) 2005 Auckland City (and some other parts of NZ) have offered <strong>TXT-a-Pay<\/strong>\u2122 on their parking meters.<\/p>\n<p>It&#8217;s a very simple system:<\/p>\n<ol>\n<li>You select <strong>TXT-a-Park<\/strong>\u2122 as your payment method (rather than cash or credit\/debit card),<\/li>\n<li>The meter then displays a menu of codes, corresponding to different lengths of stay.<\/li>\n<li>You send the appropriate code as a TXT msg using an SMS capable phone to the number 7275 (P-A-R-K),<\/li>\n<li>The appropriate fee is charged to your mobile phone account, and the meter then prints your ticket for displaying on your dashboard.<\/li>\n<\/ol>\n<p>There is nothing particularly sophisticated about the system.  The code that you TXT to 7275 consists of 4 digits that identify the particular parking meter, and the final digit is the $ spend for the indicated length of stay.<\/p>\n<p>What has always bugged me about this is that smartphone SMS apps have become increasingly loaded up with features and the on screen keyboards ever more cramped with all sorts of great shortcuts for smileys and prediction and goodness knows what.<\/p>\n<p>Which is great when you are TXT&#8217;ing a novel, or a love letter or trying to track down your kids.  But when you just want a clean, clear, error-free way to whack in 5 simple numbers and send them to a specific SMS number, it can be a real PITA.<\/p>\n<p>So I decided to write an app.<\/p>\n<p>As soon as we got home later in the afternoon I set about it.<\/p>\n<p>It turns out that on <strong>Android<\/strong> sending a TXT really is very simple.  In fact, you can achieve it in a single line of code.  For example here&#8217;s the Java for sending the code &#8220;66169&#8221; to the 7275 <strong>TXT-a-PARK<\/strong>\u2122 number:<\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\n   SMSManager.getDefault.sendTextMessage(&quot;7275&quot;, null, &quot;66169&quot;, null, null);\r\n<\/pre>\n<p>Which effortlessly translates into Oxygene code:<\/p>\n<pre class=\"brush: oxygene; title: ; notranslate\" title=\"\">\r\n   SMSManager.Default.sendTextMessage('7275', nil, '66169', nil, nil);\r\n<\/pre>\n<p>There is a bit more involved if you want to provide a callback for handling confirmation of the sending of the message (or failure) and\/or of delivery of the message.<\/p>\n<p>But in essence, I simply needed an app with a UI to enter 5 digits and send them as a TXT.<\/p>\n<p>And here it is (&lt;drumroll \/&gt;):<\/p>\n<p><a href=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/screen-3.png?ssl=1\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/screen-3.png?resize=168%2C300&#038;ssl=1\" alt=\"TXT-2-PARK\" width=\"168\" height=\"300\" class=\"aligncenter size-medium wp-image-2276\" srcset=\"https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/screen-3.png?resize=168%2C300&amp;ssl=1 168w, https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/screen-3.png?resize=576%2C1024&amp;ssl=1 576w, https:\/\/i0.wp.com\/www.deltics.co.nz\/blog\/wp-content\/uploads\/screen-3.png?w=1080&amp;ssl=1 1080w\" sizes=\"auto, (max-width: 168px) 100vw, 168px\" \/><\/a><\/p>\n<p>The app is called TXT<strong>-2-<\/strong>PARK rather than TXT<strong>-a-<\/strong>Park\u2122 since the latter is a trademark in NZ.<\/p>\n<p>I made things harder for myself by deciding that I would present my &#8220;message sent&#8221; confirmation using a custom layout for my message &#8220;toast&#8221; which turned out to be harder than I expected.  I will post about that soon.<\/p>\n<p>But, as I said, the app is now up in the <a href=\"https:\/\/play.google.com\/store\/apps\/details?id=itchbox.txt2park&#038;hl=en\">Google Play Store<\/a>.  It is a free app, so if you are in Auckland or anywhere else that offers a compatible service (TXT a 5 digit code to 7275 in return for parking or whatever), then go grab it.<\/p>\n<h2>All In The Title<\/h2>\n<p>The title of this post is &#8220;Small Post, for a Very Small App&#8221;.<\/p>\n<p>How small ?  22 KB + change.  That&#8217;s how small.<\/p>\n<p>That is the <em>complete<\/em>, <em>fully functioning<\/em> app including a UI which, although no work of art, does at least scale nicely (well, effectively at least) on devices from very small screens (240&#215;320) up to phablets.  Or at least it should do &#8211; I have tested it with a range of emulated devices as well as my own <strong>Galaxy S4 Active<\/strong>.<\/p>\n<p>This small size means that the main goal of the app &#8211; convenience &#8211; is very well supported by the fact that it starts up and is ready to go <strong>instantly<\/strong> that you tap its shortcut.<\/p>\n<p>Meanwhile I&#8217;m now working on an <strong>iOS<\/strong> version (for my wife, among others) and <strong>Windows Phone<\/strong> (for my work colleagues, among others).<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"span-reading-time rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\"> 3<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span>On Saturday I was out and about with my family and found myself inspired to write an app. By Sunday evening, it was done and in the Google Play store.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[212,205,4,180],"tags":[153,240,181,280,279],"class_list":["post-2274","post","type-post","status-publish","format-standard","hentry","category-android-2","category-cooper","category-delphi","category-oxygene","tag-android","tag-apps","tag-oxygene-2","tag-sms","tag-txt"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1TKYv-AG","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/2274","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=2274"}],"version-history":[{"count":3,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/2274\/revisions"}],"predecessor-version":[{"id":2278,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/2274\/revisions\/2278"}],"wp:attachment":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=2274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=2274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=2274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}