Method for switching card, and electronic device

By establishing a link between cards and feature information in electronic devices, the problem of quickly switching to the correct card when multiple NFC cards are involved is solved, improving the success rate of NFC transactions and the user experience.

WO2026061320A1PCT designated stage Publication Date: 2026-03-26HUAWEI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Filing Date
2025-09-12
Publication Date
2026-03-26

AI Technical Summary

Technical Problem

When multiple NFC cards are added to an electronic device, it is difficult to quickly switch to the correct card to perform an NFC transaction, especially when the locations where multiple cards need to perform NFC transactions are close together, resulting in a poor user experience.

Method used

By acquiring characteristic information such as angle and direction of electronic devices when performing NFC transactions, a correlation is established between the target card and the characteristic information, thereby quickly matching the correct card when performing NFC transactions.

Benefits of technology

This increases the likelihood that electronic devices will automatically select the correct card to execute an NFC transaction, improving the user's card-swiping experience and transaction success rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025120980_26032026_PF_FP_ABST
    Figure CN2025120980_26032026_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the present application are a method for switching a card, and an electronic device. The method may be applied to an electronic device comprising a standard card and a non-standard card. The method comprises: during the execution of a first NFC transaction, acquiring first feature information of an electronic device, wherein the first feature information is used for indicating a first angle of the electronic device; on the basis of the first feature information, determining a target card from among NFC cards, wherein the target card is a standard card or a non-standard card; and using the target card to execute the first NFC transaction. In the technical solution, during the execution of an NFC transaction, an electronic device may quickly match a corresponding target card on the basis of feature information of the electronic device during the execution of the NFC transaction, and thus when the electronic device comprises a plurality of cards, the possibility that the electronic device automatically selects a correct card for the execution of an NFC transaction is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Method and electronic device for switching card

[0001] The present application claims priority to the Chinese patent application No. 202411313514.2, filed on September 19, 2024, and entitled "Method and electronic device for switching card", the content of which is incorporated herein by reference in its entirety. TECHNICAL FIELD

[0002] The present application relates to the field of electronic technology, and more particularly, to a method and an electronic device for switching card. BACKGROUND

[0003] Currently, a plurality of near field communication (NFC) secure services can be supported in an electronic device, which can be implemented by adding cards in the electronic device, such as bank cards, bus cards, access control cards, work cards, electronic identity cards, and vehicle keys.

[0004] In the case where a plurality of NFC cards are added in the electronic device, in different scenarios where NFC transactions need to be performed, the user hopes that the electronic device can automatically switch to the correct card. However, when the locations where the plurality of NFC cards need to perform NFC transactions are close, the electronic device can not quickly switch to the correct card to perform the NFC transaction.

[0005] Therefore, how to improve the possibility of the electronic device automatically switching to the correct card becomes a technical problem to be solved. SUMMARY

[0006] Embodiments of the present application provide a method and an electronic device for switching card. In the technical solution, when performing an NFC transaction, the electronic device can quickly match to a corresponding target card according to the characteristic information of the electronic device when performing the NFC transaction, so that when the electronic device includes a plurality of cards, the possibility of the electronic device automatically selecting the correct card to perform the NFC transaction can be improved.

[0007] In a first aspect, a method for switching card is provided, the method is applied to an electronic device, near field communication (NFC) cards in the electronic device include standard cards and non-standard cards, and the method includes: obtaining first characteristic information of the electronic device when performing a first NFC transaction, the first characteristic information is used to indicate a first angle of the electronic device; determining a target card from the NFC cards according to the first characteristic information, the target card is the standard card or the non-standard card; and performing the first NFC transaction using the target card.

[0008] For example, the standard card can include a bus card, a subway card, a door lock card, a work card, etc. The non-standard card can include an access control card, etc.

[0009] Based on the embodiments of the present application, when the electronic device performs an NFC transaction, the electronic device can obtain first feature information indicating an angle of the electronic device, and match a target card according to the first feature information, and perform the NFC transaction using the target card when the target card is matched.

[0010] In this way, when multiple cards are included in the electronic device, the target card can be matched according to the feature information obtained when the NFC transaction is performed, and the possibility of the electronic device automatically selecting a correct card to perform the NFC transaction is improved.

[0011] In some implementations, before the first NFC transaction is performed, the method further includes: in response to an operation of adding a first card, adding the first card in the electronic device; in response to an operation of successfully performing a second NFC transaction using the first card, obtaining second feature information of the electronic device, the second feature information being used to indicate a second angle of the electronic device; and associating the first card with the second feature information.

[0012] Based on the embodiments of the present application, when a new first card is added in the electronic device, when the electronic device successfully performs a card swiping operation using the first card, the electronic device can associate second feature information obtained when the card swiping operation is performed with the first card.

[0013] In this way, when the electronic device needs to perform a card swiping operation using the first card next time, the first card can be directly matched according to the feature information when the card swiping operation is performed, and the possibility of the electronic device correctly selecting a card is improved.

[0014] In some implementations, the determining the target card from the NFC cards according to the first feature information includes: when the first feature information matches the second feature information, determining that the target card is the first card associated with the second feature information.

[0015] Based on the embodiments of the present application, when the electronic device performs an NFC transaction, the electronic device can match real-time obtained first feature information with feature information of an associated card, and when the first feature information matches the second feature information, the electronic device can determine that a target card to be used is the first card associated with the second feature information.

[0016] In this way, by obtaining feature information when the electronic device performs an NFC transaction in real time, a corresponding card can be accurately matched.

[0017] In some embodiments, when the first NFC transaction is performed, the method further includes: in response to receiving a card selection instruction of the NFC device, determining that the first NFC transaction needs to be performed using the standard card; and wherein determining the target card from the NFC cards according to the first characteristic information includes: determining the target card from the standard cards included in the NFC cards according to the first characteristic information.

[0018] Based on the embodiments of the present application, the electronic device can have multiple standard cards. When the electronic device receives a card selection instruction, it can be determined that the standard card needs to be used for card swiping. The electronic device can determine the target card from the standard cards of the electronic device.

[0019] In this way, even if the characteristic information of card 1 in the standard card and card 2 in the non-standard card is the same, the electronic device can distinguish between the card 1 and the card 2, thereby improving the adaptability of the electronic device to card swiping and improving the correctness of card selection.

[0020] In some embodiments, when the first NFC transaction is performed, the method further includes: in response to not receiving a card selection instruction of the NFC device within a preset time length, determining that the first NFC transaction needs to be performed using the non-standard card; and wherein determining the target card from the NFC cards according to the first characteristic information includes: determining the target card from the non-standard cards included in the NFC cards according to the first characteristic information.

[0021] It should be understood that the present application does not limit the specific examples of the preset time length, for example, the preset time length can be 400 ms, 200 ms, etc.

[0022] Based on the embodiments of the present application, the electronic device can have multiple non-standard cards. When the electronic device does not receive a card selection instruction within a preset time length, it can be determined that the non-standard card needs to be used for card swiping. The electronic device can determine the target card from the non-standard cards of the electronic device.

[0023] In this way, even if the characteristic information of card 1 in the standard card and card 2 in the non-standard card is the same, the electronic device can distinguish between the card 1 and the card 2, thereby improving the adaptability of the electronic device to card swiping and improving the correctness of card selection.

[0024] In some embodiments, the NFC card is associated with a geographic fence, and the geographic fence is used to indicate a geographic area in which the electronic device performs an NFC transaction using the NFC card, and the determining the target card from the NFC card according to the first feature information comprises: determining a first geographic fence in which the electronic device is located when the first NFC transaction is performed; and determining the target card from the NFC cards associated with the first geographic fence according to the first feature information.

[0025] According to the embodiments of the present application, when the NFC card is associated with a geographic fence, the electronic device can determine the first geographic fence in which the electronic device is located when the NFC transaction is performed, and determine the target card from the NFC cards associated with the first geographic fence when the feature information is matched.

[0026] In this way, the feature information can be matched based on the cards in the geographic fence, so that the correct card can be selected for the cards in different geographic fences.

[0027] In some embodiments, the determining the target card from the NFC card according to the first feature information comprises: determining a plurality of candidate cards from the NFC card according to first information in the first feature information, the first information being information used to indicate an angle of the electronic device; and determining the target card from the plurality of candidate cards according to second information in the first feature information, the second information being information used to indicate a direction of the electronic device or fence information in which the electronic device is located.

[0028] For example, the first information can be acceleration information, and the second information can be direction information, fence information (such as signal fence), etc.

[0029] According to the embodiments of the present application, when the electronic device determines a plurality of candidate cards according to the first information, the target card can be further determined from the plurality of candidate cards according to the second information.

