Package apple.watchconnectivity
Class WCSession
- java.lang.Object
-
- org.moe.natj.general.NativeObject
-
- org.moe.natj.objc.ObjCObject
-
- apple.NSObject
-
- apple.watchconnectivity.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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceWCSession.Block_sendMessageDataReplyHandlerErrorHandler_1static interfaceWCSession.Block_sendMessageDataReplyHandlerErrorHandler_2static interfaceWCSession.Block_sendMessageReplyHandlerErrorHandler_1static interfaceWCSession.Block_sendMessageReplyHandlerErrorHandler_2-
Nested classes/interfaces inherited from class apple.NSObject
NSObject.Function_instanceMethodForSelector_ret, NSObject.Function_methodForSelector_ret
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedWCSession(org.moe.natj.general.Pointer peer)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static booleanaccessInstanceVariablesDirectly()voidactivateSession()The default session must be activated on startup before the session's properties contain correct values and will begin receiving delegate callbacks.longactivationState()The state of the current sessionstatic WCSessionalloc()static java.lang.ObjectallocWithZone(org.moe.natj.general.ptr.VoidPtr zone)NSDictionary<java.lang.String,?>applicationContext()Setting the applicationContext is a way to transfer the latest state of an app.static booleanautomaticallyNotifiesObserversForKey(java.lang.String key)static voidcancelPreviousPerformRequestsWithTarget(java.lang.Object aTarget)static voidcancelPreviousPerformRequestsWithTargetSelectorObject(java.lang.Object aTarget, org.moe.natj.objc.SEL aSelector, java.lang.Object anArgument)static NSArray<java.lang.String>classFallbacksForKeyedArchiver()static org.moe.natj.objc.ClassclassForKeyedUnarchiver()static java.lang.StringdebugDescription_static()static WCSessiondefaultSession()Use the default session for all transferring of content and state monitoring.WCSessionDelegatedelegate()A delegate must exist before the session will allow sends.static java.lang.Stringdescription_static()booleanhasContentPending()Whether or not there is more content for the session to deliverstatic longhash_static()WCSessioninit()static NSObject.Function_instanceMethodForSelector_retinstanceMethodForSelector(org.moe.natj.objc.SEL aSelector)static NSMethodSignatureinstanceMethodSignatureForSelector(org.moe.natj.objc.SEL aSelector)static booleaninstancesRespondToSelector(org.moe.natj.objc.SEL aSelector)booleanisComplicationEnabled()Check if the user has the Watch app's complication enabledbooleanisPaired()Check if iOS device is paired to a watchbooleanisReachable()The counterpart app must be reachable for a send message to succeed.static booleanisSubclassOfClass(org.moe.natj.objc.Class aClass)static booleanisSupported()Check if session is supported on this iOS device.booleanisWatchAppInstalled()Check if the user has the Watch app installedstatic NSSet<java.lang.String>keyPathsForValuesAffectingValueForKey(java.lang.String key)static java.lang.Objectnew_objc()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).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).NSDictionary<java.lang.String,?>receivedApplicationContext()Stores the most recently received applicationContext from the counterpart app.longremainingComplicationUserInfoTransfers()The number of calls remaining to transferCurrentComplicationUserInfo: before the system starts transferring the complicationUserInfo as regular userInfos.static booleanresolveClassMethod(org.moe.natj.objc.SEL sel)static booleanresolveInstanceMethod(org.moe.natj.objc.SEL sel)voidsendMessageDataReplyHandlerErrorHandler(NSData data, WCSession.Block_sendMessageDataReplyHandlerErrorHandler_1 replyHandler, WCSession.Block_sendMessageDataReplyHandlerErrorHandler_2 errorHandler)Clients can use this method to send message data.voidsendMessageReplyHandlerErrorHandler(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.voidsetDelegate(WCSessionDelegate value)A delegate must exist before the session will allow sends.voidsetDelegate_unsafe(WCSessionDelegate value)A delegate must exist before the session will allow sends.static voidsetVersion_static(long aVersion)static org.moe.natj.objc.Classsuperclass_static()WCSessionUserInfoTransfertransferCurrentComplicationUserInfo(NSDictionary<java.lang.String,?> userInfo)Enqueues a user info dictionary containing the most current information for an enabled complication.WCSessionFileTransfertransferFileMetadata(NSURL file, NSDictionary<java.lang.String,?> metadata)The system will enqueue the file and transfer it to the counterpart app at an opportune time.WCSessionUserInfoTransfertransferUserInfo(NSDictionary<java.lang.String,?> userInfo)The system will enqueue the user info dictionary and transfer it to the counterpart app at an opportune time.booleanupdateApplicationContextError(NSDictionary<java.lang.String,?> applicationContext, org.moe.natj.general.ptr.Ptr<NSError> error)static longversion_static()NSURLwatchDirectoryURL()Use this directory to persist any data specific to the selected Watch.-
Methods inherited from class apple.NSObject
accessibilityActivate, accessibilityActivationPoint, accessibilityAssistiveTechnologyFocusedIdentifiers, accessibilityAttributedHint, accessibilityAttributedLabel, accessibilityAttributedUserInputLabels, accessibilityAttributedValue, accessibilityContainerType, accessibilityCustomActions, accessibilityCustomRotors, accessibilityDecrement, accessibilityDragSourceDescriptors, accessibilityDropPointDescriptors, accessibilityElementAtIndex, accessibilityElementCount, accessibilityElementDidBecomeFocused, accessibilityElementDidLoseFocus, accessibilityElementIsFocused, accessibilityElements, accessibilityElementsHidden, accessibilityFrame, accessibilityHint, accessibilityIncrement, accessibilityLabel, accessibilityLanguage, accessibilityNavigationStyle, accessibilityPath, accessibilityPerformEscape, accessibilityPerformMagicTap, accessibilityRespondsToUserInteraction, accessibilityScroll, accessibilityTextualContext, accessibilityTraits, accessibilityUserInputLabels, accessibilityValue, accessibilityViewIsModal, addObserverForKeyPathOptionsContext, attemptRecoveryFromErrorOptionIndex, attemptRecoveryFromErrorOptionIndexDelegateDidRecoverSelectorContextInfo, autoContentAccessingProxy, awakeAfterUsingCoder, awakeFromNib, class_objc, classForCoder, classForKeyedArchiver, copy, dealloc, debugDescription, description, dictionaryWithValuesForKeys, didChangeValueForKey, didChangeValueForKeyWithSetMutationUsingObjects, didChangeValuesAtIndexesForKey, doesNotRecognizeSelector, fileManagerShouldProceedAfterError, fileManagerWillProcessPath, finalize_objc, forwardingTargetForSelector, forwardInvocation, hash, indexOfAccessibilityElement, isAccessibilityElement, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableArrayValueForKey, mutableArrayValueForKeyPath, mutableCopy, mutableOrderedSetValueForKey, mutableOrderedSetValueForKeyPath, mutableSetValueForKey, mutableSetValueForKeyPath, observationInfo, observeValueForKeyPathOfObjectChangeContext, performSelector, performSelectorInBackgroundWithObject, performSelectorOnMainThreadWithObjectWaitUntilDone, performSelectorOnMainThreadWithObjectWaitUntilDoneModes, performSelectorOnThreadWithObjectWaitUntilDone, performSelectorOnThreadWithObjectWaitUntilDoneModes, performSelectorWithObject, performSelectorWithObjectAfterDelay, performSelectorWithObjectAfterDelayInModes, performSelectorWithObjectWithObject, prepareForInterfaceBuilder, provideImageDataBytesPerRowOrigin_Size_UserInfo, removeObserverForKeyPath, removeObserverForKeyPathContext, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, self, setAccessibilityActivationPoint, setAccessibilityAttributedHint, setAccessibilityAttributedLabel, setAccessibilityAttributedUserInputLabels, setAccessibilityAttributedValue, setAccessibilityContainerType, setAccessibilityCustomActions, setAccessibilityCustomRotors, setAccessibilityDragSourceDescriptors, setAccessibilityDropPointDescriptors, setAccessibilityElements, setAccessibilityElementsHidden, setAccessibilityFrame, setAccessibilityHint, setAccessibilityLabel, setAccessibilityLanguage, setAccessibilityNavigationStyle, setAccessibilityPath, setAccessibilityRespondsToUserInteraction, setAccessibilityTextualContext, setAccessibilityTraits, setAccessibilityUserInputLabels, setAccessibilityValue, setAccessibilityViewIsModal, setIsAccessibilityElement, setNilValueForKey, setObservationInfo, setShouldGroupAccessibilityChildren, setValueForKey, setValueForKeyPath, setValueForUndefinedKey, setValuesForKeysWithDictionary, shouldGroupAccessibilityChildren, superclass, validateValueForKeyError, validateValueForKeyPathError, valueForKey, valueForKeyPath, valueForUndefinedKey, willChangeValueForKey, willChangeValueForKeyWithSetMutationUsingObjects, willChangeValuesAtIndexesForKey
-
-
-
-
Method Detail
-
accessInstanceVariablesDirectly
public static boolean accessInstanceVariablesDirectly()
-
alloc
public static WCSession alloc()
-
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()
-
instanceMethodForSelector
public static NSObject.Function_instanceMethodForSelector_ret instanceMethodForSelector(org.moe.natj.objc.SEL aSelector)
-
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.
-
sendMessageDataReplyHandlerErrorHandler
public void sendMessageDataReplyHandlerErrorHandler(NSData data, WCSession.Block_sendMessageDataReplyHandlerErrorHandler_1 replyHandler, WCSession.Block_sendMessageDataReplyHandlerErrorHandler_2 errorHandler)
Clients can use this method to send message data. All the policies of send message apply to send message data. Send message data is meant for clients that have an existing transfer format and do not need the convenience of the send message dictionary.
-
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.
-
-