PDA

View Full Version : how to determine the first time an app is run




beachdog
Nov 24, 2008, 04:15 PM
Hold on...my question isn't as simple as it sounds...

I want to know the *very first time* that a user runs my app after downloading it. If they delete it from their phone and then resync with their iTunes, I don't want to treat that as "the first time". And if they delete it from their device and iTunes, and go back and purchase it again, I *do* want that to qualify as *the very first time*.

Basically, I have a promotional offer I only want to extend once.

I also have a server piece involved, so if you can propose a solution that involves any sort of server-side requirement, that would be workable.

Any ideas?...



Dual Pistolas
Nov 24, 2008, 04:32 PM
You could save out a flag to the Standard User Defaults.

NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];

beachdog
Nov 24, 2008, 04:39 PM
You could save out a flag to the Standard User Defaults.

NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];

Thanks. But won't the user defaults for the app get destroyed when the app is deleted from the phone? And then if he re-syncs with his iTunes (assuming he did not remove it from iTunes), the next time he runs the app I would check the user defaults and determine, incorrectly, that this was the first time he'd run the app?

jeremy.king
Nov 24, 2008, 05:13 PM
Call home and store a UDID in your server back-end

http://stackoverflow.com/questions/227590/unique-identifier-for-an-iphone-app

beachdog
Nov 24, 2008, 05:16 PM
Call home and store a UID in your server back-end

http://stackoverflow.com/questions/227590/unique-identifier-for-an-iphone-app

By UID do you mean the unique device identifier (the 40-character hex value)? I agree that needs to be part of the solution, and it addresses the case where he deletes the app and then resyncs with iTunes, but what of the case where he does in fact purchase a second instance from the app store? I want to give him the promotional benefit in that case as well, which I won't if I am only tracking that device uniqueness. In other words, I don't want to give the benefit only once per device, I want to give it once per purchase.

ghayenga
Nov 24, 2008, 09:40 PM
By UID do you mean the unique device identifier (the 40-character hex value)? I agree that needs to be part of the solution, and it addresses the case where he deletes the app and then resyncs with iTunes, but what of the case where he does in fact purchase a second instance from the app store? I want to give him the promotional benefit in that case as well, which I won't if I am only tracking that device uniqueness. In other words, I don't want to give the benefit only once per device, I want to give it once per purchase.

How do you think that someone could purchase a second instance of your app for a single iPhone?

jeremy.king
Nov 25, 2008, 08:36 AM
http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIDevice_Class/Reference/UIDevice.html#//apple_ref/occ/instp/UIDevice/uniqueIdentifier

I want to give him the promotional benefit in that case as well, which I won't if I am only tracking that device uniqueness. In other words, I don't want to give the benefit only once per device, I want to give it once per purchase.

Assuming that person pays for a new version (existing versions would just be re-downloaded at no charge), then all you need to do is track the version AND UDID combination on your server to qualify the user.

detz
Nov 25, 2008, 08:52 AM
I plan on knowing how you plan on giving a discount...

Pring
Nov 25, 2008, 09:23 AM
I plan on knowing how you plan on giving a discount...

Indeed. I don't think Apple would be very happy with this, to be perfectly honest. They'll probably want all users created equally. Unless the app is passing off to another service which you charge for?

CarlosH
Nov 25, 2008, 09:24 AM
By UID do you mean the unique device identifier (the 40-character hex value)? I agree that needs to be part of the solution, and it addresses the case where he deletes the app and then resyncs with iTunes, but what of the case where he does in fact purchase a second instance from the app store? I want to give him the promotional benefit in that case as well, which I won't if I am only tracking that device uniqueness. In other words, I don't want to give the benefit only once per device, I want to give it once per purchase.

Well the only way he can accomplish this is by using another iPhone, meaning another UUID, but even there, he would need to use another account. When you download an app from the Appstore, it "knows" the user it download it, so I can download the app as many times as I want, and I will not be charged every time. Unless I use a different user.

beachdog
Nov 25, 2008, 09:24 AM
Thanks for all the feedback and suggestions. I'm starting to think that what I want to do isn't possible, but let me back up and try to do a better job of describing the problem I am trying to solve.

I want to sell an app which provides a type of communication service, in concert with a server application that I manage. As part of the initial purchase of my app, the user will also get X minutes of usage of this communication service. After the X minutes runs out, they will need to purchase a "minutes refill". Now, clearly the typical approach would be to drive them go to a web site I provide where they would signup and purchase add'l minutes through a credit card or paypal. That may be the way I go, but I would much prefer if I could simply sell them these additional minutes through iTunes. The question is, is this possible and if so by what means

Thus, I had thought one approach would be to sell a second product which is simply a minutes refill -- the user purchases and downloads it, runs it once and it communicates with my server and puts more minutes in their account. This is what led me to the original question of how I would prevent them from running that app more than once (i.e., can an app be "disposable"). And secondly, it also begs the question some of you have raised, how can I also allow the user to purchase a second instance of the same product to get a second refill later.

Does Apple provide any way of handling a sale like this? To me, it's completely analagous to selling razors and blades -- I want to sell both through iTunes if possible, not just the razors.

detz
Nov 25, 2008, 10:19 AM
No, you will have to do it from your website.

firewood
Nov 25, 2008, 10:49 AM
Read the app store guidelines. You can't sell "blades" (successive identical purchases to the same user). Every app sale is to a user, and they can then use the purchased app on as many devices as they have access to.

It does appear that you can give away an app for a commercial subscription web service, and limit each subscription to a device UDID. You will have to figure out another way to collect your subscription payments though, as the App store only collects for the app.

.

beachdog
Nov 25, 2008, 01:15 PM
Read the app store guidelines. You can't sell "blades" (successive identical purchases to the same user)....
.

Appreciate the heads up. Oh well, at least the path is clear at this point:o

Appreciate the feedback from all on this thread.