[0030] In some embodiments, the first feature information comprises at least one of the following information: direction information, acceleration information, geomagnetic information, or angular velocity information.

[0031] In other examples, the first feature information can further comprise geographic information, height information, etc.

[0032] In some embodiments, when the first feature information comprises multiple types of information including direction information, acceleration information, geomagnetic information, or angular velocity information, the first feature information is a feature sequence composed of the multiple types of information in a preset order.

[0033] Based on the embodiment of the application, the first feature information is a feature sequence composed of multiple information in a preset order, so as to improve the security of NFC transaction.

[0034] In some implementations, the first angle of the electronic device includes vertical, horizontal, and any angle between horizontal and vertical.

[0035] In this way, for NFC devices of different angles, the electronic device can correctly switch the card corresponding to the angle when performing NFC transaction, improving the user's card swiping experience.

[0036] In a second aspect, an electronic device is provided, including: one or more processors; one or more memories; the one or more memories store one or more programs, when the one or more programs are executed by the one or more processors, the method for switching cards as described in the second aspect to the sixth aspect and any possible implementation manner thereof is executed.

[0037] In a third aspect, an apparatus is provided, including modules for implementing the method for switching cards as described in the first aspect and any possible implementation manner thereof.

[0038] In a fourth aspect, a chip is provided, including a processor and a communication interface, the communication interface is used to receive a signal and transmit the signal to the processor, the processor processes the signal, so that the method for switching cards as described in the first aspect and any possible implementation manner thereof is executed.

[0039] In a fifth aspect, a readable storage medium is provided, the readable storage medium stores instructions, when the instructions are run on a device, the method for switching cards as described in the first aspect and any possible implementation manner thereof is executed.

[0040] In a sixth aspect, a program product is provided, the program product includes program code, when the program code is run on a device, the method for switching cards as described in the first aspect and any possible implementation manner thereof is executed. BRIEF DESCRIPTION OF DRAWINGS

[0041] FIG. 1 is a schematic architecture diagram of an electronic device provided by an embodiment of the application.

[0042] FIG. 2 is a structural schematic diagram of an electronic device provided by an embodiment of the application.

[0043] FIG. 3 is a schematic flow chart of establishing an association relationship between a target card and feature information provided by an embodiment of the application.

[0044] FIG. 4 is another schematic flow chart of establishing an association relationship between a target card and feature information provided by an embodiment of the application.

[0045] FIG. 5 is a schematic flowchart of a method for switching cards according to an embodiment of the present application.

[0046] FIG. 6 is a schematic interaction diagram of a method for switching cards according to an embodiment of the present application.

[0047] FIG. 7 is a schematic interaction diagram of another method for switching cards according to an embodiment of the present application.

[0048] FIG. 8 is a schematic flowchart of a method for switching cards according to an embodiment of the present application. DETAILED DESCRIPTION

[0049] The technical solutions in the present application will be described below with reference to the accompanying drawings.

[0050] The method in the embodiments of the present application can be applied to electronic devices such as smart phones, tablet computers, smart watches, smart wristbands, foldable devices, and the like.

[0051] Currently, a plurality of near field communication (NFC) secure services can be supported in an electronic device, and the NFC secure services can be implemented through cards added in the electronic device, such as bank cards, bus cards, access control cards, work cards, electronic identity cards, and vehicle keys.

[0052] In actual use, the electronic device can activate an applet corresponding to a card, so that the electronic device can subsequently perform a corresponding NFC service through the card.

[0053] Generally, the electronic device can divide the above-mentioned cards into standard cards (referred to as standard cards or AID cards) that can be distinguished through an application identity (AID) and non-standard cards (referred to as non-standard cards or non-standard cards or non-AID cards) that cannot be distinguished through an AID.

[0054] Among them, the card supporting the ISO / IEC 14443-4 protocol is also called a standard card. It should be noted that the ISO / IEC 14443-4 protocol uses AID to identify each card, so the card supporting the ISO / IEC 14443-4 protocol is also called an AID card. That is, the NFC device and the standard card in the electronic device first complete a preliminary handshake through the ISO / IEC 14443-3 protocol, and then interact with the instructions related to the transaction (for example, the NFC device sends an instruction to select a target card; the electronic device returns a response to the selected target card or a response to the unselected target card to the NFC device) and the like through the ISO / IEC 14443-4 protocol.

[0055] However, in real scenarios, there can also be cards in a secure element (SE) module that support the ISO / IEC 14443-3 protocol but do not support the ISO / IEC 14443-4 protocol, for example, a public transportation card that cannot achieve interconnection and intercommunication, an old version of an access control card, and the like. The card that supports the ISO / IEC 14443-3 protocol but does not support the ISO / IEC 14443-4 protocol is also referred to as a non-standard card, which can be referred to as a non-standard card for short. It should be further noted that in the ISO / IEC 14443-3 protocol, a user ID (UID) is used to identify each card, and therefore the non-standard card is also referred to as a UID card. Then, after the non-standard card in the electronic device and the NFC device complete the preliminary handshake through the ISO / IEC 14443-3 protocol, the non-standard card and the NFC device can directly interact with the instructions related to the transaction through the ISO / IEC 14443-3 protocol. That is, the electronic device can not receive the instruction sent by the NFC device through the ISO / IEC 14443-4 protocol to select a certain card.

[0056] The standard card is, for example, a public transportation card, a subway card, a key, an electronic certificate, and the like that achieve interconnection and intercommunication. The non-standard card is, for example, an access control card and the like.

[0057] In the case where multiple NFC cards are added to the electronic device, in different scenarios where NFC transactions need to be performed, the user hopes that the electronic device can automatically switch to the correct card. However, when the locations of the multiple NFC cards that need to perform NFC transactions are close to each other, the electronic device can not be able to quickly switch to the correct card to perform the NFC transaction.

[0058] Therefore, embodiments of the present application provide a method and an electronic device for switching a card. In the technical solution, when the electronic device successfully performs an NFC transaction, the electronic device can obtain feature information of the electronic device, such as an angle (for example, vertical, horizontal, and the like) of the electronic device, and associate the feature information with a target card used when the NFC transaction is performed. Subsequently, when an NFC transaction is performed, the electronic device can quickly match the target card according to the feature information of the electronic device when the NFC transaction is performed, so that when the electronic device includes multiple cards, the possibility that the electronic device automatically selects the correct card to perform the NFC transaction can be improved.

[0059] In the present application, the NFC transaction performed by the electronic device can also be understood as the electronic device using an NFC card to perform card swiping.

[0060] FIG. 1 is a schematic architecture diagram of an electronic device according to an embodiment of the present application. As shown in FIG. 1, the electronic device 100 can include at least an application (App) layer, an application framework layer, and a chip layer. The electronic device 100 can further include a system library, and a kernel layer (not shown in the figure).

[0061] The application layer can include a series of application packages. As shown in FIG. 1, the application packages can include at least camera, gallery, calendar, wallet, and the like.

[0062] In an embodiment of the present application, the wallet App can be used to manage cards for performing NFC services. For example, a user can add a subway card, a bus card, an access control card, and the like in the wallet App.

[0063] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications of the application layer. The application framework layer includes a series of pre-defined functions.

[0064] As shown in FIG. 1, the application framework layer can include a window manager, a content provider, a resource manager, a smart flash card service, a sensor service, and the like.

[0065] The window manager is used to manage window programs. The window manager can obtain the size of a display screen, determine whether there is a status bar, lock a screen, and the like.

[0066] The content provider is used to store and obtain data, and make the data accessible to applications. The data can include videos, images, audios, dialed and received calls, browsing history and bookmarks, phone books, and the like.

[0067] The resource manager provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, and the like.

[0068] The smart flash card service can be used to read the data of each sensor in the sensor service to determine corresponding feature information when the electronic device 100 performs NFC services, and perform subsequent operations such as automatic switching of cards.

[0069] The sensor service can be used to obtain data of various sensors. For example, the sensor service can include an acceleration sensor service, a magnetometer service, a gyroscope service, a barometer service, a location service, etc. Among them, the acceleration sensor service can be used to obtain three-axis acceleration information of the electronic device 100 when swiping the card, for example, the three-axis acceleration information can be used to determine the angle (such as horizontal, vertical, inclined, etc.) of the electronic device 100 when swiping the card; the magnetometer service can be used to obtain direction information when swiping the card, for example, the direction information can be the direction (east, south, west, north) of the electronic device 100; the barometer service is used to obtain height information of the electronic device 100 when swiping the card; the location service can be used to obtain location information of the electronic device 100 when swiping the card.

[0070] The application layer and the application framework layer can run in a virtual machine. The virtual machine executes the java files of the application layer and the application framework layer into binary files. The virtual machine is used to perform functions such as management of object life cycle, stack management, thread management, security and exception management, and garbage collection.

