Interface WCSessionDelegate


  • public interface WCSessionDelegate
    ----------------------------- WCSessionDelegate ----------------------------- The session calls the delegate methods when content is received and session state changes. All delegate methods will be called on the same queue. The delegate queue is a non-main serial queue. It is the client's responsibility to dispatch to another queue if neccessary.
    • Method Detail

      • sessionActivationDidCompleteWithStateError

        void sessionActivationDidCompleteWithStateError​(WCSession session,
                                                        long activationState,
                                                        NSError error)
        Called when the session has completed activation. If session state is WCSessionActivationStateNotActivated there will be an error with more details.
      • sessionDidFinishFileTransferError

        default void sessionDidFinishFileTransferError​(WCSession session,
                                                       WCSessionFileTransfer fileTransfer,
                                                       NSError error)
        Called on the sending side after the file transfer has successfully completed or failed with an error. Will be called on next launch if the sender was not running when the transfer finished.
      • sessionDidFinishUserInfoTransferError

        default void sessionDidFinishUserInfoTransferError​(WCSession session,
                                                           WCSessionUserInfoTransfer userInfoTransfer,
                                                           NSError error)
        Called on the sending side after the user info transfer has successfully completed or failed with an error. Will be called on next launch if the sender was not running when the user info finished.
      • sessionDidReceiveApplicationContext

        default void sessionDidReceiveApplicationContext​(WCSession session,
                                                         NSDictionary<java.lang.String,​?> applicationContext)
        Called on the delegate of the receiver. Will be called on startup if an applicationContext is available.
      • sessionDidReceiveFile

        default void sessionDidReceiveFile​(WCSession session,
                                           WCSessionFile file)
        Called on the delegate of the receiver. Will be called on startup if the file finished transferring when the receiver was not running. The incoming file will be located in the Documents/Inbox/ folder when being delivered. The receiver must take ownership of the file by moving it to another location. The system will remove any content that has not been moved when this delegate method returns.
      • sessionDidReceiveMessage

        default void sessionDidReceiveMessage​(WCSession session,
                                              NSDictionary<java.lang.String,​?> message)
        Called on the delegate of the receiver. Will be called on startup if the incoming message caused the receiver to launch.
      • sessionDidReceiveMessageReplyHandler

        default void sessionDidReceiveMessageReplyHandler​(WCSession session,
                                                          NSDictionary<java.lang.String,​?> message,
                                                          WCSessionDelegate.Block_sessionDidReceiveMessageReplyHandler replyHandler)
        Called on the delegate of the receiver when the sender sends a message that expects a reply. Will be called on startup if the incoming message caused the receiver to launch.
      • sessionDidReceiveMessageData

        default void sessionDidReceiveMessageData​(WCSession session,
                                                  NSData messageData)
        Called on the delegate of the receiver. Will be called on startup if the incoming message data caused the receiver to launch.
      • sessionDidReceiveMessageDataReplyHandler

        default void sessionDidReceiveMessageDataReplyHandler​(WCSession session,
                                                              NSData messageData,
                                                              WCSessionDelegate.Block_sessionDidReceiveMessageDataReplyHandler replyHandler)
        Called on the delegate of the receiver when the sender sends message data that expects a reply. Will be called on startup if the incoming message data caused the receiver to launch.
      • sessionDidReceiveUserInfo

        default void sessionDidReceiveUserInfo​(WCSession session,
                                               NSDictionary<java.lang.String,​?> userInfo)
        Called on the delegate of the receiver. Will be called on startup if the user info finished transferring when the receiver was not running.
      • sessionDidBecomeInactive

        void sessionDidBecomeInactive​(WCSession session)
        Called when the session can no longer be used to modify or add any new transfers and, all interactive messages will be cancelled, but delegate callbacks for background transfers can still occur. This will happen when the selected watch is being changed.
      • sessionDidDeactivate

        void sessionDidDeactivate​(WCSession session)
        Called when all delegate callbacks for the previously selected watch has occurred. The session can be re-activated for the now selected watch using activateSession.
      • sessionReachabilityDidChange

        default void sessionReachabilityDidChange​(WCSession session)
        Called when the reachable state of the counterpart app changes. The receiver should check the reachable property on receiving this delegate callback.
      • sessionWatchStateDidChange

        default void sessionWatchStateDidChange​(WCSession session)
        Called when any of the Watch state properties change.