Customer requirements
After the headset is pulled out during FM playback, The FM app displays a prompt box Indicating "unplug the headset and stop the FM", and then automatically close
Modify fmradioservice. Java1. Add the following import to display the toast
/// AAAAA add start
Import Android. widget. Toast;
/// AAA
After the customer asks the FM to unplug the headset during playback, the fm app displays a prompt box Indicating "unplug the headset and stop the Fm", and then automatically closes
Modify FMRadioService. java1. Add the following import to display the toast/// AAAAA add startImport android. widget. Toast;/// AAAAA add
=mreceiver.setanalogmode (Analogmode); Analogmode Analog Set Low powerBstatus = Setlowpowermode (false);The phone is not in the idle form tooint state = Getcallstate ();Fmactiononcallstate (state);Activate FM STARTFM (), set headset, etc. to accept FM soundAudiosystem.setforceuse (Audiosystem.for_media,audiosystem.force_none);FM Device availableAudiosystem.setde
=mreceiver.setanalogmode (Analogmode); Analogmode Analog Set Low powerBstatus = Setlowpowermode (false);The phone is not in the idle form tooint state = Getcallstate ();Fmactiononcallstate (state);Activate FM STARTFM (), set headset, etc. to accept FM soundAudiosystem.setforceuse (Audiosystem.for_media,audiosystem.force_none);FM Device availableAudiosystem.setde
Android FM module learning-4 source code analysis (5)
In the previous chapters, we analyzed several main class files of the FM module. What we want to analyze today is: FMTransceiver. java
Public class FmTransceiver {/* Primary FM States: * FM will be in one of the 4 state
Android FM module learning-source code parsing-Methods for saving the FM Module
What I want to share today is the storage method of the FM module, namely, FmSharedPreferences. java.
FmSharedPreferences (Context context) loads the Load () method in the constructor,
public void Load(){ Log.d(LOGTAG, "Load preferences ")
Iantenna = 0; int re = fmreceiverjni.setcontrolnative (SFd, V4l2_cid_private_tavarua_antenna, Iantenna); if (re = = 0) return true; return false; }/*** Set FM Power status** *The method sets the FM power state. * */static void setfmpowerstate (int state) { fmstate = state; }/*** Returns:** Fmoff-if The FM Radio is tu
Android FM module learning-4 source code analysis (3)
I have been busy with projects recently and have no time to update documents. I hope you can learn more and use it today!
This chapter also analyzes the source code of the FM module. FmReceiver. java
publicFmReceiver(String devicePath,FmRxEvCallbacksAdaptor callback) throwsInstantiationException { mContr
Android handset silent, android handset silentWhen Dual talk SIM card is inserted into Card 2, the receiver is silent;When a third-party APP receives a speech, it will set audio_mode to incall instead of sim1 or sim2.The speechdriver will set modem_index according to audio_mode and call MD1.If sim2 is inserted and sim1 is not inserted, there will be a problem tha
function should be called the FM device when it is no longer needed. This should be the last call to FM customer release. Once called, the client must call #acquire to re-request the V4L2 device to control the FM device, which can be used again.* Before the client can release the Control FM
First, IntroductionBroadcast receiver is a broadcast receiver that receives custom and system anchors. It can also be called a listener.Broadcast intent, like intent, is the medium of communication, and unlike intent, broadcast intent is received by multiple components at the same time.Broadcast intent broadcast mechanism, broadcast sources emit messages, and through AMS (Activity Manager service), multiple
As the name suggests, braodcast receiver is a broadcast receiver. It is similar to the time processing mechanism, but the event processing mechanism is program component-level (for example, the Click Event of a button ), the broadcast event processing mechanism is system-level. We can use intent to start a component, or use the sendbroadcast () method to initiate a system-level event broadcast to transmit m
Android automatically exits the FM Radio application when the flight mode is enabled and the headset is pulled out.
The FM radio needs to be inserted into the headset as an antenna, and automatically exits when the headset is pulled out.
1. First add the prompt string
Mediatek/packages/apps/FMRadio/res/values/strings. xml
The
We described the broadcast mechanism of the Android system, in essence, it is a message subscription/advertisement mechanism, so the first step to use such a message-driven model is to subscribe to the message, and for Android applications, the subscription message is actually a register broadcast receiver, This article explores how the
Android Broadcast Receiver-android learning tourFirst, inherit the BroadcastReceiver class and register it in manifest.
public class MyReceiver extends BroadcastReceiver { public MyReceiver() { } @Override public void onReceive(Context context, Intent intent) { throw new UnsupportedOperationException(Not yet implemented); }}
Register in main
. registerReceiver. The registered broadcast receiver is equivalent to an anonymous class. Both methods require IntentFIlter.
IntentFilter intentFilter = new IntentFilter (); intentFilter. addAction (String); // specify the action for BroadcastReceiver to receive the broadcast registerReceiver (BroadcastReceiver, intentFilter) of the same action );
GENERAL: Register in onStart and cancel unregisterReceiver in onStop
Specify the broadcast target Acti
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.