[0071] As shown in FIG. 1, the chip layer can include an NFC chip, a secure element (SE) chip, etc.

[0072] Among them, the SE chip can include an SE module, the SE module includes a chip operating system (COS) module, a contactless registry service (CRS) module, and an application (such as card 1, card 2…) in the SE module. The COS is the operating system of the SE module, which is used to preprocess the received application protocol data unit (APDU) instruction and distribute the instruction to the corresponding service or application program in the SE module for processing. The CRS is a system application in the SE module, responsible for registration management of the applications in the SE module, activating or deactivating (i.e. canceling activation) the applications in the SE module. The applications in the SE module can also be called Applet or card.

[0073] The NFC chip can include an NFC module, which can be used to support communication between the electronic device 100 and other NFC devices (such as card reading devices). The NFC module can include a contactless front-end (CLF), which is a controller of the NFC chip, can receive APDU instructions of the NFC device, and send the received APDU instructions to the card COS of the SE module, so that the COS distributes the received APDU instructions to the corresponding applications in the SE module for business transactions.

[0074] Exemplarily, FIG. 2 shows a structural schematic diagram of the electronic device 100. The electronic device 100 can include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a loudspeaker 170A, a receiver 170B, a microphone 170C, a headset interface 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, and the like. The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, and the like.

[0075] It can be understood that the structure illustrated in the embodiments of the present application does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 can include more or fewer components than illustrated, or combine certain components, or split certain components, or different arrangement of components. The illustrated components can be implemented in hardware, software, or a combination of software and hardware.

[0076] The processor 110 can include one or more processing units, for example: the processor 110 can include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), and the like. Different processing units can be independent devices, or can be integrated in one or more processors.

[0077] The controller can be the nerve center and command center of the electronic device 100. The controller can generate operation control signals according to instruction operation codes and timing signals, and complete the control of fetching and executing instructions.

[0078] The processor 110 can also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory can store instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instructions or data again, it can be directly called from the memory. This avoids repeated access and reduces the waiting time of the processor 110, thereby improving the efficiency of the system.

[0079] In some embodiments, the processor 110 can include one or more interfaces.

[0080] The charging management module 140 is configured to receive charging input from a charger.

[0081] The power management module 141 is configured to connect the battery 142 and the charging management module 140 to the processor 110.

[0082] The wireless communication function of the electronic device 100 can be realized by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, and the baseband processor, etc.

[0083] The mobile communication module 150 can provide a solution including 2G / 3G / 4G / 5G wireless communication applied to the electronic device 100.

[0084] The modem processor can include a modulator and a demodulator. The modulator is configured to modulate a low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is configured to demodulate a received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to a loudspeaker 170A, a receiver 170B, etc.), or displays an image or a video through the display screen 194. In some embodiments, the modem processor can be a separate device. In other embodiments, the modem processor can be independent of the processor 110, and can be arranged in the same device as the mobile communication module 150 or other functional modules.

[0085] The wireless communication module 160 can provide solutions for wireless communication including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), Bluetooth low energy (BLE), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), star flash, and the like, which are applied on the electronic device 100.

[0086] In some embodiments, the antenna 1 and the mobile communication module 150 of the electronic device 100 are coupled, and the antenna 2 and the wireless communication module 160 are coupled, so that the electronic device 100 can communicate with a network and other devices through wireless communication technology.

[0087] The electronic device 100 implements a display function through a GPU, a display screen 194, and an application processor, and the like. The GPU is a microprocessor for image processing, which is connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 can include one or more GPUs, which execute program instructions to generate or change display information.

[0088] The display screen 194 is used to display images, videos, and the like. The display screen 194 includes a display panel. The display panel can be made of liquid crystal display (LCD), or can be made of one of organic light-emitting diode (OLED), active-matrix organic light emitting diode (AMOLED), flex light-emitting diode (FLED), miniled, microled, micro-oled, or quantum dot light emitting diodes (QLED), and the like. In some embodiments, the electronic device 100 can include 1 or N display screens 194, and N is a positive integer greater than 1.

[0089] The electronic device 100 can implement a photographing function through an ISP, a camera 193, a video codec, a GPU, a display 194, and an application processor, etc.

[0090] The ISP is used to process data fed back by the camera 193. The camera 193 is used to capture a still image or a video.

[0091] The digital signal processor is used to process a digital signal, which can process not only a digital image signal but also other digital signals.

[0092] The video codec is used to compress or decompress a digital video.

[0093] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100.

[0094] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various function applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121.

[0095] The electronic device 100 can implement an audio function through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, and an application processor, etc.

[0096] The audio module 170 is used to convert digital audio information into an analog audio signal output, and also used to convert an analog audio input into a digital audio signal.

[0097] The speaker 170A, also called a “loudspeaker”, is used to convert an audio electrical signal into a sound signal.

[0098] The receiver 170B, also called a “earpiece”, is used to convert an audio electrical signal into a sound signal.

[0099] The microphone 170C, also called a “microphone”, “sound transducer”, is used to convert a sound signal into an electrical signal.

[0100] The earphone interface 170D is used to connect a wired earphone.

[0101] The sensor module 180 can include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, an acceleration sensor 180E, a distance sensor 180F, a fingerprint sensor 180H, a touch sensor 180K, a bone conduction sensor 180M, etc.

[0102] The key 190 includes a power-on key, a volume key, etc.

[0103] The motor 191 can generate a vibration prompt.

[0104] The indicator 192 can be an indicator light, which can be used to indicate a charging state, a power change, and can also be used to indicate a message, a missed call, a notification, etc.

[0105] The SIM card interface 195 is used to connect a SIM card.

[0106] The technical solutions in the embodiments of the present application will be described below in conjunction with FIGS. 3-7.

[0107] In the embodiments of the present application, the electronic device needs to establish an association between the target card and the feature information first. The technical solution will be described below in conjunction with FIGS. 2-3.

[0108] Exemplarily, FIG. 3 is a schematic flowchart of establishing an association between a target card and feature information according to an embodiment of the present application. As shown in FIG. 3, the method 200 can be applied to an electronic device, and the method 200 can include steps 210-230.

[0109] 210. When detecting a user's NFC transaction operation, the electronic device activates the target card 1 to perform an NFC transaction.

[0110] Exemplarily, when the user uses the electronic device to perform an NFC transaction, the user needs to hold the electronic device close to the NFC device. When the distance between the electronic device and the NFC device is less than a preset distance, the electronic device can receive the instruction sent by the NFC device, at which time it can be considered that the electronic device has detected the user's NFC transaction operation. Then, the electronic device can activate the target card 1 to perform an NFC transaction.

[0111] For example, the target card 1 can be a card newly added by the user and not associated with feature information.

[0112] In some examples, if only the target card 1 is added to the electronic device, when detecting an NFC transaction operation, the electronic device can activate the target card 1 to perform an NFC transaction.

[0113] In some examples, if multiple NFC cards are added to the electronic device, the electronic device can randomly select the target card 1 to perform an NFC transaction.

[0114] In some examples, if multiple NFC cards are added to the electronic device, and the target card 1 is an AID card, the electronic device can select the target card 1 to perform an NFC transaction according to the card selection instruction of the NFC device.

[0115] In some examples, if multiple NFC cards are added in the electronic device, and the target card 1 is a non-AID card, and the number of non-AID cards is one. After the electronic device and the NFC device complete the primary handshake, if the card selection instruction is not received within the preset time, it can be determined that the NFC device needs a non-AID card, and the electronic device can activate the target card 1 to perform the NFC transaction.

[0116] In some examples, if multiple NFC cards are added in the electronic device, and the target card 1 is a non-AID card, and the number of non-AID cards is one. After the electronic device and the NFC device complete the primary handshake, if the card selection instruction is not received within the preset time, it can be determined that the NFC device needs a non-AID card, and the electronic device can activate the target card 1 to perform the NFC transaction.

[0117] The specific value of the preset time period in the embodiments of the present application is not limited. For example, the preset time period can be 400 milliseconds (ms), 300 ms, etc.

[0118] It should be understood that in the above various cases, the electronic device selects the target card to perform the NFC transaction, which may or may not be successful.

[0119] 220, when the target card 1 is used for transaction, the electronic device determines the feature information A of the electronic device when performing the NFC transaction.

[0120] For example, when the electronic device uses the target card 1 to successfully perform the transaction, the data information of each sensor can be obtained to determine the angle of the electronic device when performing the NFC transaction.

