Apple Watch and iphone communication - iphone

I am implementing apple watch app with in my existing app.I need to full fill these task between both iphone and watch
1) sending data from watch to iphone Done (by using openParentApplication).
2) getting call back also done (using openParentApplication call back method)
3) I need to get apple watch notify when user click on a button on iphone app .I have implemented reverse functionality using openParentApplication.
I stuck how to update apple watch UI after user click on any button or any particular task happen on iphone app.
Please let me know is there any way to perform passing event and data from iphone to apple watch

Please use this link https://github.com/mutualmobile/MMWormhole for communication between iphone and watchKit.

You should checkout the new WCSessionDelegate is watchOS 2.0. It can be implemented on both the Apple Watch and contains multiple methods for sending data back and forth between the two devices. Detailed information can be found in the WWDC video Introducing Watch Connectivity

Related

Share Data From Apple Watch to iPhone

I am trying to Transfer Watch Data to the Application. I have tried to Research but the Tutorials are outdated. I am new to Watch development! I am thankful for any help I can get! :)
Trying to Pass Watch Button Text to iPhone Application
ON WATCH
let watchBatteryLevel = WKInterfaceDevice.current().batteryLevel
self.button.setTitle(watchBatteryLevel)
ON IPHONE
Your Watch Battery is .....
If the watch app is not running it can't send a message to the iPhone app, and it cannot be launched from the iPhone app, so I don't know if your idea will make sense.
But you can send a message from a running watch app to the iPhone using the WCSession class functions.
https://developer.apple.com/documentation/watchconnectivity/wcsession
transferUserInfo is one function that may do what you want

How can Apple Watch listen to data change on iPhone?

Let's say the iPhone has a text field or any internal data, upon the data change, I want to push it automatically to the Apple Watch. I know I can use the share data. But that seems to require user to initiate the call (e.g. pressing a button) on the Watch. Is there a listener on the Apple Watch that I can use if there is a change in the shared data? Or there is way for the iPhone to automatically push data to the watch, and the watch just receive it and display it? Or any other way?
You can see this answer. MMWormhole seems a good way to communicate between App and its extensions (i.e. Watch App).
Hope this helped.

Getting notification of iOS device usage in background

Might be i am using a wrong title but i will try to explain here what i want.
In iOS i need to implement a functionality to get notify if the user is using their iOS device.
My app will be running in background using location services and i need to find out if the the user is using their device. It is doable as i have looked into this application which is sending notifications in background to the drivers who is suing their devices while driving.
https://itunes.apple.com/fr/app/cellcontrol/id661169580?l=en&mt=8&ign-mpt=uo=2
So i need similar kind of functionality to find out if a user is using iOS device or not. If anyone of you can suggest me any approach then it would be great for me to start.
Thank you!
Note: I have tried to find out touch events in background but that is not possible as i have done some research on this.
You won't be able to receive touch events when the app is in background using public API's. However, you can do that with the help of mobileSubstrate library ( http://iphonedevwiki.net/index.php/MobileSubstrate - The MobileHooker component is the one that would be used). by hooking your process to the OS. As an example, the display recorder app in Cydia tracks global gestures while recording the screen. This will be a cydia tweak and you will need to jailbreak your device to do all that.
Coming to your specific use-case, the example app you cited should be using one of the exceptions for background applications mentioned in https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/ManagingYourApplicationsFlow/ManagingYourApplicationsFlow.html (see the section - "Implementing Long-Running Background Tasks"), probably the one to receive updates from external accessories.

Can we play prerecorded message in a call through iPhone app?

I want to create an iPhone app with following features:
User should be able to make a call to number.
App will play the prerecorded message when call get connected.
After playing the message, line will be connected and user will be able to communicate with the person to whom he made the call.
I heard that Apple doesn't allow the developers to interact with the calling functionality of iPhone but is there any way to achieve this. Please suggest!
Thanks-
You have heard correctly, According to Apple Developer Library, it is not possible to intercept the calling functionality.
Simple Apple does not allow such stuff with current sdk.
Not so sure but, May be possible for jailbroken iPhone app.

Checking incoming call notification in iPhone

I am working on iPhone game application, in which user can play game and records some data.
My problem is that the application not supporting background processing. In my application if call's appearing then my application is terminated. But I need to save user current state.
I have read some blog and post in which they have mention that core telephony frame work can give us all such state and notification. But someone mention that core telephony API is an private API. If will use this API then APPLE accept my application or not? I need to save my application current state.
You are looking for the answers in the wrong place. You do not need any access to the telephony API.
Apps by default enter the background and return to the foreground, on modern devices and iOS versions - Perhaps you are running your app on an older device or on iOS version 3.x, in which case all apps (not just yours) will be terminated when they are "exited".
Even in this case the solution is not the telephony API, but handling a notification sent to your app about your application terminating - You can save state there, and then reload it when your app is re-run.
Check out these links for more information:
App states and transitions
Multitasking