My experience with Mobile App Development - GPS Treasure Hunt Game

Shawn Rebello

The Idea

I had just started learning the Ionic Framework for cross platform mobile app development by building demo apps to learn how certain native features work and/or reading Josh Morony's tutorials  when I found this xkcd  on a  reddit post  and it gave me an idea.
What better way to learn a framework than to dive in and build a project?
Besides, on days when I do not have college,  I could continue coding till 3 am.

Development Begins

So I create a new Ionic 2 project and decide to go with a tabs layout and start with the GPS features which I believe (incorrectly) would be the hardest part of the app.


Few hours into the project and the geolocation features where the easiest to add.
 Lucky for me my development machine (Macbook Air) has a GPS receiver and so I'm able to test the location features directly through the browser.

I also manage to add typescript functions to calculate distance between two gps coordinates with Haversine's formula and test the first iteration of the app on a local device.
On noticing the wildly inaccurate distances I realized that GPS is horribly inaccurate within a building , enough to locate the house but with rapidly changing values, off by at least 20-30 meters.

Now that the GPS functionality was added I tried to think of a way to transfer the GPS location from one app user to another, without them having to manually copy paste any data. 
I could make a backend server with Rails and connect it to the app, but that would incur hosting costs.

So a few days later I get the idea to use either deep links or barcodes to allow transferring the data between users, and also encrypt the data so that the average user does not decode the barcode and find the location.

2:39 am and I get the geolocation working!
Development was paused  for the next week and when I resumed I realized that  the Ionic Native barcode scanner as well as cordova barcode scanner allow scanning from camera only not the gallery, guess I hadn't thought this through.

After trying on many solutions, involving plugins not included into Ionic Native I finally got it working using the the port of zxing with the html canvas element and getting the images with cordova imagepicker.

Now that I could finally scan barcodes from gallery within the Ionic 2 app, I had to just implement the media sharing feature and I could then relax and focus on the UI, but that took a bit longer than expected.