[0121] It should be understood that the angle of the electronic device when performing the NFC transaction can also be understood as the gesture of the user holding the electronic device. For example, the NFC coil in the NFC device is vertically installed (such as a door access), and the user needs to hold the electronic device vertically to perform the NFC transaction with the NFC device, and the angle of the electronic device when performing the NFC transaction is vertical. For example, the NFC coil in the NFC device is horizontally installed (such as a subway gate), and the user needs to hold the electronic device horizontally to perform the NFC transaction with the NFC device, and the angle of the electronic device when performing the NFC transaction is horizontal.

[0122] In the embodiments of the present application, the feature information A can include the data of various sensors in the electronic device.

[0123] For example, the feature information A can include acceleration data of X, Y, Z three axes of an acceleration sensor, data of a gyroscope, data of a magnetometer or a direction sensor, data of a positioning sensor, data of a barometer, etc.

[0124] In other examples, the feature information A can also include data of a distance sensor, a rotation vector sensor, a pressure sensor, etc.

[0125] For example, the NFC device can be a gate address barrier of a community, and the NFC coil in the gate address barrier is generally installed horizontally. When a user uses an electronic device to perform an NFC transaction with the gate address barrier, the electronic device needs to swipe the card in a horizontal manner. When the electronic device successfully performs the NFC transaction using a target card 1, the electronic device can obtain data of sensors of the electronic device at this time, for example, acceleration values of X and Y axes of an acceleration sensor at this time are (0 plus or minus a threshold value 1), and a calculated value of a Z axis is (9.81 plus or minus a threshold value 2).

[0126] The specific values of the threshold value 1 and the threshold value 2 are not limited in the embodiments of the present application.

[0127] Optionally, the threshold value 1 and the threshold value 2 can be the same or different.

[0128] For example, the NFC device can be a home access control, and the NFC coil in the home access control is generally installed vertically. When a user uses an electronic device to perform an NFC transaction with the home access control, the electronic device needs to swipe the card in a vertical manner. When the electronic device successfully performs the NFC transaction using a target card 1, the electronic device can obtain data of sensors of the electronic device at this time, for example, acceleration values of X, Y, and Z axes of an acceleration sensor at this time are X1, Y1, and Z1 respectively.

[0129] Or, the NFC device is installed at an angle with a horizontal plane, and when the electronic device successfully performs the NFC transaction using the target card 1, acceleration values of three axes of the acceleration sensor obtained by the electronic device are X2, Y2, and Z2 respectively, and the X2, Y2, and Z2 are different from the values obtained by the electronic device when swiping the card vertically or horizontally.

[0130] In the embodiments of the present application, the electronic device can determine whether the NFC transaction is successful in the following manner.

[0131] Manner A: When the electronic device needs to deduct a fee to perform an NFC transaction (for example, swiping a bus card or a subway card), the electronic device can read information such as NFC transaction time, transaction amount, balance, etc. from a secure chip, so as to determine whether the NFC transaction is successful.

[0132] Manner B: When the electronic device performs an NFC transaction using an AID card, the NFC device sends an instruction indicating that the transaction is successful (e.g., A0F1020020) when the transaction is successful, and sends an instruction indicating that the transaction is failed when the transaction is failed.

[0133] For example, when the electronic device receives the instruction indicating that the card swiping is successful sent by the NFC device, it can be determined that the NFC transaction is successful.

[0134] Manner C: When the electronic device performs an NFC transaction using a non-AID card, a prompt information A can be displayed, which is used to inquire whether the transaction is successful.

[0135] For example, the prompt information A can include a success control or a failure control. When the electronic device detects that the user clicks the success control, it can be determined that the NFC transaction is successful. When the electronic device detects that the user clicks the failure control, it can be determined that the NFC transaction is failed.

[0136] 230, the electronic device associates the feature information A with the target card 1.

[0137] Since different NFC transaction scenarios can correspond to different card swiping angles, the electronic device can associate the feature information A composed of the sensor data obtained during the transaction with the target card when the transaction is successful.

[0138] For example, after the electronic device performs an NFC transaction using the target card 1 successfully, the obtained feature information A can be associated with the target card 1.

[0139] It should be understood that the electronic device can store the association between the target card 1 and the feature information A in the memory or the server.

[0140] In some examples, the electronic device can associate the feature information of other cards in the above manner.

[0141] In an implementation manner, the electronic device can not distinguish the types (e.g., AID card, non-AID card) of the added NFC cards. It only needs to record the NFC card and its corresponding feature information.

[0142] For example, the association between the plurality of NFC cards and the feature information can refer to Table 1, and the electronic device can store the table 1. Thus, when an NFC transaction needs to be performed subsequently, the electronic device can quickly match the corresponding NFC card according to the obtained feature information, so that the NFC card can be activated to perform the NFC transaction and the transaction is successful.

[0143] Table 1

[0144] Optionally, the electronic device can also store the relationship between the geo-fence information and the NFC card. For example, card 1-card 4 included in Table 1 belong to the same geo-fence 1, while another geo-fence 2 also includes card 5-6, etc. In this way, when the user needs to use the electronic device to perform an NFC transaction next time, the location of the electronic device can be determined first, and the target card can be further matched in the cards included in the geo-fence. In this way, when the geo-fences are different, even if the feature information is the same, the electronic device can switch the correct card when swiping the card.

[0145] In another implementation manner, the electronic device can distinguish the types of the added NFC cards, such as storing the association relationship between all AID cards and the corresponding feature information in the AID card card selection scenario, and storing the association information between all non-AID cards and the corresponding feature information in the non-AID card card selection scenario.

[0146] For example, the association relationship between the plurality of NFC cards and the feature information can refer to Table 2, and the electronic device can store Table 2. Subsequently, when an NFC transaction needs to be performed, the electronic device can determine the corresponding card selection scenario according to the type of the card, and quickly match the corresponding NFC card in the card selection scenario according to the obtained feature information, so that the NFC card can be activated to perform the NFC transaction, and the transaction is successful.

[0147] Table 2

[0148] It can be understood that the electronic device can also store the AID card card selection scenario and the non-AID card card selection scenario respectively, and the embodiments of the present application are not limited.

[0149] It should be understood that for other target cards, the electronic device can also establish the corresponding relationship between the target card and the feature information in the above manner.

[0150] Based on the embodiments of the present application, when the electronic device successfully performs an NFC transaction using a target card, the feature information when the electronic device performs the NFC transaction can be obtained, and the target card is associated with the feature information, so that when the target card needs to be used to perform an NFC transaction next time, the target card can be matched through the real-time obtained feature information, so that the probability of automatically switching the correct card by the electronic device can be improved.

[0151] In some cases, when the target card is not associated with the feature information, such as the target card being a newly added NFC card of the user, the target card activated by the electronic device can not be required by the NFC device. At this time, the electronic device can display prompt information to remind the user to select the correct NFC card, and then the electronic device can associate the obtained feature information with the NFC card selected by the user. The technical solution will be described below in combination with FIG. 4.

[0152] Exemplarily, FIG. 4 is a schematic flowchart of establishing an association relationship between a target card and feature information according to an embodiment of the present application. As shown in FIG. 4, the method 300 can be applied to an electronic device, and the method 300 can include steps 310 to 350.

[0153] 310. The electronic device activates a target card 1 to perform an NFC transaction when detecting an NFC transaction operation of the user.

[0154] It should be understood that the step 310 can refer to the related description of the step 210, and details are not described herein for brevity.

[0155] 320. The electronic device displays prompt information when the transaction using the target card 1 is unsuccessful, and the prompt information is used to remind the user to select a card for the NFC transaction.

[0156] As described above, since the target card 1 is not associated with the feature information, the NFC transaction performed by the electronic device using the target card 1 can be unsuccessful. When the transaction is unsuccessful, the electronic device can display prompt information to remind the user to select a correct NFC card to perform the NFC transaction.

[0157] For example, the electronic device can display a first interface, and the first interface can display the prompt information. For example, the prompt information can be text content such as “Please select an NFC card” or “Please select a correct card”.

[0158] It should be understood that the text content in the prompt information is only illustrative. In other examples, the text content can also be other content.

[0159] In other examples, the first interface can also be an interface for the user to select an NFC card, and the interface can also include the above-mentioned text content, so that the user can conveniently select the required NFC card in the first interface.

[0160] In other examples, the prompt information can also include a guide animation for guiding the user to use the mobile phone to swipe the card.

[0161] In other examples, the electronic device can cancel the display of the prompt information after a display time t1 of the prompt information. In other examples, the electronic device can cancel the display of the prompt information after a display time t1 of the prompt information.

[0162] 330, in response to the operation of the user selecting the target card 2, the electronic device activates the target card 2 to perform the NFC transaction.

