How to handle iOS Push Notifications: Design+Code

At TotSpot.me, 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

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.

Vikrant

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 http://www.youtube.com/watch?v=t894eGoymio

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 drawmics.com and findero.us. 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.
Vikrant

 

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.

 

REBOOT

 

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.

Roku Yupp TV Subscription – OR – How to charge your customers extra without telling them.

I had chat in the morning with Yupp Tv customer care and this is what happened.

Yupp Tv is an app that I have installed on Roku for Indian TV Channels.

In crux, these guys are just fleecing the customers without even proper terms and conditions.

Chat Transcript

Visitor: Vikrant
Operator: Bala
Company: globaltakeoff
Started: 1-Aug-2012 9:41:06 PM
Finished: 1-Aug-2012 10:11:36 PM

9:41:06 PM: Vikrant:
I have taken a Zee Marathi subscription of $14.99, but I am being charged $17.98. Can you tell my why this additional $4 charge?

9:41:06 PM:

Welcome Vikrant! Your request has been directed to the Billing Support department. Please wait for our operator to accept your chat.

9:42:07 PM:

There are no operators available at the moment. If you would like to leave a message, please type it in the input field below and click “Send” button

9:42:27 PM: Vikrant:
hello anybody there?

9:42:35 PM: Vikrant:
Mr Bala, can you help me?

9:42:44 PM:

Chat accepted by operator Bala. Currently in room: Vikrant, Bala. Thank you.

9:42:50 PM: Bala:
Welcome to YuppTV

9:42:59 PM: Bala:
Hi Vikrant

9:43:04 PM: Bala:
How are you doing?

9:43:15 PM: Vikrant:
Hi Bala. I am doing great. thanks

9:43:32 PM: Vikrant:
can you tell me why I am being charged $3 extra?

9:43:47 PM: Bala:
Please provide your Login Id, or Email ID with which you have registered on YuppTV.

9:43:55 PM: Vikrant:
xxxxxxxxxxx@gmail.com

9:45:22 PM: Bala:
Thanks for providing Email ID

9:45:34 PM: Bala:
Please give me a minute

9:45:37 PM: Vikrant:
sure

9:47:00 PM: Bala:
Thanks for waiting

9:47:15 PM: Bala:
I can see that you have activated 2 devices

9:47:35 PM: Vikrant:
yes but I have already paid 10 for one and 20 for another

9:47:54 PM: Bala:
So for 2nd device we will charge $20 as one time payment and there is recurring every month as $2.99

9:48:09 PM: Vikrant:
I didnt see that being mentioned anywhere

9:48:27 PM: Bala:
Your package is $14.99+2.99 its charged

9:48:56 PM: Vikrant:
and is there a way to deregister a device, since I am not using it

9:49:24 PM: Vikrant:
can you send me a link of site where it is mentioned that I need to pay a monthly extra charge for second device?

9:50:57 PM: Bala:
when you going to pay for 2nd device then it will shows you as recurring amount also

9:51:19 PM: Vikrant:
no it didn’t

9:51:52 PM: Vikrant:
and even if it did, show me your terms and conditions where it is mentioned about the second device extra charge

9:52:08 PM: Vikrant:
and if there is an extra charge why am I being charged $20 in the beginning

9:52:35 PM: Vikrant:
you guys are totally fleecing the customers

9:53:14 PM: Vikrant:
Send me proper documentation of charges

9:53:16 PM: Bala:
Sorry madam we are already mention when customer will subscribe for devices

9:53:43 PM: Vikrant:
what do you mean sorry? I want the documentation

9:53:58 PM: Vikrant:
am I paying the money for charity?

9:54:31 PM: Vikrant:
show me the documentation

9:54:33 PM: Bala:
We already mention activation charges in website

9:54:44 PM: Vikrant:
so give me the link where I can see

9:54:58 PM: Bala:
please go to device selection and select any device then check it sir

9:55:46 PM: Vikrant:
are you dumb? which part are you not able to understand? I am asking you to give me the link or documentation where it says about the second device

9:55:47 PM: Bala:
Through your email id

9:57:00 PM: Bala:
http://www.yupptv.com/sony enter your credential then check it

9:58:35 PM: Vikrant:
this link is useless

9:58:47 PM: Vikrant:
where does it say about second device extra charge?

9:59:18 PM: Bala:
select any device then click on it with your email id

10:00:09 PM: Vikrant:
its not there

10:00:59 PM: Vikrant:
I cannot see it

10:01:33 PM: Vikrant:
Either you refund my $3 or send me the link to a legal documentation where it mentions about the second device charge

10:01:44 PM: Bala:
Please select any package then click on buy now then select any device

10:02:21 PM: Vikrant:
I am not willing to pay $3 extra for a fucking crappy service and documentation where people just want to take money without telling the customers

10:02:45 PM: Vikrant:
I don’t want to select any package. Send me the link or the documentation

10:03:11 PM: Vikrant:
copy/paste the link here where it exactly says that I need to pay extra for second device

10:04:30 PM: Vikrant:
??

10:04:49 PM: Vikrant:
see, I don’t have all the time in the world to wait here for you answers

10:05:07 PM: Vikrant:
give me the legal documentation and I will see what I need to do

10:06:01 PM: Vikrant:
I have to tell other people about your unethical practices so that they don’t come to subscribe for yupp tv ever

10:06:10 PM: Bala:
Please follow above steps you will find out every thing about the 2nd device charges

10:07:22 PM: Vikrant:
I am sure you are not able to understand what I am saying

10:07:36 PM: Vikrant:
send me the fucking link or legal documentation

10:08:04 PM: Bala:
http://www.yupptv.com/DeviceSelection.aspx

10:08:17 PM: Bala:
Please click on above link then check it

10:09:03 PM: Vikrant:
it doesnt say anything about the second device

10:09:11 PM: Vikrant:
neither does your Terms and Conditions

10:09:40 PM: Vikrant:
Sorry, I will have to take this up with my lawyer about your unethical practices

10:09:54 PM: Vikrant:
it’s not just the matter of $3

10:10:09 PM: Vikrant:
it’s about not communicating correctly to you customers

10:10:18 PM: Vikrant:
and without any proper documentation

10:10:21 PM: Bala:
You have to select your device then it will shows you

10:10:45 PM: Vikrant:
Do you think I started chatting with you without doing all that shit?

10:11:20 PM: Vikrant:
Forget about it. I will talk to my lawyer and get back to you

My Experiments With Ideas