The Canvas.decode function nested inside the ImagePicker kept on failing and multiple solutions to get it working failed, until I finally found out the issue:
the scope of this was changed and that's why Canvas couldn't be used.
So I assign this to another variable and manage to get it working again


      ImagePicker.getPictures(options).then((results) => {
        for (var i = 0; i < results.length; i++) {
          var tempObj= this;
          tempObj.convertImgToBase64URL(results,function(base64Img){


Now that all the main functionality was done I could focus on the UI so I write a function in the provider to dynamically generate a color code based on the percentage of distance covered and use it in the view.
A cup of coffee and some scss later I've got the app ready for deployment

Android 6.x.x issues with Ionic 2


So all this while I was using the browser to test the non-native stuff and the spare device to test the native features, the app worked perfectly on that phone (android 4) and I assumed it would work on later versions as well.

But I had some issues with the runtime permissions on Android 6.x.x.
Installing Ionic native diagnostic plugin raised some 'Unmet Peer Dependency Warning' , so I decided to give the cordova diagnostic plugin a try instead which worked like a charm.

Release

Designed an icon, splashscreen and created app intro slides with photoshop.
Tested the app on an emulator running Android 6 and then pushed it to the play store.

You can check it here at: https://play.google.com/store/apps/details?id=com.shawnrebello.hotorcold251239 and leave me a feedback in the comments.

A few screens:








Thanks for reading this and have a great day!

Shawn Rebello / Author & Editor

Shawn Rebello is an engineering student who likes learning new languages, tools, libraries or frameworks. When he is not coding, he binge watches TV shows and spends time on Wikipedia and Reddit.

35 comments :

  1. Such supplements are made with a Biogenic Xr variety of herbal substances that encomp herbal extracts, minerals and amino acids.
    http://www.healthprograme.com/biogenic-xr-reviews/

    ReplyDelete
  2. Cla Safflower Oil This saves the belly from being burnt with the aid of its very own acid fluid. Additionally a nicely hydrated frame reduces the urge to drink dangerous liquids which introduce greater pollution for your body.
    http://www.drozhealthblog.com/cla-safflower-oil/

    ReplyDelete
  3. Testro T3 In reality, there are just two things that are at present known to build estimate by inches. These eventual surgery and hand schedules; Very other pill, elixir, and direct out there is trash.
    http://www.drozhealthblog.com/testro-t3-uk/

    ReplyDelete
  4. Testx Core As a matter of first importance, the couple of minutes daily won't comprise of popping pointless pills.
    http://www.usadrugguide.com/testx-core-review/

    ReplyDelete
  5. I read your post its great thanks. Waiting for more new update.

    ReplyDelete
  6. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a Front end developer learn from TypeScript Training in Chennai . or learn thru Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry. Javascript Online Training from India

    ReplyDelete
  7. CLA Safflower Oil shedding off extra fat from the body at 00 kilos was not at all an easy deal. It become very miserable to see human beings laughing at my lower back.
    http://xtrfact.com/cla-safflower-oil/

    ReplyDelete
  8. Dermagen IQ It may be the case that on the off chance that you utilize chemicals at work, certain family cleaning operators, air fresheners and scented washing cleansers, these may be in charge of your skin break out episodes Dermagen IQ for UK.
    http://www.usadrugguide.com/dermagen-iq/

    ReplyDelete
  9. Dermagen IQ Why is it so unique? In view of its astounding properties and magnificent advantages: It has astonishing cancer prevention agent properties which shields the skin from free radical harm.
    http://www.drozhealthblog.com/dermagen-iq/

    ReplyDelete
  10. Rapiture Muscle Builder Use home made marinades, and ditch the condiments altogether. Grill your meats, or boil them in stews (while disposing of the fatty oil inside the water Rapiture Muscle for Spain.
    http://xtrfact.com/rapiture-muscle-builder/

    ReplyDelete
  11. Perlelux for disappointment. They simply don't have the propelled hostile to maturing healthy skin fixings expected to really have some impact on your skin.
    http://www.drozhelp.com/perlelux/

    ReplyDelete
  12. D BAL Max the frame into glucose, that is then released into the bloodstream and transported to the diverse muscle businesses.
    http://xtrfact.com/d-bal-max-review/

    ReplyDelete
  13. Slimfire Forskolin We can choose yet there's no finish. Give me a chance to Forskolin make this reasonable 'choosing' without activity.
    http://supplementdigestdog.com/slimfire-forskolin/

    ReplyDelete
  14. Xtrfact The particular distinction being that in making your own particular wellbeing and health items.
    http://xtrfact.com/

    ReplyDelete
  15. This comment has been removed by the author.

    ReplyDelete
  16. Pure CBD Oil They contain the greater part of the fundamental amino acids and unsaturated fats important to keep up sound human life.
    http://www.drozhealthblog.com/pure-cbd-oil/

    ReplyDelete
  17. Dermagen IQ out about fixings that are contained in your Botanical healthy skin items Since your Dermagen IQ for UK skin is presented to numerous destructive .
    http://www.drozhealthblog.com/dermagen-iq/

    ReplyDelete
  18. Perlelux That they have rosacea They surmise that they simply flush or become flushed effortlessly or are simply excessively touchy.
    http://www.usadrugguide.com/perlelux-ca/

    ReplyDelete
  19. Nitridex lastly hereditary qualities Since this is the principle component bosom advancement will be in full just when we dispose of the destructive impacts.
    http://supplementdigestdog.com/nitridex/

    ReplyDelete
  20. Zylix Plus through the lymphatic framework to another zone of the body. What's more, a moment task may be required.
    http://www.drozhealthblog.com/zylix-plus/

    ReplyDelete
  21. I am unquestionably making the most of your site. You certainly have some extraordinary understanding and incredible stories.


    WorldWide Life Styles
    Download AcMarket

    ReplyDelete
  22. If your main aim is to increase your profile and presence in the mobile space, it's a good idea to start off by taking advantage of existing technologies.ShowBox APK 2018

    ReplyDelete
  23. When you open the site of any versatile application advancement organization, begin by checking their portfolios. Custom Software Development Company

    ReplyDelete

  24. Hats off to your presence of mind..I really enjoyed reading your blog. I really appreciate your information which you shared with us.
    ionic training in chennai

    ReplyDelete
  25. Have you ever thought about including a little bit more than just your articles? I mean, what you say is valuable and everything. However think of if you added some great visuals or videos to give your posts more, “pop”! Your content is excellent but with images and clips, this site could definitely be one of the best in its field. Amazing blog! facebook

    ReplyDelete
  26. Brilliant showed data. I thank you about that. Most likely it will be exceptionally valuable for my future ventures.
    Digital Marketing And Security Services

    ReplyDelete
  27. This application is entirely simple to utilize, yet at the same time a Help segment may be convenient. Vehicles in Sandbox: Construction is one of the best apps in its classification. speech app reviews

    ReplyDelete

Leave a comment here!