[0163] After the electronic device displays the prompt information, the user can select the target card 2 which the user wants to perform the NFC transaction. When the electronic device detects the operation of the user selecting the target card 2, the electronic device can activate the target card 2 to perform the NFC transaction.

[0164] 340, when the transaction using the target card 2 is successful, the electronic device determines the feature information B of the electronic device at this time.

[0165] When the electronic device performs the transaction using the target card 2 selected by the user successfully, the electronic device can obtain the feature information B at this time of performing the NFC transaction.

[0166] It should be understood that the feature information B can refer to the related description in the feature information A described above, and will not be repeated here for brevity.

[0167] 350, the electronic device associates the feature information B with the target card 2.

[0168] The electronic device can associate the obtained feature information B with the target card 2, which can refer to the related description of the association between the target card 1 and the feature information A.

[0169] In this way, after the electronic device associates the feature information B with the target card 2, when the electronic device needs to perform the NFC transaction using the target card 2 next time, the electronic device can successfully match the target card 2 according to the real-time obtained feature information, so as to improve the possibility of the electronic device automatically switching the correct card.

[0170] It should be understood that for all the NFC cards added by the user, the association between the card and the feature information can be established in the manner of the above-mentioned FIG. 3 or FIG. 4.

[0171] The technical solution of switching the card in the embodiments of the present application will be described in detail below in combination with FIG. 5-7.

[0172] In some cases, multiple NFC cards are added in the electronic device, and the multiple NFC cards have been associated with the corresponding feature information. The electronic device can not distinguish the types (such as AID card, non-AID card) of the multiple NFC cards. When the electronic device needs to perform the NFC transaction using the card, the electronic device can directly match the target card according to the obtained feature information of the electronic device, activate the target card to perform the NFC transaction when the target card is successfully matched, and the transaction should be successful. The technical solution will be described in combination with FIG. 5 below.

[0173] Exemplarily, FIG. 5 is a schematic flowchart of a method for switching cards according to an embodiment of the present application. Referring to FIG. 5, the method 400 can include steps 410-440.

[0174] 410, the electronic device detects an NFC transaction operation of the user.

[0175] It should be understood that the step 410 can refer to the related description in the step 210 above, and will not be repeated here for brevity.

[0176] 420, the electronic device acquires feature information C of the electronic device when performing the NFC transaction.

[0177] It should be understood that when the electronic device performs the NFC transaction, the user generally holds the electronic device close to the NFC device, at which time the electronic device can acquire the corresponding feature information C.

[0178] It should be understood that the user holds the electronic device in different gestures to perform card swiping, and the electronic device acquires different feature information.

[0179] For example, the NFC device is vertically installed, and the user needs to hold the electronic device vertically to perform card swiping. At this time, the electronic device can acquire feature information 1 when performing vertical card swiping.

[0180] For another example, the NFC device is horizontally installed, and the user needs to hold the electronic device horizontally to perform card swiping. At this time, the electronic device can acquire feature information 2 when performing horizontal card swiping. The feature information 1 is different from the feature information 2.

[0181] It should be understood that the feature information C can refer to the related description above.

[0182] 430, the electronic device determines a target card C associated with the feature information C.

[0183] Exemplarily, the electronic device can query whether there is the same feature information as the feature information C from the stored information of the target card and the feature information after acquiring the feature information C.

[0184] For example, the electronic device can query from the above table 1, when it is determined that the feature information C is the same as one of the feature information C1, or when it is determined that the difference between the feature information C and one of the feature information C1 is less than or equal to a threshold 3, it can be determined that the feature information C and the feature information C1 are the same feature information, and then it can be further determined that the card associated with the feature information C1 is the target card 3.

[0185] In one example, the characteristic information C includes a characteristic sequence composed of acceleration values of X, Y, Z three axes of the acceleration sensor, respectively X-C, Y-C, Z-C, and the characteristic sequence of the stored characteristic information C1 is X-C1, Y-C1, Z-C1. If the difference between X-C and X-C1, the difference between Y-C and Y-C1, and the difference between Z-C and Z-C1 are all less than or equal to the threshold 3, it can be determined that the characteristic information C and the characteristic information C1 are the same characteristic information.

[0186] In other examples, after the electronic device acquires the characteristic information C, it queries from the above table 1, but the characteristic information C is not the same as each of the stored characteristic information C, or the difference between the characteristic information C and each of the stored characteristic information is greater than the threshold 3, then it can be determined that the corresponding card is not matched.

[0187] 440, the electronic device activates the target card C to perform the NFC transaction.

[0188] Since the electronic device acquires the characteristic information C when performing the NFC transaction, when the target card C is successfully matched according to the characteristic information C, it means that the target card C is the NFC card required by the NFC device. At this time, the electronic device activates the target card C to perform the NFC transaction, and the NFC transaction should be successful.

[0189] Based on the embodiments of the present application, in the case that the plurality of NFC cards are associated with the characteristic information, the electronic device can not distinguish the specific types of the plurality of added NFC cards, but directly match the corresponding target card according to the real-time acquired characteristic information when performing the NFC transaction. When the target card is matched, the target card is activated to perform the NFC transaction.

[0190] In this way, the electronic device does not need to consider whether the card selection instruction of the NFC device is received, but directly matches the target card according to the acquired characteristic information, so as to improve the speed of card selection of the electronic device.

[0191] In some cases, if the electronic device adds a plurality of cards, the plurality of cards can be in a case that the positions of the NFC devices that can transact are close, and in a case that the installation angles of at least two NFC devices are the same or similar, when performing the NFC transaction, the electronic device can still fail to switch to the correct card. In order to improve the probability of successful card selection of the electronic device, the electronic device needs to further distinguish the types of the NFC devices, and the technical solutions will be introduced in combination with FIGS. 6-7.

[0192] A scene A to which the embodiments of the present application can be applied is that an electronic device adds a door access card 1 of a community gate, a door access card 2 of a house, a subway card 3, and a bus card 4. Among them, the door access card 1 and the door access card 2 belong to non-AID cards, the subway card 3 and the bus card 4 belong to AID cards, the NFC device 1 corresponding to the door access card 1 is horizontally installed, the NFC device 2 corresponding to the door access card 2 is vertically installed, the NFC device 3 corresponding to the subway card 3 is horizontally installed, the NFC device 4 corresponding to the bus card 4 is vertically installed, and the four NFC devices are close to each other, for example, the four NFC devices belong to the same geographic fence.

[0193] In this complex scene, if the electronic device does not distinguish the types of NFC cards, for example, when a user holds the electronic device and expects to perform a transaction with the NFC device 1, since the user holds the electronic device horizontally to perform card swiping, the electronic device directly matches the feature information obtained when the card is swiped with a target card, and the electronic device will match the door access card 1 and the subway card 3, so the electronic device will not be able to determine which card to use. If the electronic device randomly selects one of the door access card 1 and the subway card 3, the correct card may not be selected.

[0194] FIG. 6 is a scene in which the electronic device needs to use an AID card to perform a transaction with an NFC device, and FIG. 7 is a scene in which the electronic device needs to use a non-AID card to perform a transaction with an NFC device.

[0195] Exemplarily, FIG. 6 is a schematic interaction diagram of a method for switching cards provided by the embodiments of the present application. Referring to FIG. 6, the method 500 can include steps 510 to 560.

[0196] 510, the NFC device sends a card selection instruction to the electronic device. Correspondingly, the electronic device receives the card selection instruction.

[0197] Exemplarily, the card selection instruction can be a 14443-4 instruction, which can be used to indicate the selection of an AID card (standard card). For example, the AID of the card expected to be transacted can be carried in the 14443-4 instruction.

[0198] It should be understood that before step 510, the NFC device and the electronic device have completed the process of primary handshaking.

[0199] 520, in response to receiving the card selection instruction, the electronic device determines that the current NFC transaction belongs to an AID card selection scene.

[0200] For example, the card selection instruction is a 14443-4 instruction, and after the electronic device receives the 14443-4 instruction, it can be determined that the current NFC transaction belongs to an AID card selection scene, that is, the electronic device needs to use an AID card to perform the current NFC transaction.

[0201] 530, the electronic device acquires the characteristic information D of the electronic device when performing the NFC transaction operation.

[0202] It should be understood that the process of the electronic device acquiring the characteristic information D when performing the NFC transaction can refer to the related description of step 420 in the foregoing, and will not be described here for brevity.

[0203] For example, the NFC device is the NFC device 3 described above, and the electronic device needs to be in contact with the NFC device 3 horizontally to perform the NFC transaction, and the electronic device can acquire the characteristic information D of the electronic device in the horizontal posture.

[0204] 540, the electronic device determines the target card D associated with the characteristic information D from the AID card selection scenario library.

