6

Is there any way to be notified, or otherwise run some code in an app, when the app is installed, but hasn't yet run? I'd like to send a notification to our server when the app is installed. Note that I'm not looking to do something the first time an app is run, but rather right after it's installed.

I'm guessing that this boils down to wanting to auto-launch the app in some way after install, which seems like something Apple would not allow. Hopefully I'm wrong.

Edit: Let me try to make this question sound a little less silly/impossible. I'm not trying to run code without running code. I'd like to figure out if there's a way to get a timestamp of when the app is downloaded, as opposed to when the user first launches it.

Thanks!

ManicBlowfish
  • 2,258
  • 2
  • 21
  • 29
  • Why would you care more about how many people install your app than you care about how many people actually _use_ your app? – Nicolas Miari Jul 18 '12 at 20:57
  • Are you trying to check whether Apple is lying to you about how many downloads you've had? The only way I can think of is to query iTunes Connect (but that doesn't help if it's Apple you don't trust, and it's probably not super real-time). See [this question about that](http://stackoverflow.com/questions/1619172/itunes-connect-api), but look past the Accepted answer. – Nate Jul 18 '12 at 22:17
  • No not thinking they're lying, and no didn't say I care "more" about this. Our app sends usage data to our servers, and would be swell if we could have it in one place. Thanks Nate for the link, I'll run that idea past the powers that be. – ManicBlowfish Jul 19 '12 at 20:18
  • This is actually a really good question - we've discovered many of our users are downloading the app, but not actually running it for the first time - the usual "can't be bothered to wait for download, do something else, forget about app." It would be nice if there was a function such as "applicationDidBecomeActive" (let's call it "applicationWasInstalled") where non UI tasks such as registering for push notifications could be done so that we could then send a reminder push notification "Hey, remember us?". Except of course Apple's UI policy requires nagging the user, but you see my point. – jmc Mar 10 '17 at 09:48

5 Answers5

4

I doubt that this be even technically possible. How do you want to run code without -- well, running code?

  • Well yes, that's what led me to write the second paragraph of my question. I'd like it if on download my app could be launched so I could ping the server and tell them we were installed. Sounds like that's not possible, but thought it might be worth asking. – ManicBlowfish Jul 19 '12 at 20:17
2

There's nothing you can do. Your app can't do anything until it's run for the first time.

kubi
  • 48,104
  • 19
  • 94
  • 118
2

The only way I could see this working is to run some code on first launch that updates a counter or something, server side and then subtracting it from your total downloads? This way you can see if users are downloading but not running the app.

BandoKal
  • 396
  • 1
  • 5
1

"run some code in an app, when the app is installed, but hasn't yet run" ???

What you are asking for is impossible (almost)

Nitin Alabur
  • 5,812
  • 1
  • 34
  • 52
1

As others have pointed out this is not possible. What I end up doing is logging when the user runs the app for the first time and track that via Google Analytics. I can always resort to iTunes Connect for the exact number of installs my app has had.

Additionally, if you want to track number of reinstalls you can store a value in the user's keychain (information in the keychain persists even if your app is deleted), and query it upon first launch and if it exists, its a reinstall.

Stunner
  • 12,025
  • 12
  • 86
  • 145