@@ -4,162 +4,138 @@ import AndroidContent
44import SwiftJava
55import SwiftJavaJNICore
66
7+ /// Manages NFC card emulation services, AID routing, and payment preferences.
8+ ///
9+ /// Card emulation allows Android devices to act as NFC cards. Obtain an instance via
10+ /// `CardEmulation.getInstance(_:)`. Requires the `FEATURE_NFC_HOST_CARD_EMULATION` feature.
11+ ///
12+ /// See also: [android.nfc.cardemulation.CardEmulation](https://developer.android.com/reference/android/nfc/cardemulation/CardEmulation)
713@available ( Android 19 , * )
814@JavaClass ( " android.nfc.cardemulation.CardEmulation " )
915open class CardEmulation : JavaObject {
10- /// Java method `setShouldDefaultToObserveModeForService` .
16+ /// Sets whether the given service should default to observe mode .
1117 ///
12- /// ### Java method signature
13- /// ```java
14- /// public boolean android.nfc.cardemulation.CardEmulation.setShouldDefaultToObserveModeForService(android.content.ComponentName,boolean)
15- /// ```
18+ /// - Parameter arg0: The component name of the card emulation service.
19+ /// - Parameter arg1: `true` to default to observe mode.
20+ /// - Returns: `true` if the setting was applied.
1621 @available ( Android 35 , * )
17- @JavaMethod
22+ @JavaMethod
1823 open func setShouldDefaultToObserveModeForService( _ arg0: ComponentName ? , _ arg1: Bool ) -> Bool
1924
20- /// Java method `registerPollingLoopFilterForService` .
25+ /// Registers a polling loop filter for the given service .
2126 ///
22- /// ### Java method signature
23- /// ```java
24- /// public boolean android.nfc.cardemulation.CardEmulation.registerPollingLoopFilterForService(android.content.ComponentName,java.lang.String,boolean)
25- /// ```
27+ /// - Parameter arg0: The component name of the card emulation service.
28+ /// - Parameter arg1: A hex string filter for matching polling loop data.
29+ /// - Parameter arg2: `true` to auto-transact when the filter matches.
30+ /// - Returns: `true` if the filter was registered.
2631 @available ( Android 35 , * )
27- @JavaMethod
32+ @JavaMethod
2833 open func registerPollingLoopFilterForService( _ arg0: ComponentName ? , _ arg1: String , _ arg2: Bool ) -> Bool
2934
30- /// Java method `registerPollingLoopPatternFilterForService` .
35+ /// Registers a regex pattern filter for the given service's polling loop data .
3136 ///
32- /// ### Java method signature
33- /// ```java
34- /// public boolean android.nfc.cardemulation.CardEmulation.registerPollingLoopPatternFilterForService(android.content.ComponentName,java.lang.String,boolean)
35- /// ```
37+ /// - Parameter arg0: The component name of the card emulation service.
38+ /// - Parameter arg1: A regex pattern to match against polling loop data.
39+ /// - Parameter arg2: `true` to auto-transact when the pattern matches.
40+ /// - Returns: `true` if the filter was registered.
3641 @available ( Android 35 , * )
37- @JavaMethod
42+ @JavaMethod
3843 open func registerPollingLoopPatternFilterForService( _ arg0: ComponentName ? , _ arg1: String , _ arg2: Bool ) -> Bool
3944
40- /// Java method `removePollingLoopPatternFilterForService` .
45+ /// Removes a previously registered polling loop pattern filter .
4146 ///
42- /// ### Java method signature
43- /// ```java
44- /// public boolean android.nfc.cardemulation.CardEmulation.removePollingLoopPatternFilterForService(android.content.ComponentName,java.lang.String)
45- /// ```
47+ /// - Parameter arg0: The component name of the card emulation service.
48+ /// - Parameter arg1: The pattern string to remove.
49+ /// - Returns: `true` if the filter was removed.
4650 @available ( Android 35 , * )
47- @JavaMethod
51+ @JavaMethod
4852 open func removePollingLoopPatternFilterForService( _ arg0: ComponentName ? , _ arg1: String ) -> Bool
4953
50- /// Java method `getRouteDestinationForPreferredPaymentService`.
51- ///
52- /// ### Java method signature
53- /// ```java
54- /// public java.lang.String android.nfc.cardemulation.CardEmulation.getRouteDestinationForPreferredPaymentService()
55- /// ```
54+ /// Returns the route destination (e.g., `"HCE"`, `"OffHost"`) for the preferred payment service.
5655 @available ( Android 35 , * )
57- @JavaMethod
56+ @JavaMethod
5857 open func getRouteDestinationForPreferredPaymentService( ) -> String
5958
60- /// Java method `isDefaultServiceForCategory` .
59+ /// Returns `true` if the given service is the default for the specified category .
6160 ///
62- /// ### Java method signature
63- /// ```java
64- /// public boolean android.nfc.cardemulation.CardEmulation.isDefaultServiceForCategory(android.content.ComponentName,java.lang.String)
65- /// ```
66- @JavaMethod
61+ /// - Parameter arg0: The component name of the card emulation service.
62+ /// - Parameter arg1: One of `CATEGORY_PAYMENT` or `CATEGORY_OTHER`.
63+ @JavaMethod
6764 open func isDefaultServiceForCategory( _ arg0: ComponentName ? , _ arg1: String ) -> Bool
6865
69- /// Java method `isDefaultServiceForAid` .
66+ /// Returns `true` if the given service is the default handler for the specified AID .
7067 ///
71- /// ### Java method signature
72- /// ```java
73- /// public boolean android.nfc.cardemulation.CardEmulation.isDefaultServiceForAid(android.content.ComponentName,java.lang.String)
74- /// ```
75- @JavaMethod
68+ /// - Parameter arg0: The component name of the card emulation service.
69+ /// - Parameter arg1: The AID as a hex string.
70+ @JavaMethod
7671 open func isDefaultServiceForAid( _ arg0: ComponentName ? , _ arg1: String ) -> Bool
7772
78- /// Java method `categoryAllowsForegroundPreference` .
73+ /// Returns `true` if the given category allows foreground preference selection .
7974 ///
80- /// ### Java method signature
81- /// ```java
82- /// public boolean android.nfc.cardemulation.CardEmulation.categoryAllowsForegroundPreference(java.lang.String)
83- /// ```
84- @JavaMethod
75+ /// - Parameter arg0: One of `CATEGORY_PAYMENT` or `CATEGORY_OTHER`.
76+ @JavaMethod
8577 open func categoryAllowsForegroundPreference( _ arg0: String ) -> Bool
8678
87- /// Java method `getSelectionModeForCategory` .
79+ /// Returns the selection mode for the given category (e.g., `SELECTION_MODE_PREFER_DEFAULT`) .
8880 ///
89- /// ### Java method signature
90- /// ```java
91- /// public int android.nfc.cardemulation.CardEmulation.getSelectionModeForCategory(java.lang.String)
92- /// ```
93- @JavaMethod
81+ /// - Parameter arg0: One of `CATEGORY_PAYMENT` or `CATEGORY_OTHER`.
82+ @JavaMethod
9483 open func getSelectionModeForCategory( _ arg0: String ) -> Int32
9584
96- /// Java method `removePollingLoopFilterForService` .
85+ /// Removes a previously registered polling loop filter for the given service .
9786 ///
98- /// ### Java method signature
99- /// ```java
100- /// public boolean android.nfc.cardemulation.CardEmulation.removePollingLoopFilterForService(android.content.ComponentName,java.lang.String)
101- /// ```
87+ /// - Parameter arg0: The component name of the card emulation service.
88+ /// - Parameter arg1: The hex string filter to remove.
89+ /// - Returns: `true` if the filter was removed.
10290 @available ( Android 35 , * )
103- @JavaMethod
91+ @JavaMethod
10492 open func removePollingLoopFilterForService( _ arg0: ComponentName ? , _ arg1: String ) -> Bool
10593
106- /// Java method `unsetOffHostForService` .
94+ /// Clears the off-host secure element association for the given service .
10795 ///
108- /// ### Java method signature
109- /// ```java
110- /// public boolean android.nfc.cardemulation.CardEmulation.unsetOffHostForService(android.content.ComponentName)
111- /// ```
96+ /// - Parameter arg0: The component name of the card emulation service.
97+ /// - Returns: `true` if the association was cleared.
11298 @available ( Android 26 , * )
113- @JavaMethod
99+ @JavaMethod
114100 open func unsetOffHostForService( _ arg0: ComponentName ? ) -> Bool
115101
116- /// Java method `setOffHostForService` .
102+ /// Binds the given service to a specific off-host secure element .
117103 ///
118- /// ### Java method signature
119- /// ```java
120- /// public boolean android.nfc.cardemulation.CardEmulation.setOffHostForService(android.content.ComponentName,java.lang.String)
121- /// ```
104+ /// - Parameter arg0: The component name of the card emulation service.
105+ /// - Parameter arg1: The off-host secure element name (e.g., `"eSE"`, `"SIM"`).
106+ /// - Returns: `true` if the binding was applied.
122107 @available ( Android 26 , * )
123- @JavaMethod
108+ @JavaMethod
124109 open func setOffHostForService( _ arg0: ComponentName ? , _ arg1: String ) -> Bool
125110
126- /// Java method `removeAidsForService` .
111+ /// Removes AIDs registered by the given service for the specified category .
127112 ///
128- /// ### Java method signature
129- /// ```java
130- /// public boolean android.nfc.cardemulation.CardEmulation.removeAidsForService(android.content.ComponentName,java.lang.String)
131- /// ```
132- @JavaMethod
113+ /// - Parameter arg0: The component name of the card emulation service.
114+ /// - Parameter arg1: One of `CATEGORY_PAYMENT` or `CATEGORY_OTHER`.
115+ /// - Returns: `true` if the AIDs were removed.
116+ @JavaMethod
133117 open func removeAidsForService( _ arg0: ComponentName ? , _ arg1: String ) -> Bool
134118
135- /// Java method `setPreferredService` .
119+ /// Sets the given service as the preferred card emulation service while the activity is foreground .
136120 ///
137- /// ### Java method signature
138- /// ```java
139- /// public boolean android.nfc.cardemulation.CardEmulation.setPreferredService(android.app.Activity,android.content.ComponentName)
140- /// ```
121+ /// - Parameter arg0: The foreground activity.
122+ /// - Parameter arg1: The component name of the service to prefer.
123+ /// - Returns: `true` if the preference was set.
141124 @available ( Android 21 , * )
142- @JavaMethod
125+ @JavaMethod
143126 open func setPreferredService( _ arg0: Activity ? , _ arg1: ComponentName ? ) -> Bool
144127
145- /// Java method `unsetPreferredService `.
128+ /// Clears the preferred card emulation service set by `setPreferredService(_:_:) `.
146129 ///
147- /// ### Java method signature
148- /// ```java
149- /// public boolean android.nfc.cardemulation.CardEmulation.unsetPreferredService(android.app.Activity)
150- /// ```
130+ /// - Parameter arg0: The foreground activity.
131+ /// - Returns: `true` if the preference was cleared.
151132 @available ( Android 21 , * )
152- @JavaMethod
133+ @JavaMethod
153134 open func unsetPreferredService( _ arg0: Activity ? ) -> Bool
154135
155- /// Java method `supportsAidPrefixRegistration`.
156- ///
157- /// ### Java method signature
158- /// ```java
159- /// public boolean android.nfc.cardemulation.CardEmulation.supportsAidPrefixRegistration()
160- /// ```
136+ /// Returns `true` if the device supports AID prefix and subset registration.
161137 @available ( Android 23 , * )
162- @JavaMethod
138+ @JavaMethod
163139 open func supportsAidPrefixRegistration( ) -> Bool
164140}
165141@available ( Android 19 , * )
@@ -189,12 +165,10 @@ extension JavaClass<CardEmulation> {
189165 @JavaStaticField ( isFinal: true )
190166 public var SELECTION_MODE_PREFER_DEFAULT : Int32
191167
192- /// Java method `getInstance`.
193- ///
194- /// ### Java method signature
195- /// ```java
196- /// public static synchronized android.nfc.cardemulation.CardEmulation android.nfc.cardemulation.CardEmulation.getInstance(android.nfc.NfcAdapter)
197- /// ```
168+ /// Returns a `CardEmulation` instance for the given NFC adapter.
169+ ///
170+ /// - Parameter arg0: The `NfcAdapter` for this device.
171+ /// - Returns: A `CardEmulation` instance.
198172 @JavaStaticMethod
199173 public func getInstance( _ arg0: NfcAdapter ? ) -> CardEmulation !
200174}
0 commit comments