Class WCSession

  • All Implemented Interfaces:
    NSObject

    public class WCSession
    extends NSObject
    -------------------------------- WCSession -------------------------------- The default session is used to communicate between two counterpart apps (i.e. iOS app and its native WatchKit extension). The session provides methods for sending, receiving, and tracking state. On start up an app should set a delegate on the default session and call activate. This will allow the system to populate the state properties and deliver any outstanding background transfers.
    • Constructor Detail

      • WCSession

        protected WCSession​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static java.lang.Object allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(java.lang.Object aTarget,
                                                                                 org.moe.natj.objc.SEL aSelector,
                                                                                 java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        public static NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        public static org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • defaultSession

        public static WCSession defaultSession()
        Use the default session for all transferring of content and state monitoring.
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • isSupported

        public static boolean isSupported()
        Check if session is supported on this iOS device. Session is always available on WatchOS
      • keyPathsForValuesAffectingValueForKey

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • activateSession

        public void activateSession()
        The default session must be activated on startup before the session's properties contain correct values and will begin receiving delegate callbacks. Calling activate without a delegate set is undefined. If the WCSessionDelegate session:activationDidCompleteWithState:error: is implemented this method becomes an asynchronous call.
      • activationState

        public long activationState()
        The state of the current session
      • applicationContext

        public NSDictionary<java.lang.String,​?> applicationContext()
        Setting the applicationContext is a way to transfer the latest state of an app. After updating the applicationContext, the system initiates the data transfer at an appropriate time, which can occur after the app exits. The counterpart app will receive a delegate callback on next launch if the applicationContext has successfully arrived. If there is no app context, it should be updated with an empty dictionary. The applicationContext dictionary can only accept the property list types.
      • delegate

        public WCSessionDelegate delegate()
        A delegate must exist before the session will allow sends.
      • hasContentPending

        public boolean hasContentPending()
        Whether or not there is more content for the session to deliver
      • isComplicationEnabled

        public boolean isComplicationEnabled()
        Check if the user has the Watch app's complication enabled
      • isPaired

        public boolean isPaired()
        Check if iOS device is paired to a watch
      • isReachable

        public boolean isReachable()
        The counterpart app must be reachable for a send message to succeed.
      • isWatchAppInstalled

        public boolean isWatchAppInstalled()
        Check if the user has the Watch app installed
      • outstandingFileTransfers

        public NSArray<? extends WCSessionFileTransfer> outstandingFileTransfers()
        Returns an array of file transfers that are still transferring (i.e. have not been cancelled, failed, or been received by the counterpart app).
      • outstandingUserInfoTransfers

        public NSArray<? extends WCSessionUserInfoTransfer> outstandingUserInfoTransfers()
        Returns an array of user info transfers that are still transferring (i.e. have not been cancelled, failed, or been received by the counterpart app).
      • receivedApplicationContext

        public NSDictionary<java.lang.String,​?> receivedApplicationContext()
        Stores the most recently received applicationContext from the counterpart app.
      • remainingComplicationUserInfoTransfers

        public long remainingComplicationUserInfoTransfers()
        The number of calls remaining to transferCurrentComplicationUserInfo: before the system starts transferring the complicationUserInfo as regular userInfos. If this is 0, the complicationUserInfo will be transferred as regular userInfos. Count will be 0 whenever the complication is not enabled
      • sendMessageReplyHandlerErrorHandler

        public void sendMessageReplyHandlerErrorHandler​(NSDictionary<java.lang.String,​?> message,
                                                        WCSession.Block_sendMessageReplyHandlerErrorHandler_1 replyHandler,
                                                        WCSession.Block_sendMessageReplyHandlerErrorHandler_2 errorHandler)
        Clients can use this method to send messages to the counterpart app. Clients wishing to receive a reply to a particular message should pass in a replyHandler block. If the message cannot be sent or if the reply could not be received, the errorHandler block will be invoked with an error. If both a replyHandler and an errorHandler are specified, then exactly one of them will be invoked. Messages can only be sent while the sending app is running. If the sending app exits before the message is dispatched the send will fail. If the counterpart app is not running the counterpart app will be launched upon receiving the message (iOS counterpart app only). The message dictionary can only accept the property list types.
      • setDelegate_unsafe

        public void setDelegate_unsafe​(WCSessionDelegate value)
        A delegate must exist before the session will allow sends.
      • setDelegate

        public void setDelegate​(WCSessionDelegate value)
        A delegate must exist before the session will allow sends.
      • transferCurrentComplicationUserInfo

        public WCSessionUserInfoTransfer transferCurrentComplicationUserInfo​(NSDictionary<java.lang.String,​?> userInfo)
        Enqueues a user info dictionary containing the most current information for an enabled complication. If the app's complication is enabled the system will try to transfer this user info immediately. Once a current complication user info is received the system will launch the Watch App Extension in the background and allow it to update the complication content. If the current user info cannot be transferred (i.e. devices disconnected, out of background launch budget, etc.) it will wait in the outstandingUserInfoTransfers queue until next opportune time. There can only be one current complication user info in the outstandingUserInfoTransfers queue. If a current complication user info is outstanding (waiting to transfer) and -transferCurrentComplicationUserInfo: is called again with new user info, the new user info will be tagged as current and the previously current user info will be untagged. The previous user info will however stay in the queue of outstanding transfers.
      • transferFileMetadata

        public WCSessionFileTransfer transferFileMetadata​(NSURL file,
                                                          NSDictionary<java.lang.String,​?> metadata)
        The system will enqueue the file and transfer it to the counterpart app at an opportune time. The transfer of a file will continue after the sending app has exited. The counterpart app will receive a delegate callback on next launch if the file has successfully arrived. The metadata dictionary can only accept the property list types.
      • transferUserInfo

        public WCSessionUserInfoTransfer transferUserInfo​(NSDictionary<java.lang.String,​?> userInfo)
        The system will enqueue the user info dictionary and transfer it to the counterpart app at an opportune time. The transfer of user info will continue after the sending app has exited. The counterpart app will receive a delegate callback on next launch if the file has successfully arrived. The userInfo dictionary can only accept the property list types.
      • updateApplicationContextError

        public boolean updateApplicationContextError​(NSDictionary<java.lang.String,​?> applicationContext,
                                                     org.moe.natj.general.ptr.Ptr<NSError> error)
      • watchDirectoryURL

        public NSURL watchDirectoryURL()
        Use this directory to persist any data specific to the selected Watch. The location of the URL will change when the selected Watch changes. This directory will be deleted upon next launch if the watch app is uninstalled for the selected Watch, or that Watch is unpaired. If the watch app is not installed for the selected Watch the value will be nil.