Skip to content

Add a way to force the app to update if the user never restarts their phone or exits the app #21

@ExplodingCabbage

Description

@ExplodingCabbage

Currently, if the user never restarts the app, updated versions loaded from AppHub will never get run. Since certainly some people I know keep their iPhones on perpetually and never fully exit apps, this means they could be waiting a long time between updates.

My boss @TobyAbel recently raised this by email with @benthehenten asking whether there was any built-in way to deal with this problem (there isn't) and suggesting that otherwise we can roll our own logic to quit the app from the background so that it can update. Ben agreed we'd need to handle such a case manually. But I think there's actually a fair bit of nuance here and it would be good to hash out how to do this publicly and then - if it is indeed possible - to add a method to the library that implements this logic.

Interface-wise, I'm imagining being able to add something like

[AppHub restartAndLoadNewBuildWhenInactiveForMinutes: 60];

to my AppDelegate.m in order to have the app request background execution time to kill itself whenever there is a new build waiting to be run and it has been inactive for at least an hour.

This seems like it's probably pretty easy for somebody familiar with the native framework's API to bash out, but tricky for every React Native developer to need to roll themselves, which to my eyes justifies including it in the SDK. Thoughts?

Also, does anybody know whether doing this would even be allowed per Apple's rules? I've read contradictory things on the internet about the acceptability of calling exit(0). https://developer.apple.com/library/ios/qa/qa1561/_index.html is pretty explicit about it being a thing that should not be done, but I've read people claim to have successfully submitted apps to the app store that call it. Thoughts?

And if we can't implement killing the app from the background, what would be the nicest way to reinitialise the React Native part of it from the background instead, and can that similarly be nicely wrapped up in a method in this SDK?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions