Question

My first app (lets call it CoreApp) works in background. When this CoreApp receives silent push notification I would like to pass data to my second app (UiApp). Custom url scheme is not an option here because:

  • [[UIApplication sharedApplication] openURL:url] returns NO when CoreApp is in background.
  • If I open via url scheme, UiApp moves to foreground, but I want to keep it in background.

I am thinking of adding voip key to both apps and communicate through sockets.

Any other ideas? Both apps are not for appstore, so I am able to use any hacks.

EDIT

The goal is to increase badge number of UiApp when CoreApp received notification. So, I want pass simple int number from CoreApp to UiApp.

Was it helpful?

Solution 4

I decided to use 2 voip apps and communicate via sockets.

Function:

SBSetApplicationBadgeNumber(mach_port_t* port, char* appID, int number);

is not available on ios7 and I didn't find new api similar to this.

Darwin notification center & UIPasteboard works perfect when UiApp is in foreground, but when app is suspened Darwin notification are not received.

OTHER TIPS

First of all, take a look at my question regarding sharing data between apps: Sharing info between multiple iOS apps

If I were you, I would go with pasteboard or sockets.

On top of that, you may be interested to look at private API:

SBSetApplicationBadgeNumber(mach_port_t* port, char* appID, int number);

It was not protected by entitlement and you was able to set a badge on another application.

A solution, but I don't know if it can be of any use for you (please indicate what kind of data you want to share to the second app, what you want to do with it in this second app, and more especially: WHEN you need to have your second app work with this data)

Take a look at UIPasteboard,

+ (UIPasteboard *)pasteboardWithName:(NSString *)pasteboardName create:(BOOL)create

to create a pasteboard to be used by both your applications (you would probably want to set the persistent property to YES).

You can then use addItems: method to add elements to this pasteboard. When you launch your second application, it could look the content of the pasteboard, use it and then remove it.

Whenever the CoreApp received a remote push notification, call a url on background to the server, the server then increase the badge number and send out a remote push notification (with the new badge number) to UiApp.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top