How to handle iOS Push Notifications: Design+Code

At, we put the user experience at a priority and as a part of this we wanted to bring the whole ios remote push notifications experience to the easiest level as possible.
The best way to do it is to let the user see the notifications from wherever they are in the app. So this is what we did.
Before we delve into specifics, here is a short description on the design of the TotSpot app:
The user welcome and login screen:

image (3)

And once the user logs in, she gets the following view of the listed items:

image (2)

Here is the view of the settings from where a user can go into her notifications screen:

image (1)

We are using ECSlidingViewController for managing the pre-login/post-login view controllers and a UITabBarController for post-login screens to manage different tabs of the app.

Push Notifications Considerations
Now, push notifications can arrive to the app in one of the following states:
1. App is closed
2. App is running in the background
3. App is running in the foreground

Since we wanted the app to open up the notifications from any state in the app, the best way was to use the UITabBarController to present a modal view of the Notifications view controller as soon as the user taps the notifications from the notification center.

So for this we subclassed the UITabBarController just to implement the logic to open the modal notifications.

When the UITabBarController is initialized, this is what we did:

- (void)viewDidLoad
[super viewDidLoad];
// Do any additional setup after loading the view.
NSNotificationCenter* notifCenter = [NSNotificationCenter defaultCenter];
// Register the UITabBarController for notifications sent by the App delegate
[notifCenter addObserver:self selector:@selector(invokeRemoteNotifications:) name:kReceivedRemoteNotification object:nil];
[self invokeNotifications];

-(void) invokeRemoteNotifications:(NSNotification*) notification
[self invokeNotifications];

- (void) invokeNotifications
TotSpotAppDelegate* delegate_ = (TotSpotAppDelegate*)[[UIApplication sharedApplication] delegate];

