My Experience in Developing Maxis Circle Watch

Maxis Circle Watch is a mobile application project funded by Maxis Berhad and developed by SecqMe Sdn. Bhd. It is a location base security mobile apps. You can monitor the location of your family members on a map at any minute. If any of the family members is in trouble, he/she can trigger an emergency and you will receive the notification though the app/sms/email. I am the iOS developer for SecqMe Sdn. Bhd.

Maxis Circle Watch is the First major iOS mobile development project that I developed entirely by myself. It is a complex mobile Application. There are a lot of programming works required on both the server end and front end (mobile apps – iOS/Android).

Menu View Controller
Map View controller
CircleVCCircle View controller

Maxis Circle Watch Project Complexity

– There are a lot of APIs call between the front end and the server end.
– Sometimes, we have to go through a lengthy discussion to decide whether a certain programming logic should be done on the Server end or the front end mobile application. The decision is important to make sure the consistency of the mobile application in future updates.
– Sometimes after I found a bug/crash, I could not pinpoint the exact location of the problem immediately. I have to do some steps-by-steps troubleshooting to diagnose the problem to see if it is my fault on the front end or the fault on the server end programming by my colleague.
– There are a few different types of membership with different access/function rights. (eg: Admin rights, Guardian rights, paid users (pay using mobile billing vs In App Purchase), trial users, Maxis users, non-maxis users, members using SSO, members without SSO, Android users, iOS users).
– Before calling any APIs. We have to check if the user has the rights to call.
– After an APIs is called, the information returned from the server could be currently used by a few current active view controllers. We will have to update those view controllers accordingly. (eg: When I add a new member into a circle, I call the addMember API and got the new circle list from the server. After I updated the latest circle list in a shareModel, I have to notify some active classes (Map and Circle Table) which are using those properties to reflect the latest changes.

WatchOverMeVCWatchOverMe View Controller
ShakeToTriggerVCShakeToTrigger View controller
Emergency View Controller

Project Planning and Development

The project was started about 3 months earlier before I joined SecqMe Sdn. Bhd on August 2013. So, the server end programming and also the Android project has started 3 months ahead of the iOS version.

The design for this app was done before the release of iOS 7. So, the current design for this app is really targeted only for iOS 6 and below.

My colleague and my boss have been very helpful, they have provided me a lot of resources in order to catch up with the Android development.

The iOS version has been released only about 2 weeks later than the Android version.

Circle Watch iOS Project Development and Technical Features

I have to make a few key decisions when developing Circle Watch.

Apple Map vs Google Map
One of them is choosing either the Apple Native Map or Google Map. I was new to location and map technology when I started. My colleague who was the Android developer was using Google map. After I did some research on Google Map for iOS, I learned that it had all the APIs and functions that were needed for the purpose of our project. During that time (August 2013), I believed that the Google Map technology was very stable and far more superior than Apple Map. So, I decided to use Google Map in this project.

Container View Controller
Circle Watch has been designed to have a unique navigation. There are at least 4 active view controllers at the same time. There are 5 active view controllers when “Shake to Trigger” is activated. It is not a common navigation that you see in most apps.

When I first started, I didn’t plan carefully on the navigation. I only utilised the default UINavigationController that is provided by Xcode. After about 2 weeks into developing the project, then only I realised my mistake. I quickly researched into other Xcode technology that can be used and I found Container View Controller.

I fall in love with Container View Controller every since. It is such a powerful technology that makes the complex navigations look like a child play.

Getting Location in iOS 7
Since the release of iOS 7, some well established iOS applications have problem with getting the location from the phone in the background continuously without being terminated by the OS. I have faced the same issue as well. After a few weeks of researching and trying different solutions to solve the issue, I found a solution to solve that problem. You can see the details here: Background Location Update Programming for iOS 7.

Battery Consumption
Before I found the solution stated above, one other solution that works well but it consumes more than 10% of battery per hour. The solution above only consumes about 5% of battery per hour.

I understand the solution that I applied on this project might not be the most elegant solution. I believe if I have time to learn more about multithreading and also the background services API in iOS 7, I definitely will be able to develop a better solution that consumes less battery.

Circle Member View Controller
Member Details View controller
SafeZone View Controller

Future Project Development for Circle Watch

Maxis Berhad has been going through a major company re-organization with a new CEO and a new team of management. Some employees have been laid off and some projects have been cancelled.

Circle Watch is one of the lucky few projects that is still alive and ongoing. However, they are not able to provide additional funding to develop additional features that are not planned during the initial project agreement.

Thus, the design for Circle Watch still looks like the design for iOS 6.

Maxis hasn’t start to market this app yet. So, We do not have a lot of downloads for Circle Watch yet. We were informed that it is under their marketing plan later this year (2014).

Final Thoughts

Thanks to my boss and colleague, the help that they have provided has enable me to learn and develop this complex project in a “fast tracking” way. Of course, I put a lot of effort myself as well by working voluntarily during the weekend and after office hours (without claiming any OT).

There are a lot of improvements can be done in the current project. For example: add extra animation when moving from one View Controller to another. Make the transition for different view controllers more smoothly. I didn’t have time to improve that because I have to work on another complex project (Watch Over Me 3.0) immediately when the Circle Watch was completed.

Circle Watch just had its soft launch. It is still too early to tell if this project will be successful or not. I personally think this project will see a higher chance to be successful if Maxis is willing to provide additional funding to enhance the design and also add additional social features.

With a more polished design, social features and also marketing campaigns, the chance for this app to reach users who are willing to pay to use this service will be greatly increased.

If you are from Malaysia, you should able to download the app from both the Apple Appstore and Google Playstore: Maxis Circle Watch.

Circle Watch Video Demonstration from the XCode with Simulator

Market Share for iOS 7

This is a follow up post from the previous post on Decision to optimize for older iOS versions.

Since the existence of iPhone and iOS in 2007, we do not have a way to confirm 100% on the percentage of different iOS versions in the market. We can only use some sample sizes by some famous mobile apps that share their statistics. From the statistics, we estimate the real distribution for different iOS versions.

A few months ago, Apple has updated its developer portal webpage by letting the developers know the current statistics distribution such as the market share for different iOS version and also the App Review status for both iOS and Mac. This is a great update from Apple as the iOS developers do not have to guess the real distribution of the iOS versions again by collecting sample and statistics.

As of 9 February 2014, 82% of the devices are using iOS 7, 15% of the devices are using iOS 6 and only 3% are still using iOS 5 and earlier versions.

Updated on June 2014, 89% of the devices are using iOS 7, Less than 11% of the devices are using iOS 6 and below. After iOS 8 is released, the marketshare for iOS 6 and below could drop to below 5%.

You may find the real iOS marketshare distribution from the Apple here: iOS market share distribution by Apple.
iOS 7 Market Share

Mobile Application development companies or developers now know that there are at least 82% of the entire iOS ecosystem is using iOS 7 since 9 Feb 2014. They could make the key decision not to spend time in optimizing the older version iOS such as iOS 6 and below.

For me, the current project that I handled, I already dropped the support for iOS 6 and below.

Background Location Update Programming for iOS 7 and iOS 8

Before iOS 7, I used some location update solutions found from stackoverflow. After the iOS 7 is released, the location update (especially on background) is not working well in iOS 7. There are many existing location based apps had the same problem. It was due to the background services in iOS 7 which kill the app when the app is in suspended state.

After a few weeks of trial and error in experimenting many different solutions, I finally found one solution that works well for the app that I need to develop.

Note: The solution might not be elegant. It works well for what I want to create. When I am free, I am still constantly looking for more elegant solutions by exploring the background services in iOS 7.

iOS Application States and Multitasking

Before I dig deeper into the location services, I would like to share a bit on the iOS app states. It is very important for iOS 7 and above because we have multitasking background services starting from this version.

iOS App States


There are basically 5 states:-
1. Inactive – The app is running on foreground but there is no activity at the moment.
2. Active – The app is running on foreground and there are some activities.
3. Background – The app is on the background and still executing code. The app can move to suspended mode anytime now. But, the app can request extra time in executing code for a short period of time.
4. Suspended – The app is on the background and not executing code. Normally, the system will move app from background mode to this state automatically without any notification. But the app is still in memory.
5. Not running – The app is either not running or has been terminated by the system during low memory condition.

Most of the solutions before iOS 7 work well because during that time the system does not have multitasking and the system does not automatically move the app from background mode to suspended mode.

So, if your app needs consistent location update from the device, you will have to implement a solution that constantly refresh the app when it is in background mode so that it has a short period of time in executing the code and send the location to your server.

For more information on App States and Multitasking, you can visit: Guidelines by Apple on App States and Multitasking.

Background Location Update Programming for iOS 7

Behaviour of the location service that the app I have to develop:-
1. During the normal time, the app has to send the location to the server every 3 minutes.
2. When the user is running event, the app has to send location to the server every 1 minute.
3. The location has work both in foreground and background.

So, this app will get the location from the phone all the time. I have tested many solutions and the solution below works exactly as I needed and it consumes about 5% of battery per hour.

First of all, if you are using storyboard, you will have to make sure that “location update” under the Background Modes is enable. Screen shot as below:-
iOS 7 Location Background Mode This is very important as without that your app will not be able to get location when it is in background.

I created a class just to handle the location service. The most important function from the locationManager delegate is didUpdateLocations. You will need to know how to handle this function properly. I have programmed to make the locationManager restarts every 1 minute. When the locationManager is started, it will only last for 10 seconds to receive locations update from the device. So basically, the location Manager is only turned on for 10 seconds for 60 seconds.

I have tested on my device and it only consumes about 5-6% of battery every hour. The most important function is listed below with some explanation.

Updated on February 2014: Added the solution on Github and post to the thread in stackoverflow.

Updated on April 2014: EC has found a fix for the location update for an extended period of time.

Updated on May 2014: I received some requests by some developers (through email contact and the comment area of this post) on the sample codes for sending the locations to server on a certain time interval. I have added the sample codes and I have integrated EC’s fix on BackgroundTaskManager.m too. Full Solution: Background Location Update for iOS 7 with Location Update to Server.

Updated on September 2014: I have updated the solution to work in iOS 8. A new key NSLocationAlwaysUsageDescription has been added to the PList. It is a requirement in iOS 8 to inform the users on the reasons you need the location update from their devices. [locationManager requestAlwaysAuthorization]; has to be called in iOS 8 as well when getting the location.

Getting Location Updates for iOS 7 and 8 when the App is Killed/Terminated/Suspended

I have promised to write an article related to getting Location Updates for iOS 7 and 8 when the App is Killed/Terminated/Suspended. I have had a busy development schedule in the last few months until the New Year Holiday break. Finally, I have time to write the articles and post the solution on Github.

Please read this article for more details: Getting Location Updates for iOS 7 and 8 when the App is Suspended.

How to Use Container View Controller

Container View Controller is one of the interesting View Controllers that I used recently in XCode. Apple has provided many standard view controllers for iOS Developer in XCode such as Table View Controller, Tab Bar Controller, Navigation View Controller for most common standard projects for iOS developers. But for a certain projects with unique design, we have to use container view controller.

I have been using container view controller for a while and I love it. Here is a simple guide on how to use it. I will create a simple mobile app with 3 different view controllers:-

Simple Container View Controller Programming Example

1. MainVC
2. ProfileVC
3. Menu VC

– Contain a navigation with 2 buttons.
– When the Profile button is clicked, the MainVC will slide to left and the ProfileVC will appear.
– When the Menu button is clicked, the Main VC will slide to right and the MenuVC will appear.

Profile View controller
Main View controller style=
Menu View controller

Container View Controller Project Setup

Update: I have been busy for the last few months, just updated this post on February 2014.

Step 1: Create a new project and delete the existing .h and .m file that was created by the XCode

Step 2: Create the subclasses below:-
MainVC, MenuVC, ContainerVC and ProfileVC subclass of UIViewController
ShareSetting subclass of NSObject

Step 3: Link the existing view controller objects on storyboard with ContainerVC.

Step 4: Drag and drop the Container View in storyboard into the ContainerVC View Controller object. Rename this Container View as “MenuVC”. The position and side for this container view should be X: -260 Y: 20 Width: 320 Height: 548. Attach the MenuVC subsclass to the view controller comes with the Container View.

Step 5: Drag and drop another Container View into the same view controller and name it as “ProfileVC”. X: 260 Y: 20 Width: 320 Height: 548. Remember to attach ProfileVC subclass to the created view controller.

Step 6: Drag and drop the last Container View and name it as “MainVC”. X: 0 Y: 20 Width: 320 Height: 548. Attach the subclass to the view controller.

Step 7: Change background for each view controller object (MainVC, MenuVC and ProfileVC) to different colors.

Step 8: Add a title to MenuVC and ProfileVC

Step 9: Add a simple navigation bar and 2 buttons to MainVC.

If you are doing correctly, you should see a screen shot similar to below:
Simple Container View Controller Programming Setup

Container View Controller Coding

1. ShareSetting
– This class is basically used to share actions/behavior for the same buttons across a few different view controllers. Although in this simple project, we only have 1 view controller that uses the buttons. In more complex projects, we usually need this ShareSetting. Add the following codes to the class.

In ShareSettings.h

In ShareSettings.m

2. ContainerVC
– This is the main class that control the animation behavior for 3 different view controllers (MainVC, MenuVC and ProfileVC)

In ContainerVC.m

3. MainVC
– This is the Main View Controller which contains the navigation bar, the Menu Button and Profile Button.
– The 2 buttons that were created on the storyboard should be “Control + Drag” into the subclass. So that there will be 2 functions created in the subclass and every time the button is tapped, we will receive the action in the functions.

Last Step: You are done! For your information, the MenuVC and ProfileVC subclasses are created but there is no function for this simple example. You may add tableview to MenuVC and create a real profile for ProfileVC by adding some text field, photo and etc.

For more information, you can check Out: View Controller Programming Guide for iOS

Go-Eco – Mobile Application That Rewards Anyone Who Helps the Environment

I was at the Global Startup Youth organized by Startup Malaysia. This event was attended by over 500 youth from over 60 countries who are either developers, hustlers, domains experts or youth leaders. The youth was helped by over 100 mentors to solve some of the world biggest problems using mobile applications in 2 days time. There are 4 categories: Environment, Education, Health and Women Empowerment.

I was in Team 4 under the Environment category and I am the main coder. Our team consists of mostly Malaysian with 1 person from Morocco, another from Russia and the last one from West Africa (Sierra Leone).

We came out with a mobile app idea with the following features:-
1. Educate users related to environmentally issue
2. Encourage people to take actions to help the environment
3. People will gain points from the actions they take or the education that they learn.

The points that they gain from the mobile app can be used to exchange for vouchers by our sponsors such as (Starbuck, YTL, Old Town Kopitiam, Machines and etc). Our team leader went to talk to a few reputable companies and some of them are interested to join this project as part of their corporate social responsibility. But, the deal does not materialised yet as we only have 2 days. Shall the project continues in the future, I believe we really will have the real sponsor vouchers.

Please allow me to introduce you: Go-Eco. The app is using as the backend server. Go-Eco has the following screens:-
1. Login
2. Sign Up
3. Profile
4. Learning
5. Challenges
6. Redemption

Most of the functions of the app are already completed. We have the real login and sign up (connect to Parse). The points addition and reduction (for completing learning, challenges and redemption)

The followings are the real screen shots from the app itself.
Go-Eco Login Go-Eco Sign Up

Go-Eco ProfileGo-Eco Learning

Go-Eco LearningGo-Eco Learning

Go-Eco ChallengesGo-Eco Challenges

Go-Eco ChallengesGo-Eco Redemption

Go-Eco Redemption

It has been a nice experience working with Team 4. They are really focused and committed. We are also lucky to have a great graphic designer in our team. Unfortunately, we didn’t win under the environment category, the judges certainly have different opinions on what they think is the best app under the environment category. Winning is not the main purpose here. It is the team work and our effort to produce something that will help this world.

Lastly, I am very happy the mobile app that we produced in just 2 days time. It is functional and very polished. We shall see if we are able to bring Go-Eco forward.

Should We Optimize for Older Version of iOS?

When we are programming for a new mobile application, we come definitely come to this question: “Should we optimize for older version of iOS like 5.1, 5.0 or even 4.3?” This is an important question that I believe most of the Mobile Application development company have. Especially, there are some special requirements requested by the customers to optimize for all different versions of iOS.

Before we decide on whether we should optimize for older iOS versions or before we convince our clients on what iOS version that their apps should support, I believe we should know the current market share of the different iOS versions. From there, we will understand if we should invest our time to optimize for older iOS versions. From understand the market share trend, we are able to estimate the potential future trend.

Market Share of Different iOS Versions

From my research, Apple itself never releases the statistics and market share of its products. But, I found a few reliable sample statistics from some trustworthy mobile applications developers who released the statistics using their own apps or platform.

The First statistics is by David Smith from his own iOS App (Audiobooks). This app is one of the most popular iOS Application under the Book Genre. You can see the ranking statistics from App Data and App Annie: AudioBooks App Data and AudioBooks App Annie. This app is within the top 50 app in Book Genre for both iPhone and iPad version in all (Top Free, Top Grossing and Top Paid) categories in many different countries. I can’t find the download statistics by David, but I believe it is at least 100,000 downloads per week.

So, this 100,000 downloads per week is a good sample to know the marketshare of the iOS versions. The Last Update for the statistics was 23 July 2013 (About a week ago from this post):.

All Platforms:
iOS 6.X (6.0, 6.1): 91.2%
iOS 5.X (5.0, 5.1): 7.5%
iOS 4.X: 1.4%

iPhone Only:
iOS 6.X: 95.5%
iOS 5.X: 3.5%
iOS 4.X: 1.0%

iPad Only:
iOS 6.X: 86.6%
iOS 5.X: 12.2%
iOS 4.X: 1.6%

iPod Touch Only:
iOS 6.X: 81.8%
iOS 5.X: 15.6%
iOS 4.X: 2.6%

As you can see, people who own Apple gadgets update to the latest Operating System (OS) fairly fast. Over 90% of the users have the latest iOS version.

More details on iOS version marketshare by David Smith: iOS Version Stats

Another Statistics is from Unity3D, a 3D game engine that is able to deploy to multiple mobile platforms including iOS. Unity3D is quite a big company and there are many games are released under this game engine. I believe there are millions of devices running this game engine. The last updated date for the statistics was April 2013.

iOS 6.X (6.0, 6.1): 89.1%
iOS 5.X (5.0, 5.1): 9.5%
iOS 4.X: 1.4%

As you can see, we have close to 90% of the gadgets are running on the latest iOS version. Remember that this statistics is over 3 months old. I believe that the real statistics as of today (late July 2013) will definitely pass 90%.

You can see more details of the statistics here:-
Unity3D Mobile Hardware Statistics
iOS Version Stats by Unity3D

Decision to Optimize for Older iOS Version?

Based on the above statistics, I believe this decision is not hard to make. If your company has a lot of resources and time for a project, you might be able to optimize for all the older versions of iOS. But, it might not be worth it as the market share of the older iOS versions is not much (less than 10%). From my experience, gadgets that are still using older iOS versions might not be able to get the most out of your mobile apps even if they can download it. It is due to low memory storage and slower CPU speed. I have seen applications crashed due to low memory issue.

Personally, I believe that the time spent to optimize for older iOS version is not worth it. I would prefer to spend time to optimize for the best user experience for the gadgets with the latest version of iOS.

Apple Updates the iOS versions and Xcode Frequently

One thing that you have to know is that Apple updates the iOS versions and Xcode quite frequently. We can see the new version of iOS every year. Same with the Xcode. There are a few subversions updates for the same year.

Here are some examples of the different technologies in Xcode for different iOS versions:-
Only iOS 5 and above supports Storyboard (a technology inside the Xcode). If you are trying to optimize your application for older version (iOS 4.X), then you are not able to use this technology. Or you have to use your Application Delegate to use different technology when detecting different iOS versions.

Only iOS 6 and above supports Auto-Layout on the storyboard. And again, the app with auto layout will not be running on iOS 5.1 and below. So, if you want to optimize for both iOS 6.X and 5.X, you might need to have 2 different storyboards to do so.

Apple is a forward looking company. They will phrase out the support of the old version of iPhone/iPad when the time is right. So, I believe that we (as iOS Mobile Developer) should be forward looking as well. We should use the latest technologies provided by the Apple.