tugce
tugce

Reputation: 661

How to communicate between two apps in iOS?

There is an app like interactive magazine and in my app I need to know user activity in ther other app. I am interested in things like whether user watched video, how much time did the user spend on which page. In my app, user's activity can seen in a detailed graphical way. The other app can give me any permission if required, but our Apple ID's not same.

Is this possible and how? Can you give me some references?

Upvotes: 3

Views: 4037

Answers (2)

Gokila Dorai
Gokila Dorai

Reputation: 100

It is important to know that apps on the iPhone run in a sandbox in order to be secure. There are 2 ways to manage communication between apps. One way is to manage communication between apps through registered URL handlers. Here is an outline of how to set that up. The other way is to use peer-to-peer networking over Wi-Fi and Bluetooth. Here is an outline of the same, especially for iOS 7.0 or later.

Upvotes: 1

hotpaw2
hotpaw2

Reputation: 70673

Here are a couple possible methods which have been used for inter-application communication on an iPhone.

One app can push the data to a remote server with a device UDID or user account tag, and the other app (when launched by the user, or by URL) can pull the data with the matching UDID or user account from that same server. You may have to make the user sign up for a unique account and password on your server to protect their privacy.

One app can register a custom URL handler for receiving a data reply, and the other app can register a custom URL handler for receiving a data request. Have the first app send a URL that requests the data, and then the second app can return data back to the requesting app encoded within the other custom URL. This requires custom handlers in be added to both apps. Several apps are reported to handle updates from Free to Paid versions that way.

Apps used to use the notes field of a custom Address Book entry, or photo metadata, but Apple may no longer be allowing that.

Upvotes: 3

Related Questions