Audio application starting method, electronic equipment and storage medium
Obtain and process audio application logos through the frame layer, and send broadcast messages to the application layer to solve the problem of manually adjusting the playback progress when the vehicle is re -called after re -powering the vehicle.
Patent Information
- Application Number
- CN202411320067.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2025-01-28
AI Technical Summary
When the vehicle is powered back on again after losing power, the user needs to manually adjust the playback progress of the audio application, which is cumbersome and prone to errors, affecting the user experience.
Through the frame layer, obtain the audio application logo that historically occupy the focus of audio, and send broadcast messages to the application layer to notify the audio application before the vehicle is in power to be played, thereby automatically restore the historical playback progress.
When the vehicle is re -called after the vehicle is lost, it will be played automatically and accurately from the historical playback progress, which improves the user experience and is suitable for any third -party audio application.
Smart Images

Figure CN119377004A_ABST
Abstract
Description
[Technical field]
[0001] Embodiments of the present application relate to the field of vehicle technology, and more particularly to a method for starting an audio application, an electronic device, and a storage medium. [Background technology]
[0002] Currently, users usually like to open audio applications to listen to audio content of interest while driving. When the vehicle runs out of power, the vehicle computer will be completely powered off and the above audio application will be closed. When the user powers on the vehicle again next time, if the user wants to continue listening to the historical audio in the audio application based on the historical playback progress, the user needs to manually adjust the playback progress of the historical audio to the historical playback progress.
[0003] There are two problems with the above method: first, the user may not be able to accurately remember the historical playback progress, so the user may be inaccurate when manually adjusting the playback progress; second, the user needs to manually start the audio application, manually select historical audio in the audio application, and adjust the playback progress of the historical audio. The operation is relatively cumbersome, resulting in a poor user experience. [Summary of the invention]
[0004] The embodiments of the present application propose a method for starting an audio application, an electronic device, and a storage medium, which can automatically and accurately start from the historical playback progress and continue to play the audio content played historically when the vehicle is powered on again after a power outage, without the user having to manually adjust the playback progress, thereby improving the user experience.
[0005] In a first aspect, an embodiment of the present application provides a method for starting an audio application, which is applied to an electronic device, wherein the electronic device includes an application layer and a framework layer, and the method includes:
[0006] When the framework layer determines that the vehicle is powered on again after power failure, the first audio application identifier is obtained, where the first audio application identifier is the identifier of the first audio application that last occupied the audio focus in history;
[0007] The framework layer sends a broadcast message to the first audio application corresponding to the first audio application identifier in the application layer, where the broadcast message is used to notify the first audio application that it is occupying the audio focus before the vehicle runs out of power;
[0008] The first audio application in the application layer responds to the broadcast message by taking the historical playing progress of the target audio as the starting progress and continuing to play, wherein the target audio is the audio played by the first audio application before the vehicle runs out of power.
[0009] In an embodiment of the present application, when the vehicle is powered on again after a power outage, the framework layer can obtain the first audio application identifier of the first audio application that last occupied the audio focus in history, that is, the framework layer can know that the first audio application was the last to occupy the audio focus in history, but at this time the first audio application in the application layer does not know that it occupied the audio focus and was in a playing state before the vehicle ran out of power, then the framework layer can send a broadcast to the first audio application corresponding to the first audio application identifier in the application layer to notify the first audio application that it occupied the audio focus before the vehicle ran out of power, that is, to notify the first audio application that it was in a playing state before the vehicle ran out of power. When the first audio application knows that it was in a playing state before the vehicle ran out of power, it will use the played progress of the target audio played before the vehicle ran out of power as the starting progress and continue to play. In other words, this method can automatically and accurately start from the historical playback progress and continue to play the audio content that has been played in history when the vehicle is powered on again after a power outage, that is, to achieve a cold start of the audio application playback, without the user having to manually adjust the playback progress, thereby improving the user experience. At the same time, this method utilizes the capabilities of the framework layer to implement cold start of audio application playback, does not require third-party audio applications to have cold start capabilities, and can be applicable to any third-party audio application.
[0010] Optionally, the framework layer obtains the first audio application identifier, including:
[0011] The framework layer obtains the first audio application identifier from a system private storage space, and the system private storage space adopts a non-volatile storage medium.
[0012] In an embodiment of the present application, the first audio application identifier used to represent the first audio application that last occupied the audio focus in history is stored in a system private storage space. The system private storage space uses a non-volatile storage medium, so that the first audio application identifier will not be lost after the vehicle runs out of power, thereby ensuring that the framework layer can know which audio application last occupied the audio focus in history.
[0013] Optionally, the framework layer sends a broadcast message to the first audio application corresponding to the first audio application identifier in the application layer, including:
[0014] The framework layer determines whether there is a second audio application identifier in the current audio focus stack, where the second audio application identifier is an identifier of the second audio application currently occupying the audio focus;
[0015] If not, the framework layer sends the broadcast message to the first audio application in the application layer.
[0016] In an embodiment of the present application, the framework layer can determine whether there is a second audio application identifier in the current audio focus stack after the vehicle is powered on again after power failure, that is, determine whether there is a second audio application occupying the audio focus. If there is no second audio application identifier in the current audio focus stack, it indicates that there is no second audio application occupying the audio focus. At this time, the framework layer can send a broadcast to the first audio application in the application layer, thereby notifying the first audio application that it was in a playing state before the vehicle ran out of power, so that the first audio application can restore the audio content played historically.
[0017] Optionally, the method further includes:
[0018] If a second audio application identifier exists in the current audio focus stack, determining whether the first audio application identifier is the same as the second audio application identifier;
[0019] If they are not the same, the framework layer prohibits sending the broadcast message to the first audio application in the application layer.
[0020] In an embodiment of the present application, the framework layer can determine whether there is a second audio application identifier in the current audio focus stack after the vehicle is powered on again after power failure, that is, determine whether there is a second audio application occupying the audio focus. If there is a second audio application identifier in the current audio focus stack, and the second audio application identifier is different from the first audio application identifier of the first audio application that was last used in history, it can be considered that the user currently wants to use the second audio application, not the first audio application that was last used in history. At this time, the framework layer does not need to send a broadcast to the first audio application in the application layer, that is, the first audio application does not need to restore the audio content played in history, but allows the second audio application to play the audio, thereby meeting the actual needs of the user.
[0021] Optionally, the method further includes:
[0022] If the first audio application identifier is the same as the second audio application identifier, the framework layer sends the broadcast message to the first audio application in the application layer.
[0023] In an embodiment of the present application, the framework layer can determine whether there is a second audio application identifier in the current audio focus stack after the vehicle is powered on again after a power outage, that is, determine whether a second audio application has occupied the audio focus. If there is a second audio application identifier in the current audio focus stack, and the second audio application identifier is the same as the first audio application identifier of the first audio application that was last used in history, it can be considered that the user currently wants to use the first audio application. At this time, the framework layer can send a broadcast to the first audio application in the application layer, thereby notifying the first audio application that it was in a playing state before the vehicle ran out of power, so that the first audio application can restore the audio content played in history.
[0024] Optionally, the framework layer determines that the vehicle is powered on again after power failure, including:
[0025] If the framework layer monitors the system startup broadcast of the vehicle, it is determined that the vehicle is powered on again after a power outage.
[0026] In an embodiment of the present application, the framework layer can determine whether the vehicle is powered on again after a power outage by monitoring the system startup broadcast, thereby accurately determining the timing of powering on again after the vehicle is powered off, so as to prepare for the subsequent restoration of the audio content played historically by the audio application.
[0027] Optionally, the first audio application includes a music player application, an audio book application, and an audio news application.
[0028] In the embodiment of the present application, the capabilities of the framework layer can be utilized to achieve the goal of continuing to play different types of audio content such as music, audio text, etc. that have been played historically based on the historical playback progress after the vehicle is powered on again after a power outage, thereby meeting the user's cold start requirements for content played by different audio applications.
[0029] In a second aspect, an embodiment of the present application provides an electronic device, the electronic device comprising an application layer and a framework layer;
[0030] The framework layer is used to obtain a first audio application identifier when it is determined that the vehicle is powered on again after power failure, wherein the first audio application identifier is an identifier of the first audio application that last occupied the audio focus in history;
[0031] The framework layer is further used to send a broadcast message to the first audio application corresponding to the first audio application identifier in the application layer, wherein the broadcast message is used to notify the first audio application that it is occupying the audio focus before the vehicle runs out of power;
[0032] The first audio application in the application layer is used to respond to the broadcast message and continue playing the target audio using the historical playing progress as the starting progress, wherein the target audio is the audio played by the first audio application before the vehicle runs out of power.
[0033] Optionally, the framework layer is specifically used for:
[0034] The framework layer obtains the first audio application identifier from a system private storage space, and the system private storage space adopts a non-volatile storage medium.
[0035] Optionally, the framework layer is specifically used for:
[0036] The framework layer determines whether there is a second audio application identifier in the current audio focus stack, where the second audio application identifier is an identifier of the second audio application currently occupying the audio focus;
[0037] If not, the framework layer sends the broadcast message to the first audio application in the application layer.
[0038] Optionally, the framework layer is also used for:
[0039] If the second audio application identifier exists in the current audio focus stack, determining whether the first audio application identifier is the same as the second audio application identifier;
[0040] If they are not the same, sending the broadcast message to the first audio application in the application layer is prohibited.
[0041] Optionally, the framework layer is also used for:
[0042] If the first audio application identifier is the same as the second audio application identifier, the broadcast message is sent to the first audio application in the application layer.
[0043] Optionally, the framework layer is specifically used for:
[0044] If the system startup broadcast of the vehicle is monitored, it is determined that the vehicle is powered on again after a power outage.
[0045] Optionally, the first audio application includes a music player application, an audio book application, and an audio news application.
[0046] In a third aspect, an embodiment of the present application provides an electronic device, comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the steps of the method described in any embodiment of the first aspect.
[0047] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium is used to store computer instructions, and when the computer is running, the computer causes the computer to execute the steps of the method described in any embodiment of the first aspect.
[0048] It should be understood that the second to fourth aspects of the embodiments of the present application are consistent with the technical solutions of the first aspect of the embodiments of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here.
Brief Description of the Drawings
[0049] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 A flowchart of a method for starting an audio application provided in an embodiment of the present application;
[0051] Figure 2 A flowchart of a method for obtaining a first audio application identifier provided in an embodiment of the present application;
[0052] Figure 3 A flowchart of a method for sending a broadcast to an application layer provided in an embodiment of the present application;
[0053] Figure 4 An overall flow chart of a method for starting an audio application provided in an embodiment of the present application;
[0054] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0055] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. [Specific implementation method]
[0056] In order to better understand the technical solution of this specification, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
[0057] It should be clear that the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this specification.
[0058] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit this specification. The singular forms of "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.
[0059] The professional terms involved in the embodiments of the present application are explained below.
[0060] Car Audio Service (CarAudio): CarAudio service is a system service in the Android system, which is used to manage functions related to in-car audio playback. This service is responsible for managing the audio input, output, volume control, sound effect processing and other functions of the in-car audio system, and provides audio playback support for the in-car entertainment system. At the same time, CarAudio service also manages audio focus to ensure that the priority and mutual exclusivity of audio playback in the vehicle environment are properly handled.
[0061] Audio Focus: It is an important function in the Android operating system, which is used to coordinate and manage the access and use of audio resources by applications. When an application obtains the audio focus, it means that it has the right to output sound in the system; other applications need to adjust the audio output behavior according to the state of the audio focus to avoid sound conflicts and provide a better user experience.
[0062] Currently, users usually like to open audio applications to listen to audio content of interest while driving. When the vehicle runs out of power, the vehicle computer will be completely powered off and the above audio application will be closed. That is, when the user powers on the vehicle again next time, if the user wants to continue listening to the historical audio in the audio application based on the historical playback progress, the user needs to manually adjust the playback progress of the historical audio to the historical playback progress.
[0063] There are two problems with the above method: first, the user may not be able to accurately remember the historical playback progress, so the user may be inaccurate when manually adjusting the playback progress; second, the user needs to manually start the audio application, manually select the historical audio in the music audio, and adjust the playback progress of the historical audio. The operation is relatively cumbersome, resulting in a poor user experience.
[0064] In view of this, an embodiment of the present application provides a method for starting an audio application, in which, when the vehicle is powered on again after a power outage, the framework layer can obtain the first audio application identifier of the first audio application that last occupied the audio focus in history, that is, the framework layer can know that the first audio application was the last to occupy the audio focus in history, but at this time, the first audio application in the application layer does not know that it occupied the audio focus and was in a playing state before the vehicle ran out of power, then the framework layer can send a broadcast to the first audio application corresponding to the first audio application identifier in the application layer to notify the first audio application that it occupied the audio focus before the vehicle ran out of power, that is, to notify the first audio application that it was in a playing state before the vehicle ran out of power. When the first audio application knows that it was in a playing state before the vehicle ran out of power, it will use the played progress of the target audio played before the vehicle ran out of power as the starting progress and continue to play. In other words, the method can automatically and accurately start from the historical playback progress when the vehicle is powered on again after a power outage, and continue to play the audio content that has been played in history, that is, to achieve a cold start of the audio application playback, without the user having to manually adjust the playback progress, thereby improving the user experience. At the same time, this method utilizes the capabilities of the framework layer to implement cold start of audio application playback, does not require third-party audio applications to have cold start capabilities, and can be applicable to any third-party audio application.
[0065] The technical solution provided by the embodiments of the present application is introduced below in conjunction with the accompanying drawings.
[0066] See also Figure 1 , is a flow chart of a method for starting an audio application provided in an embodiment of the present application. The method can be applied to an electronic device, for example, the electronic device can be a vehicle terminal, and the flow of the method is described as follows:
[0067] Step 101: The framework layer determines that the vehicle is powered on again after a power outage.
[0068] In the embodiment of the present application, the Android system running in the vehicle terminal can realize message transmission through broadcasting. Broadcasting can be understood as a "publish-subscribe" model, in which the sender (publisher) sends messages and the receiver (subscriber) receives these messages according to interest. Broadcasting can be system-level or application-defined. For example, system-level broadcasting includes but is not limited to: power-on broadcasting (ACTION_BOOT_COMPLETED), battery charge change (ACTION_BATTERY_CHANGED), screen off (ACTION_SCREEN_OFF), etc.
[0069] For CarAudio in the Framework Layer, as a system service, it can register system-level broadcasts or application-level broadcasts according to actual needs. For example, the CarAudio service can statically register the boot broadcast (ACTION_BOOT_COMPLETED) by customizing a broadcast receiver class (for example, MyBroadcastReceiver). Of course, it is also possible to dynamically register the boot broadcast (ACTION_BOOT_COMPLETED), and this application does not impose any special restrictions on this.
[0070] After registration is completed, if the CarAudio service in the framework layer receives the system-level boot broadcast (ACTION_BOOT_COMPLETED), it can be considered that the vehicle is powered on again after a power outage. It should be understood that the vehicle can be powered on again after a power outage, which can be considered as charging the vehicle or replacing a new power battery.
[0071] Step 102: The framework layer obtains a first audio application identifier.
[0072] In the embodiment of the present application, the first audio application identifier can be considered as the identifier of the first audio application that last occupied the audio focus in history, and of course it can also be considered as the identifier of the first audio application that last requested the audio focus in history. It should be understood that the audio application that last occupied the audio focus in history and the audio application that last requested the audio focus in history can be considered to be the same audio application, and the audio application can be any audio application, for example, music playback applications (for example, Kuwo Music, QQ Music, NetEase Cloud Music, etc.), audio book applications (for example, Lazy Listening to Books, Himalaya, etc.), and audio news applications (for example, Sina News, etc.), and the present application does not impose any special restrictions on this.
[0073] On this basis, the CarAudio service in the framework layer can know which audio application last occupied the audio focus (or last requested the audio focus) in history by obtaining the above-mentioned first audio application identifier.
[0074] For example, the first audio application identifier can be the package name of the first audio application, or other names, as long as it can uniquely identify the first audio application. This application does not impose any special restrictions on this. For example, if the first audio application identifier obtained by the CarAudio service in the framework layer is: "com.kuwomusic", the CarAudio service in the framework layer can know that the first audio application that last occupied the audio focus (or last requested the audio focus) is: "Kuwo Music".
[0075] The following describes how to obtain the first audio application identifier.
[0076] See also Figure 2 , is a flowchart of a method for obtaining a first audio application identifier provided in an embodiment of the present application. Step 102 can be specifically implemented by executing sub-step 1021:
[0077] Step 1021: The framework layer obtains the first audio application identifier from the system private storage space.
[0078] In an embodiment of the present application, if there is any audio application occupying the audio focus (or requesting the audio focus), the CarAudio service in the framework layer will store the audio application identifier of any of the above audio applications in the vehicle audio settings (CarAudioSettings), where CarAudioSettings is a provider (provider) provided by the Android system for data storage and reading. After receiving the audio application identifier to be saved, CarAudioSettings will write the audio application identifier into the system's preset database. This preset database is located in the system's private data directory (i.e., the system's private storage space) and is persistent. This means that even if the vehicle is completely powered off due to a lack of power, the above-mentioned stored audio application identifier will not be lost. It should be understood that the above-mentioned system private storage space uses a non-volatile storage medium.
[0079] On this basis, when the vehicle is powered on again after a power failure, the CarAudio service in the framework layer can read the previously saved audio application identifier, for example, the first audio application identifier, from the preset database in the above system private storage space during the startup process.
[0080] Step 103: The framework layer sends a broadcast message to the first audio application corresponding to the first audio application identifier in the application layer.
[0081] In the embodiment of the present application, although the CarAudio service in the framework layer learns that the first audio application was the last to occupy the audio focus (or the last to request the audio focus) in history, the first audio application in the application layer is unaware that it occupied the audio focus and was in a playing state (i.e., being used) before the vehicle ran out of power. At this time, the CarAudio service in the framework layer can create a broadcast (custom.intent.action.LAST_MEDIA_PLAYER), which contains a parameter named "EXTRA_PACKAGE_NAME", which can carry the audio application identifier of the audio application that last occupied the audio focus (or, can also be understood as the last to request the audio focus) in history. For example, the parameter can carry the above-mentioned first audio application identifier. Then, the CarAudio service in the framework layer can send a broadcast to the first audio application corresponding to the first audio application identifier in the application layer to notify the first audio application that it last occupied the audio focus before the vehicle ran out of power (or, it can also be understood as the last requested audio focus), that is, to notify the first audio application that it was in a playing state (or, it can also be understood as a used state) before the vehicle ran out of power, so that the first audio application in the application layer can determine whether it needs to resume playing historical audio based on its own historical state.
[0082] In some embodiments, considering that the user may want to continue using the audio application that was last used in history, or may want to use a new audio application after the vehicle is powered on again after a power outage, therefore, in an embodiment of the present application, it is possible to first determine whether the user wants to use the audio application that was last used in history, or to use a new audio application, and then determine whether to send a broadcast to the audio application that was last used in history in the application layer.
[0083] See also Figure 3 , is a flowchart of a method for sending a broadcast to an application layer provided in an embodiment of the present application. Step 103 can be implemented by executing sub-steps 1031 to 1035:
[0084] Step 1031: The framework layer determines whether there is a second audio application identifier in the current audio focus stack.
[0085] Step 1032: If not, the framework layer sends a broadcast message to the first audio application in the application layer.
[0086] In an embodiment of the present application, after the vehicle is powered on again after a power outage, the framework layer can first determine whether there is a second audio application identifier in the current audio focus stack. The second audio application identifier is the identifier of the second audio application that may currently occupy the audio focus. It should be understood that the second audio application identifier can be the package name of the second audio application, or it can be other identifiers. The present application does not impose any special restrictions on this. Therefore, judging whether there is a second audio application identifier in the current audio focus stack can be understood as judging whether there is already a second audio application occupying the audio focus. If the second audio application identifier does not exist in the current audio focus stack, it indicates that there is no second audio application occupying the audio focus. At this time, the framework layer can send a broadcast to the first audio application in the application layer, thereby notifying the first audio application that it was in a playing state before the vehicle ran out of power, so that the first audio application can restore the audio content played historically.
[0087] Step 1033: If yes, the framework layer determines whether the first audio application identifier is the same as the second audio application identifier.
[0088] Step 1034: If they are not the same, the framework layer prohibits sending broadcast messages to the first audio application in the application layer.
[0089] In an embodiment of the present application, after the vehicle is powered on again after a power failure, the framework layer can first determine whether there is a second audio application identifier in the current audio focus stack. The second audio application identifier is the identifier of the second audio application that may currently occupy the audio focus. It should be understood that the second audio application identifier can be the package name of the second audio application, or it can be other identifiers. The present application does not impose any special restrictions on this. Therefore, judging whether there is a second audio application identifier in the current audio focus stack can be understood as judging whether there is already a second audio application occupying the audio focus. If the second audio application identifier already exists in the current audio focus stack, and the second audio application identifier is different from the first audio application identifier of the first audio application that was last used in history, it can be considered that the user currently wants to use the second audio application, rather than the first audio application that was last used in history. At this time, the framework layer does not need to send a broadcast to the first audio application in the application layer, that is, the first audio application does not need to restore the audio content played in history, but allows the second audio application to play audio, thereby meeting the actual needs of the user.
[0090] Step 1035: If they are the same, the framework layer sends a broadcast message to the first audio application in the application layer.
[0091] In an embodiment of the present application, after the vehicle is powered on again after a power outage, the framework layer can first determine whether there is a second audio application identifier in the current audio focus stack. The second audio application identifier is the identifier of the second audio application that may currently occupy the audio focus. It should be understood that the second audio application identifier can be the package name of the second audio application, or it can be other identifiers. The present application does not impose any special restrictions on this. Therefore, judging whether there is a second audio application identifier in the current audio focus stack can be understood as judging whether there is already a second audio application occupying the audio focus. If there is a second audio application identifier in the current audio focus stack, and the second audio application identifier is the same as the first audio application identifier of the first audio application that was last used in history, it can be considered that the audio application currently being used by the user is the same audio application as the audio application that was last used in history, that is, the first audio application. At this time, the framework layer can send a broadcast to the first audio application in the application layer, thereby notifying the first audio application that it was in a playing state before the vehicle ran out of power, so that the first audio application can restore the audio content played in history.
[0092] Step 104: In response to the broadcast message, the first audio application in the application layer takes the historical playback progress of the target audio as the starting progress and continues to play.
[0093] In an embodiment of the present application, when the first audio application knows that it was in a playing state before the vehicle ran out of power, after the vehicle is powered on again, it will use the playback progress of the target audio played before the vehicle ran out of power as the starting progress and continue to play the remaining part of the target audio.
[0094] See also Figure 4 , which is an overall flow chart of a method for starting an audio application provided in an embodiment of the present application.
[0095] Step 201: The framework layer monitors the system startup broadcast and determines that the vehicle is powered on again after a power outage.
[0096] Step 202: The framework layer obtains a first audio application identifier, where the first audio application identifier is an identifier of the first audio application that last occupied the audio focus in history.
[0097] Step 203: The framework layer determines whether there is a second audio application identifier in the current audio focus stack, where the second audio application identifier is the identifier of the second audio application currently occupying the audio focus. If not, jump to step 204; if yes, jump to step 205.
[0098] Step 204 : The framework layer sends a broadcast message to the first audio application in the application layer. The broadcast message is used to notify the first audio application that it is occupying the audio focus before the vehicle runs out of power, and jumps to step 208 .
[0099] Step 205: The framework layer determines whether the first audio application identifier is the same as the second audio application identifier. If not, the process jumps to step 206; if so, the process jumps to step 207.
[0100] Step 206: The framework layer prohibits sending broadcast messages to the first audio application in the application layer and ends the process.
[0101] Step 207 : The framework layer sends a broadcast message to the first audio application in the application layer and jumps to step 208 .
[0102] Step 208: In response to the broadcast message, the first audio application in the application layer takes the historical playback progress of the target audio as the starting progress and continues to play.
[0103] See also Figure 5 Based on the same inventive concept, the embodiment of the present application further provides an electronic device, which includes a framework layer 301 and an application layer 302;
[0104] The framework layer 301 is used to obtain a first audio application identifier when it is determined that the vehicle is powered on again after power failure, where the first audio application identifier is an identifier of the first audio application that last occupied the audio focus in history;
[0105] The framework layer 301 is further used to send a broadcast message to the first audio application corresponding to the first audio application identifier in the application layer, where the broadcast message is used to notify the first audio application that it is in the audio focus before the vehicle runs out of power;
[0106] The first audio application in the application layer 302 is used to respond to the broadcast message and continue playing the target audio with the historical playback progress as the starting progress, wherein the target audio is the audio played by the first audio application before the vehicle runs out of power.
[0107] Optionally, the framework layer 301 is specifically used for:
[0108] A first audio application identifier is obtained from a system private storage space, where the system private storage space uses a non-volatile storage medium.
[0109] Optionally, the framework layer 301 is specifically used for:
[0110] Determine whether there is a second audio application identifier in the current audio focus stack, where the second audio application identifier is an identifier of the second audio application currently occupying the audio focus;
[0111] If not, a broadcast message is sent to the first audio application in the application layer 302 .
[0112] Optionally, the framework layer 301 is also used for:
[0113] If the second audio application identifier exists in the current audio focus stack, determining whether the first audio application identifier is the same as the second audio application identifier;
[0114] If they are not the same, sending the broadcast message to the first audio application in the application layer 302 is prohibited.
[0115] Optionally, the framework layer 301 is also used for:
[0116] If the first audio application identifier is the same as the second audio application identifier, a broadcast message is sent to the first audio application in the application layer 302 .
[0117] Optionally, the framework layer 301 is specifically used for:
[0118] If the vehicle's system startup broadcast is monitored, it is determined that the vehicle is powered on again after a power outage.
[0119] Optionally, the first audio application includes a music player application, an audio book application, and an audio news application.
[0120] See also Figure 6 Based on the same inventive concept, an embodiment of the present application further provides an electronic device, the electronic device comprising at least one processor 401, the processor 401 is used to execute a computer program stored in a memory, and implement the embodiment of the present application as provided in Figure 1-4 Flow chart of steps of a method for starting an audio application shown.
[0121] Optionally, the processor 401 may specifically be a central processing unit, a specific ASIC, or one or more integrated circuits for controlling program execution.
[0122] Optionally, the electronic device may further include a memory 402 connected to the at least one processor 401, and the memory 402 may include a ROM, a RAM, and a disk memory. The memory 402 is used to store data required by the processor 401 when it is running, that is, it stores instructions that can be executed by the at least one processor 401. The at least one processor 401 executes the instructions stored in the memory 402 to execute the following steps: Figure 1-4 The method shown. Wherein, the number of memories 402 is one or more. Wherein, the number of memories 402 is one or more.
[0123] The present application also provides a computer storage medium, wherein the computer storage medium stores computer instructions, and when the computer instructions are executed on a computer, the computer executes Figure 1-4 method.
[0124] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.
Claims
1. A method for starting an audio application, characterized in that: Applied to an electronic device, the electronic device includes an application layer and a framework layer, and the method includes: When the framework layer determines that the vehicle is powered on again after power failure, the first audio application identifier is obtained, where the first audio application identifier is the identifier of the first audio application that last occupied the audio focus in history; The framework layer sends a broadcast message to the first audio application corresponding to the first audio application identifier in the application layer, where the broadcast message is used to notify the first audio application that it is occupying the audio focus before the vehicle runs out of power; The first audio application in the application layer responds to the broadcast message by taking the historical playing progress of the target audio as the starting progress and continuing to play, wherein the target audio is the audio played by the first audio application before the vehicle runs out of power.
2. The method according to claim 1, characterized in that The framework layer obtains the first audio application identifier, including: The framework layer obtains the first audio application identifier from a system private storage space, and the system private storage space adopts a non-volatile storage medium.
3. The method according to claim 1, characterized in that: The framework layer sends a broadcast message to the first audio application corresponding to the first audio application identifier in the application layer, including: The framework layer determines whether there is a second audio application identifier in the current audio focus stack, where the second audio application identifier is an identifier of the second audio application currently occupying the audio focus; If not, the framework layer sends the broadcast message to the first audio application in the application layer.
4. The method according to claim 3, characterized in that The method further comprises: If the second audio application identifier exists in the current audio focus stack, determining whether the first audio application identifier is the same as the second audio application identifier; If they are not the same, the framework layer prohibits sending the broadcast message to the first audio application in the application layer.
5. The method according to claim 4, characterized in that The method further comprises: If the first audio application identifier is the same as the second audio application identifier, the framework layer sends the broadcast message to the first audio application in the application layer.
6. The method according to claim 1, characterized in that The framework layer determines that the vehicle is powered on again after power failure, including: If the framework layer monitors the system startup broadcast of the vehicle, it is determined that the vehicle is powered on again after a power outage.
7. The method according to any one of claims 1 to 6, characterized in that: The first audio applications include music playing applications, audio book applications, and audio news applications.
8. An electronic device, characterized in that: The electronic device comprises an application layer and a framework layer; The framework layer is used to obtain a first audio application identifier when it is determined that the vehicle is powered on again after power failure, wherein the first audio application identifier is an identifier of the first audio application that last occupied the audio focus in history; The framework layer is further used to send a broadcast message to the first audio application corresponding to the first audio application identifier in the application layer, wherein the broadcast message is used to notify the first audio application that it is occupying the audio focus before the vehicle runs out of power; The first audio application in the application layer is used to respond to the broadcast message and continue playing the target audio using the historical playing progress as the starting progress, wherein the target audio is the audio played by the first audio application before the vehicle runs out of power.
9. An electronic device, characterized in that: The electronic device comprises a memory for storing computer program instructions and a processor for executing the program instructions, wherein when the computer program instructions are executed by the processor, the electronic device is triggered to execute the steps of the method as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium is used to store computer instructions, and when the computer instructions are executed in a computer, the computer is caused to execute the steps of the method according to any one of claims 1 to 7.