[0205] It should be understood that the AID card selection scenario library can include the corresponding relationship between all AID cards added in the electronic device and the characteristic information thereof.

[0206] Since the electronic device determines that the current NFC transaction belongs to the AID card selection scenario, that is, the electronic device needs to use an AID card to perform the current NFC transaction, the electronic device has matched the target card D associated with the characteristic information D from the AID card selection scenario library according to the acquired characteristic information D.

[0207] Under normal circumstances, if the characteristic information associated with the target card is accurate, the electronic device can successfully match the corresponding target card D according to the characteristic information D.

[0208] In other examples, if the electronic device does not match the associated target card according to the characteristic information D, it means that the characteristic information associated with the correct target card is inaccurate. In this case, the electronic device can also determine the correct target card according to the AID carried in the 14443-4 instruction and activate the target card.

[0209] This is because, although the AID is carried in the card selection instruction, the speed of the electronic device directly matching the target card according to the acquired characteristic information is faster than that of determining the target card according to the card selection instruction. Therefore, the electronic device can preferentially use the characteristic information to match the target card, which can improve the speed of the electronic device switching the correct card. However, in the case that the characteristic information does not match the target card, in order to normally perform the NFC transaction, the electronic device can determine the correct target card according to the card selection instruction.

[0210] 550, the electronic device activates the target card D to perform the NFC transaction.

[0211] After the electronic device matches to the target card D, the electronic device can activate the target card D to perform the current NFC transaction.

[0212] 560, the NFC device and the electronic device successfully complete the transaction.

[0213] It should be understood that, since the electronic device matches to the target card according to the feature information acquired in real time, the target card is most likely to be the NFC card required by the NFC device, and the electronic device should successfully complete the transaction with the NFC device using the target card.

[0214] For example, for the above scenario A, when the user needs to take the subway, the electronic device can be used to horizontally swipe the subway gate (NFC device 3). The electronic device can determine that the current NFC transaction is an AID card selection scenario according to the card selection instruction of the subway gate, then the electronic device can acquire the feature information D when swiping the card horizontally, and match to the subway card 3 according to the feature information D, after that, the electronic device activates the subway card 3 to swipe the subway gate, and successfully completes the transaction.

[0215] For another example, when the user needs to take the bus, the electronic device can be used to vertically swipe the NFC device 4. The electronic device can determine that the current NFC transaction is an AID card selection scenario according to the received card selection instruction, then the electronic device can acquire the feature information D when swiping the card vertically, and match to the bus card 2 among the multiple AID cards according to the feature information D, after that, the electronic device activates the bus card 2 and successfully completes the transaction.

[0216] Based on the embodiments of the present application, the electronic device can determine that the current scenario belongs to an AID card selection scenario according to the card selection instruction of the NFC device, then the electronic device can acquire the feature information when swiping the card currently, and match to the target card according to the feature information, after that, the electronic device activates the target card to successfully complete the transaction with the NFC device.

[0217] In this way, even when the positions of the NFC devices corresponding to multiple NFC cards are relatively close, the electronic device can still select the correct NFC card, thereby improving the user experience.

[0218] Exemplarily, FIG. 7 is a schematic interaction diagram of another method for switching cards provided by an embodiment of the present application. Referring to FIG. 7, the method 600 can include steps 610 to 650.

[0219] 610, the electronic device determines that the current NFC transaction is a non-AID card selection scenario when no card selection instruction is received within a preset time.

[0220] It should be understood that, before this step 610, the NFC device has completed the primary handshake process with the electronic device.

[0221] It should be understood that the card selection instruction is a 14443-4 instruction, and after the electronic device and the NFC device complete the primary handshake, when the electronic device does not receive the 14443-4 instruction of the NFC device within a preset time, the electronic device can determine that the current NFC transaction is a non-AID card selection scenario, that is, the electronic device needs to use a non-AID card to perform the current NFC transaction. For example, the NFC device can be the NFC device 1 (such as the address gate of the community gate) or the NFC device 2 (such as the home access control) in the foregoing scenario A.

[0222] 620, the electronic device acquires feature information E of the electronic device when performing the NFC transaction operation.

[0223] It should be understood that the step 620 can refer to the related description in the step 420 in the foregoing, and details are not described here for brevity.

[0224] 630, the electronic device determines a target card E associated with the feature information E from a non-AID card selection scenario library.

[0225] It should be understood that the process of determining the target card E associated with the feature information E from the non-AID card selection scenario library by the electronic device can refer to the description of determining the target card D associated with the feature information D from the AID card selection scenario library by the electronic device, and the process is similar.

[0226] 640, the electronic device activates the target card E to perform the NFC transaction.

[0227] 650, the NFC device and the electronic device successfully transact.

[0228] It should be understood that the steps 640-650 can refer to the related description of the steps 550-560 in the foregoing.

[0229] For example, for the foregoing scenario A, when the user needs to enter the community, the electronic device can be used to horizontally swipe the subway gate (NFC device 1). The electronic device can determine that the current NFC transaction is a non-AID card selection scenario according to that no card selection instruction is received, the electronic device can acquire feature information E when swiping the card horizontally, and the access control card 1 in the plurality of non-AID cards is matched according to the feature information E, and then the electronic device activates the access control card 1 to swipe the address gate of the community gate and successfully transacts.

[0230] For another example, when the user needs to enter the home, the electronic device can be used to vertically swipe the NFC device 2. The electronic device can determine that the current NFC transaction is a non-AID card selection scenario according to that no card selection instruction is received, the electronic device can acquire feature information E when swiping the card vertically, and the access control card 2 in the plurality of non-AID cards is matched according to the feature information E, and then the electronic device activates the access control card 2 to swipe the home access control and successfully transacts.

[0231] Based on the embodiments of the present application, the electronic device can determine that the current scene belongs to the non-AID card selection scene according to the fact that the card selection instruction is not received, and then the electronic device can obtain the feature information at the current card swiping time, and match the target card according to the feature information. After that, the electronic device activates the target card and successfully trades with the NFC device.

[0232] In this way, even when the positions of the NFC devices corresponding to multiple NFC cards are relatively close, the electronic device can still select the correct NFC card, thereby improving the user's experience.

[0233] In some cases, if the user has multiple NFC cards in the same scene, and the angle of the user holding the electronic device needs to be the same when performing NFC transactions. For example, in the non-AID card selection scene, the user has a community A gate access card A and a community B gate access card B, and the distance between community A and community B is relatively close. The electronic device can further distinguish between access card A and access card B in the following way.

[0234] Method one: the electronic device can use a fence to distinguish between access card A and access card B.

[0235] Exemplarily, the fence can include a signal fence.

[0236] For example, in the methods 200-300 in the foregoing, the electronic device can also obtain the signal strength at the card swiping time and bind it with the corresponding target card, that is, the feature information in the foregoing can also include the signal strength. Since the strength of various wireless signals that the electronic device can obtain is different at different positions, the electronic device can distinguish between access card A and access card B according to the signal strength.

[0237] For example, access card A and access card B are both horizontal card swiping, but the signal strength associated with access card A is signal strength A, and the signal strength associated with access card B is signal strength B. In some cases, when the user uses the electronic device to swipe the address gate of community A, the electronic device can obtain the feature information at the card swiping time, and the feature information can indicate that the angle of the electronic device is horizontal, but the difference between the signal strength in the feature information and signal strength A is less than a threshold 4, then it can be determined that access card A is matched, and then the electronic device can activate access card A and successfully trade.

[0238] Method two: the electronic device can use the data of the direction sensor to distinguish between access card A and access card B.

[0239] For example, in the method 200-300 in the foregoing, the electronic device can also acquire the data of the direction sensor when the card is swiped, and bind it with the corresponding target card, that is, the feature information in the foregoing can also include direction information. Since the value of the direction sensor of the electronic device is different when the card is swiped in different directions, the electronic device can distinguish the access card A and the access card B according to the signal strength.

[0240] For example, the access card A and the access card B are both horizontal card swiping, but the access card A is associated with the direction information A, and the access card B is associated with the direction information B. In some cases, when the user uses the electronic device to swipe the address gate of the community A, the electronic device can acquire the feature information when the card is swiped, and the feature information can indicate that the angle of the electronic device is horizontal, but the difference between the direction information in the feature information and the direction information A is less than a threshold 5, and it can be determined that the access card A is matched, and the electronic device can activate the access card A and successfully transact.

[0241] In this way, even in the same scenario, the user has multiple NFC cards, and the angle of the user holding the electronic device needs to be the same when performing the NFC transaction, the electronic device can successfully distinguish different NFC cards and switch the correct NFC card to perform the transaction, thereby improving the user experience.