if (delegate_.presentNotif) {
[self performSegueWithIdentifier:kShowNotificationsViewController sender:self];
delegate_.presentNotif = NO;

Now let’s go by each state of the app when a user taps on the received push notifications from the notification center:
State 1: App is closed.: The app is launched with the following code in the App Delegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

and we extract the launchOptions for remote notifications key:

// Extract the notification data
NSDictionary *notificationPayload = launchOptions[UIApplicationLaunchOptionsRemoteNotificationKey];
if (notificationPayload) {
BOOL notifId = [[notificationPayload objectForKey:@"notif"] boolValue];
if (notifId) {
//Send notifications to open up notifications
self.presentNotif = YES;
} else {
self.presentNotif = NO;

The “presentNotif” determines whether to open up the notifications later on in the UITabBarController. Once the UITabBarController is initialized, it will check for the presentNotif bool value and open up a modal view for Notifications.

2. App is running in the background
3. App is running in the foreground Following code is called in the App Delegate:

- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {
self.presentNotif = YES;
// Send a notification to the UITabBarController:
[[NSNotificationCenter defaultCenter] postNotificationName:kReceivedRemoteNotification object:self userInfo:nil];

The above code easily opens up a modal view controller from any state in the app and the user can immediately open up the notification, whether a like/ a buy/ or a sell purchase order changes and she can immediately take action.

I hope this post may help some of you who are considering implementing remote push notifications into their apps.


Musical Mobile

We put a new musical mobile on Vivan’s crib which he really loves and recognizes the music from far. Even I started liking the music and always thought that it belonged to some song that I had heard before. I began to wonder who came up with such a soothing music for the mobile.
Since the mobile was a clinking toy, it was hard to find the source. Anyways, I tried with Shazam app on my phone to see if it could recognize the music. Unfortunately, the app failed to find the song.

Damn! How am I gonna find the source?

The thought lingered on my mind and I really wished I could find out what song it is. I didn’t know whom to ask or where to look.

Then, just after a few days out of the blue, my brother sent me a text with a link to a lullaby on youtube. As soon as I heard the music, I was thrilled as I got the answer I have been searching for.

The song was Johannes Brahms lullaby and it is usually played in the clicking toys for babies. Here is the link to the lullaby and it is awesome

The quest is over, but here is something important that I learnt: Have wishes, they come true.

Ten Minute Magic

What a magical start of the day.
It is magical, because we discussed about the magic in our lives, I and my six year old, Saavi.
We got up early and got ready to go to her school and this is the conversation we ended up making.

Saavi: Daddy, I want a hamster.
Me: Remember what we talked about? We will go to a pet store this weekend and will see if you would like to have a hamster.
Saavi: NO. I want it NOW.
Me: Have patience. Patience is a virtue (a statement she heard a lot from our friend, Gagan, and she understands a bit about virtue).

Saavi: NO. I don’t want to have patience. I want a hamster NOW.

Me: I think you should have patience. You know why? because it is magical.
Saavi: If it is magical then I want to see it.

* She has recently been to a magic show at her school and has ‘seen’ magic. Of course if it is magical, we all should be able to see it. *

Me: You know what, there are certain magical things that cannot be seen. And, these magical things that cannot be seen are very powerful.
You can only feel the magic about these things if you pay close attention to them.

Saavi: Really?

Me: Sure. Let’s talk about other unseen magical things as well, like, Hard work and Love. Hard work is magical and so is Love. When you do hard work, you will see the magic happening around you. When you love someone, you will feel the magic around everyone. Just like mommy and daddy love you, everyone feels magical. When you do hard work with your artwork, everyone thinks it’s magical. We create magic with patience, hard work and love.

Saavi: I love to do hard work. But I don’t want to have patience.

Me: Now, thats the thing about unseen magical things. If you love one of them, you automagically learn other unseen magical things. Since you love to do hard work, you automagically learn patience and love. If you have patience, you automagically learn hard work and love. They are all connected.

Saavi: Yay, I love Patience. I love Hard work, I love Love.

With that we reached her school and I dropped her off with the biggest smile on her face. I felt magical.

Entrepreneurs Solve Problems

By now, everybody knows the definition of an entrepreneur: the one who solves real world problems.

I ┬áhave tried in my own way to solve real world problems with and But no one has discovered these solutions yet. Which is absolutely fine. Entrepreneurship is also about learning about things that you didn’t expect to happen.

Anyways, let me come straight to the point. Let’s try to solve world’s biggest problem: Money.

Money, if you come out of the denial, is the world’s biggest problem. We need to get rid of it. We need to cut it off from its roots. And the only way to do it is to stop using it absolutely.

A step so drastic is going to take a huge effort and involve masses, but I believe people today are willing to experiment for happiness and they wouldn’t mind cutting off the evil money from its roots.

How do I imagine it happening? Now you need to be here with me in my train of thoughts. Follow me closely.

Let’s call the people who don’t use any money, as ‘Pures’. Pures because they are not corrupted or are untouched by the evil of money.

  • Instead of money, Pures will use goodwill, or Karma if you will. Everybody will work out of love of humanity with expectations of nothing materialistic in return.
  • Pures will set up a shop where everything is free. People get things from here but they also have the obligation to fill up the shop for other to use.
  • Those who use this shop, will also become Pures and will have to take a pledge to keep their doors open for all other Pures.
  • The people who come to your house and are not Pures, will have take a pledge to become Pures themselves to use your facility. This means that they will have to follow all the rules stated above and below followed by other Pures.
  • The main driver behind every action will be love and nothing else.
So what do you say about solving this problem. It’s a big and a scary giant, but will all the love, the humankind can overcome any obstacle in its path.
If we can do this and forget about materialism, we can usher in a new era.
I really hope we do it.


2012 Reboot

The Mayan calendar is ending on 21st December 2012. There is supposed to be a big change in the world. We may not be expecting what will change but we would sure like to see what should change.

1. Materialism: Greed, money, cars, social status are all colors or Materialism. Let’s end it.

2. Pollution: Air, water, earth, space pollution should end and the Earth should start living it’s own life as it had been doing before we started violating it.

3. Corruption: Kill corruption and let’s bring integrity back in our lives.

4. Boundaries: Let’s erase boundaries: the boundaries between people; the boundaries between nations; the boundaries between loved ones; the boundaries between yourselves and the unknown.

5 . Love: It seems to have been sidelined and has lost it’s meaning in mankind’s greed. Let’s bring a change in the way we perceive love. Love is stunningly pure. Let’s bring the purity back into our lives.

There are many think that we would like to see them changed. But let’s take this date to reboot our lives. The rules of this game are simple: anything that doesn’t conform to Love, should be put to rest; anything that exudes love should be embraced.




Efforts And Time

How much effort should one put into achieving one’s goals?

Let me explain it to you with a simple, quite ordinary, easy to understand equation.

Efforts x Time = k

where k is Success.

It shows that there is an inverse relationship between efforts and time for a given success. More efforts will bring you success in lesser time. Lesser efforts will bring success later than usual.

So what’s the secret to becoming successful? I know what you are thinking; double your efforts, because we can’t control time, and become successful.

You may be right, but now, what if I tell you that you can control time? That, the variable which nobody thinks can be controlled does, in fact, act on your will?

Surprised? I hope not. Because this is what we do all day and night. We just don’t realize it’s potential and throw it away.

This is what goal setting is all about. Whatever your goals are, write them down in this format:

I want to be x in y space by the time z.

See, there is no mention of efforts. The only thing this goal talks about is, yes, a goal, and the end time by which you should have achieved it.

Do you know what the above equation normally is known as? Yeah you got that right. It’s called a dream.

So dream about your success from your heart and you will automatically start putting in the required efforts without even feeling tired.

We shouldn’t be worrying about efforts. The only thing we should worry about is the goal and how to achieve it.

Finderous Version 1.0.3

The Version 1.0.3 of Finderous has been approved by Apple and is already on Sale. This version has some interesting features that could easily add value to the users and help them find answers real quick and get a visual.

  1. Users can post questions at their desired location using images.
  2. Users can reply to questions with images.
  3. Hot link for tweeting either question or an answer.
  4. Auto-Follow their current location, so that they can remain in the notification loop for any activity at their current place. The users can turn the Auto-Follow settings by going to the user settings.

A real use case would be something like this: You are in Palo Alto and you have a date with a girl in San Francisco. She wants to go someplace quiet and eat Thai. You flick out your phone and post a question in San Francisco asking for a best quiet Thai restaurant.

You immediately get a reply for Osha Thai in SF and what’s more, you get a picture of the current scene there:

Whaddya Say?

By the way, I will let you in a little secret (shhhh). The android version is almost complete and is undergoing testing. Android Folks, you would soon be playing with it from Google Play.

Until then, Stay cool.


My Experiments With Ideas