[0242] FIG. 8 is a schematic flowchart of a method for switching cards provided by an embodiment of the present application. As shown in FIG. 8, the method 800 can be applied to an electronic device, the NFC cards in the electronic device include standard cards and non-standard cards, and the method 800 can include steps 810-830.

[0243] 810, the electronic device acquires first feature information of the electronic device when performing a first NFC transaction, and the first feature information is used to indicate a first angle of the electronic device.

[0244] For example, the first feature information can be the feature information B, the feature information C, the feature information D, the feature information D, etc. in the foregoing.

[0245] Since the installation angle of different NFC devices can be different, the user needs to hold the electronic device at different angles when transacting with different NFC devices. Then when performing the NFC transaction, the electronic device can acquire the corresponding first feature information in real time, which is used to indicate the first angle of the electronic device when performing the NFC transaction.

[0246] For example, the first feature information can be an acceleration value, such as the acceleration values of X, Y, and Z three-axis, so as to indicate different angles of the electronic device.

[0247] For example, the first characteristic information can also be data of a gyroscope, such as an angular velocity value, and can be used to indicate different angles of the electronic device.

[0248] For example, the first characteristic information can also be data of an inertial measurement unit in the electronic device, such as including the acceleration value and the angular velocity value, and can be used to indicate different angles of the electronic device.

[0249] For example, the first characteristic information can also include direction information, so as to indicate different orientations of the electronic device. Alternatively, the first characteristic information can also include position information, so as to indicate different positions of the electronic device, or the first characteristic information can also include air pressure information, so as to be used to indicate different altitudes of the electronic device.

[0250] It should be understood that the first characteristic information can also include other information, such as various wireless signal information and geomagnetic information obtained by the electronic device, and the embodiments of the present application are not limited thereto.

[0251] 820, the electronic device determines a target card from the NFC cards according to the first characteristic information, and the target card is a standard card or a non-standard card.

[0252] In the embodiments of the present application, the electronic device can include a plurality of NFC cards, and the plurality of NFC cards can include standard cards and non-standard cards. For example, the standard cards can include bus cards, subway cards, door lock cards, work cards, etc. The non-standard cards can include access control cards, etc.

[0253] When the electronic device performs an NFC transaction, the target card corresponding to the first characteristic information obtained in real time can be determined, and the target card can be a standard card or a non-standard card.

[0254] It should be understood that each of the NFC cards in the electronic device can be associated with corresponding characteristic information, and the corresponding relationship (such as Table 1 or Table 2 in the foregoing) can be pre-stored in the electronic device or a server, and the embodiments of the present application are not limited thereto.

[0255] 830, the electronic device performs a first NFC transaction using the target card.

[0256] It should be understood that after the electronic device determines the target card, the electronic device can activate the target card and perform the first NFC transaction using the target card.

[0257] Since the target card is determined according to the first characteristic information obtained in real time, the first NFC transaction should be successful.

[0258] Based on the embodiments of the present application, when performing an NFC transaction, the electronic device can obtain first feature information indicating the angle of the electronic device, and match a target card according to the first feature information, and perform the NFC transaction using the target card when the target card is matched.

[0259] In this way, when multiple cards are included in the electronic device, the target card can be matched according to the feature information obtained when performing the NFC transaction, and the possibility of the electronic device automatically selecting the correct card to perform the NFC transaction is improved.

[0260] In some embodiments, before performing the first NFC transaction, the method 800 further includes:

[0261] The electronic device adds the first card in the electronic device in response to an operation of adding the first card;

[0262] The electronic device obtains second feature information of the electronic device in response to an operation of successfully performing a second NFC transaction using the first card, the second feature information being used to indicate a second angle of the electronic device;

[0263] The electronic device associates the first card with the second feature information.

[0264] For example, the first card can be a newly opened NFC card of the user, such as an access control card, a bus card, etc.

[0265] It should be understood that the electronic device can determine whether the second NFC transaction is successful in the manner described above.

[0266] Based on the embodiments of the present application, when a new first card is added to the electronic device, when the electronic device successfully swipes the card using the first card, the electronic device can associate the second feature information obtained when swiping the card with the first card.

[0267] In this way, when the electronic device needs to swipe the card using the first card next time, the first card can be directly matched according to the feature information when swiping the card, thereby improving the possibility of the electronic device correctly selecting the card.

[0268] In some embodiments, determining the target card from the NFC cards according to the first feature information includes:

[0269] When the first feature information matches the second feature information, the electronic device determines that the target card is the first card associated with the second feature information.

[0270] For example, when the difference between the first feature information and the second feature information is less than a threshold value, it can be determined that the first feature information matches the second feature information.

[0271] Based on the embodiments of the present application, when the electronic device performs the NFC transaction, the first feature information acquired in real time can be matched with the feature information of the associated card. When the first feature information matches the second feature information, it can be determined that the target card to be used is the first card associated with the second feature information.

[0272] In this way, by acquiring the feature information when the electronic device performs the NFC transaction in real time, the corresponding card can be accurately matched.

[0273] In some embodiments, when the first NFC transaction is performed, the method 800 further includes:

[0274] In response to receiving the card selection instruction of the NFC device, the electronic device determines that the standard card needs to be used to perform the first NFC transaction.

[0275] In some embodiments, the electronic device determines the target card from the NFC card according to the first feature information, including:

[0276] The electronic device determines the target card from the standard card included in the NFC card according to the first feature information.

[0277] For example, the NFC device is a subway gate or a bus card swiping device. After the NFC device and the electronic device complete the primary handshake, the NFC device sends a card selection instruction for selecting a corresponding card to perform the NFC transaction.

[0278] Based on the embodiments of the present application, the electronic device can have multiple standard cards. When the electronic device receives the card selection instruction, it can be determined that the standard card needs to be used for card swiping. The electronic device can determine the target card from the standard cards of the electronic device.

[0279] In this way, even if the feature information of card 1 in the standard card and the feature information of card 2 in the non-standard card are the same, the electronic device can distinguish the card 1 and the card 2, thereby improving the adaptability of the electronic device to the card swiping scene and improving the correctness of the card selection.

[0280] In some embodiments, when the first NFC transaction is performed, the method 800 further includes:

[0281] In response to not receiving the card selection instruction of the NFC device within the preset time length, the electronic device determines that the non-standard card needs to be used to perform the first NFC transaction.

[0282] In some embodiments, the electronic device determines the target card from the NFC card according to the first feature information, including:

[0283] The electronic device determines the target card from the non-standard card included in the NFC card according to the first feature information.

[0284] For example, the NFC device is a cell access gate, and the NFC device does not send a card selection instruction to the electronic device after the primary handshake between the NFC device and the electronic device is completed.

[0285] It should be understood that the preset time length is not limited to the specific examples in the present application, for example, the preset time length can be 400 ms, 200 ms, etc.

[0286] Based on the embodiments of the present application, the electronic device can have multiple non-standard cards, and when the electronic device does not receive a card selection instruction within the preset time length, it can be determined that a non-standard card needs to be used for card swiping. The electronic device can determine the target card from the non-standard cards in the electronic device.

[0287] In this way, even if the feature information of card 1 in the standard card and card 2 in the non-standard card is the same, the electronic device can distinguish between card 1 and card 2, thereby improving the adaptability of the electronic device to the card swiping scenario and improving the correctness of card selection.

[0288] In some embodiments, the NFC card is associated with a geographic fence, and the geographic fence is used to indicate a geographic area in which the electronic device performs an NFC transaction using the NFC card, and wherein determining the target card from the NFC card according to the first feature information comprises:

[0289] Determining a first geographic fence in which the electronic device performs the first NFC transaction;

[0290] The electronic device determines the target card from the NFC card associated with the first geographic fence according to the first feature information.

[0291] For example, among the NFC cards included in the electronic device, multiple cards are associated with the first geographic fence, and multiple cards are associated with the second geographic fence. When the electronic device performs an NFC transaction, it can first determine which geographic fence it currently belongs to according to the location of the electronic device, such as the first geographic fence, and then the electronic device can match the multiple cards associated with the first geographic fence to determine the target card.

[0292] Based on the embodiments of the present application, when the NFC card is associated with a geographic fence, the electronic device can determine the first geographic fence in which the NFC transaction is performed when matching the feature information, and determine the target card from the NFC card associated with the first geographic fence in the electronic device.

[0293] In this way, the matching of the feature information can be based on the cards in the geographic fence, so that correct card selection can be achieved for the cards in different geographic fences.

[0294] In addition, even if the feature information associated with the NFC card is the same (such as the same card swiping angle) in different geographic fences, the electronic device can still correctly distinguish between different cards.

[0295] For example, the card 1 belongs to a geo-fence 1, the card 2 belongs to a geo-fence 2, and the card 1 and the card 2 have a horizontal card swiping angle. Then, when the card is selected for swiping, if the electronic device belongs to the geo-fence 1, the card 1 can be matched, and if the electronic device belongs to the geo-fence 2, the card 2 can be matched.

[0296] In some embodiments, determining the target card from the NFC cards according to the first feature information comprises:

[0297] The electronic device determines a plurality of candidate cards from the NFC cards according to first information in the first feature information, the first information being information for indicating an angle of the electronic device;

[0298] The electronic device determines the target card from the plurality of candidate cards according to second information in the first feature information, the second information being information for indicating a direction of the electronic device or enclosure information in which the electronic device is located.

[0299] For example, the first information can be acceleration information, and the second information can be direction information, enclosure information (such as signal enclosure, geo-fence, etc.), etc.

[0300] Based on the embodiments of the present application, when the electronic device determines a plurality of candidate cards according to the first information, the target card can be further determined from the plurality of candidate cards according to the second information.

[0301] In this way, when a plurality of cards correspond to NFC devices that are close to each other, the correct target card can be further determined through the second information, so that the possibility of selecting the correct card for the electronic device in a complex scenario can be improved.

[0302] In some embodiments, the first feature information comprises at least one of the following information: direction information, acceleration information, geomagnetic information, or angular velocity information.

[0303] In other examples, the first feature information can further include geographic information, height information, etc.

[0304] In some implementations, when the first feature information includes multiple types of information such as direction information, acceleration information, geomagnetic information, or angular velocity information, the first feature information is a feature sequence composed of the multiple types of information in a preset order.

[0305] Based on the embodiments of the present application, the first feature information is a feature sequence composed of multiple types of information in a preset order, so that the security of NFC transactions can be improved.

[0306] In some implementations, the first angle of the electronic device includes vertical, horizontal, and any angle between horizontal and vertical.

[0307] In this way, for NFC devices of different angles, the electronic device can correctly switch the card corresponding to the angle when performing an NFC transaction, thereby improving the user's card swiping experience.

[0308] The embodiments of the present application also provide an electronic device, which includes one or more processors, and one or more memories. The one or more memories store one or more instructions. When the instructions are executed by the one or more processors, the method for switching a card as described in any of the preceding possible implementation manners is performed.

[0309] For example, the electronic device can be the electronic device 100 described above.

[0310] For example, the electronic device can be used to perform the method 200, the method 300, the method 400, the method 500, the method 600, and the method 800 described above.

[0311] The embodiments of the present application also provide an apparatus, which includes a processor and a communication interface. The communication interface is configured to receive a signal and transmit the signal to the processor. The processor processes the signal, so that the method for switching a card as described in any of the preceding possible implementation manners is performed.

[0312] The apparatus can be a chip. For example, the chip can be a chip system or a single chip, etc.

[0313] The embodiments of the present application also provide a readable storage medium (also referred to as a computer readable storage medium), which stores a program. When the program is run on an electronic device, the electronic device performs the related method steps described above to implement the method for switching a card in the embodiments described above.

[0314] The embodiments of the present application also provide a program product (also referred to as a computer program product). When the program product is run on an electronic device, the electronic device performs the related steps described above to implement the method for switching a card in the embodiments described above.

[0315] The embodiments of the present application also provide an apparatus, which includes modules for implementing the method for switching a card as described in any of the preceding embodiments.

[0316] In addition, the embodiments of the present application also provide an apparatus, which can be a chip, a component or a module. The apparatus can include a processor and a memory connected to each other. When the apparatus is running, the processor can execute the instructions stored in the memory, so that the apparatus performs the method for switching a card in the method embodiments described above.

[0317] The device, readable storage medium, program product or apparatus provided in the embodiment can be used to execute the corresponding method provided above, and thus the beneficial effects thereof can refer to the beneficial effects of the corresponding method provided above, which will not be repeated here.

[0318] Those skilled in the art can clearly understand that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0319] Those skilled in the art can clearly understand that, for the convenience and brevity of the description, the specific working processes of the above-described system, apparatus and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.

[0320] In several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method can be implemented in other ways. For example, the apparatus embodiments described above are only schematic, for example, the division of the units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.

[0321] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. According to actual needs, some or all of the units can be selected to achieve the purpose of the embodiment.

[0322] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit.

[0323] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the parts of the present application that essentially contribute to the prior art or the parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes various media that can store program codes, such as a U disk, a mobile hard disk, a read-only memory, a random access memory, a magnetic disk or an optical disk.

[0324] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical scope disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.

Claims

1. A method of switching cards, characterized by, The method is applied to an electronic device, near field communication (NFC) cards in the electronic device include standard cards and non-standard cards, and the method comprises: In the execution of the first NFC transaction, first feature information of the electronic device is acquired, the first feature information being used to indicate a first angle of the electronic device; A target card is determined from the NFC cards according to the first feature information, the target card being the standard card or the non-standard card; The first NFC transaction is executed using the target card.

2. The method of claim 1, wherein, Before the execution of the first NFC transaction, the method further comprises: In response to an operation of adding a first card, the first card is added in the electronic device; In response to an operation of successfully executing a second NFC transaction using the first card, second feature information of the electronic device is acquired, the second feature information being used to indicate a second angle of the electronic device; The first card is associated with the second feature information.

3. The method of claim 2, wherein, The determination of the target card from the NFC cards according to the first feature information comprises: When the first feature information matches the second feature information, the target card is determined to be the first card associated with the second feature information.

4. The method of claim 1, wherein, In the execution of the first NFC transaction, the method further comprises: In response to receiving a card selection instruction of an NFC device, it is determined that the first NFC transaction needs to be executed using the standard card; The determination of the target card from the NFC cards according to the first feature information comprises: The target card is determined from the standard cards included in the NFC cards according to the first feature information.

5. The method of claim 1, wherein, In the execution of the first NFC transaction, the method further comprises: In response to not receiving a card selection instruction of an NFC device within a preset time length, it is determined that the first NFC transaction needs to be executed using the non-standard card; The determination of the target card from the NFC cards according to the first feature information comprises: The target card is determined from the non-standard cards included in the NFC cards according to the first feature information.

6. The method according to any one of claims 1-5, characterized in that, The NFC cards are associated with geographic fences, the geographic fences being used to indicate geographic areas in which the electronic device executes NFC transactions using the NFC cards, The determination of the target card from the NFC cards according to the first feature information comprises: A first geographic fence in which the electronic device executes the first NFC transaction is determined; The target card is determined from NFC cards associated with the first geographic fence according to the first feature information.

7. The method of claim 1, wherein, The determination of the target card from the NFC cards according to the first feature information comprises: A plurality of candidate cards are determined from the NFC cards according to first information in the first feature information, the first information being information used to indicate an angle of the electronic device; The target card is determined from the plurality of candidate cards according to second information in the first feature information, the second information being information used to indicate a direction of the electronic device or fence information in which the electronic device is located.

8. The method according to any one of claims 1-7, characterized in that, The first feature information includes at least one of direction information, acceleration information, geomagnetic information, or angular velocity information.

9. The method of claim 8, wherein, When the first feature information includes multiple types of information among the direction information, the acceleration information, the geomagnetic information, or the angular velocity information, the first feature information is a feature sequence composed of the multiple types of information in a preset order.

10. The method according to any one of claims 1-9, characterized in that, The first angle includes a vertical angle, a horizontal angle, and any angle between the horizontal angle and the vertical angle.

11. An electronic device, comprising: Comprise: one or more processors; one or more memories; the one or more memories store one or more programs, when the one or more programs are executed by one or more processors, the method of switching cards as claimed in any one of claims 1-10 is executed.

12. A chip, characterized by The chip includes a processor and a communication interface, the communication interface is used for receiving a signal and transmitting the signal to the processor, the processor processes the signal, so that the method of switching cards as claimed in any one of claims 1-10 is executed.

13. A readable storage medium, characterized by, The readable storage medium stores instructions, when the instructions run on the device, the method of switching cards as claimed in any one of claims 1-10 is executed.

14. A program product, characterized by The program product includes program code, when the program code runs on the device, the method of switching cards as claimed in any one of claims 1-10 is executed.

Citation Information

Patent Citations

  • Simulation card switching method and device of NFC (Near Field Communication) mobile terminal

    CN106231090A

  • Near field communication card determination method and device, storage medium and electronic equipment

    CN111464692A

  • Method and device for automatically switching NFC cards of wearable device and wearable device

    CN111930227A

  • Near field communication (NFC) analog card switching method, device and equipment

    CN112287708A

  • Provisioning multiple secure credentials on an electronic device

    US20160358172A1