座机为什么没有座机来电静音音功能

为什么静音模式下来电没有震动啊_iphone6s吧_百度贴吧
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&签到排名:今日本吧第个签到,本吧因你更精彩,明天继续来努力!
本吧签到人数:0成为超级会员,使用一键签到本月漏签0次!成为超级会员,赠送8张补签卡连续签到:天&&累计签到:天超级会员单次开通12个月以上,赠送连续签到卡3张
关注:702,143贴子:
为什么静音模式下来电没有震动啊收藏
现在有请我儿子回答 直降多少?魅族什么款?什么特惠?多少元起?。
青铜星玩家
百度移动游戏玩家均可认证(限百度账号),
响铃模式震动也开
麻烦你跟声音关了好吗
设置 辅助功能那个震动打开
登录百度帐号推荐应用
为兴趣而生,贴吧更懂你。或Android笔记(39)
& & &程序功能:在主界面中有两种模式选择,一个是会议模式,一个是正常模式,当选择会议模式,手机设定为静音,当选择为正常模式,手机设定为响铃。当单击添加按钮时,系统会自动从编辑框中提取输入电话号码,若输入的电话号码不全为数字时,会提示出错。
程序效果如下:
首先给出布局文件:
&LinearLayout xmlns:android=&/apk/res/android&
xmlns:tools=&/tools&
android:layout_width=&match_parent&
android:layout_height=&match_parent&
android:orientation=&vertical&&
&RadioGroup
android:id=&@+id/rg&
android:layout_marginTop=&5dp&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
&RadioButton
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:id=&@+id/rb1&
android:text=&会议模式&
&RadioButton
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:id=&@+id/rb2&
android:text=&正常模式&
&/RadioGroup&
&LinearLayout
android:layout_width=&match_parent&
android:layout_height=&wrap_content&
android:layout_marginTop=&5dp&
android:orientation=&horizontal&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:text=&请输入号码:&
android:layout_width=&match_parent&
android:layout_height=&wrap_content&
android:id=&@+id/et&
&/LinearLayout&
android:id=&@+id/btn&
android:layout_width=&match_parent&
android:layout_height=&wrap_content&
android:text=&添加&
android:layout_marginTop=&5dp&
android:layout_width=&wrap_content&
android:layout_height=&wrap_content&
android:id=&@+id/tv&
&/LinearLayout&
布局文件中的最后一个TextView控件是用来显示添加来电显示电话号码的。
接下来给出主功能代码:
package com.example.sample6_13;
import java.util.ArrayL
import java.util.L
import android.app.A
import android.content.C
import android.media.AudioM
import android.os.B
import android.os.V
import android.telephony.PhoneStateL
import android.telephony.TelephonyM
import android.view.V
import android.widget.B
import android.widget.EditT
import android.widget.RadioB
import android.widget.RadioG
import android.widget.TextV
import android.widget.T
public class MainActivity extends Activity {
private RadioG
private EditT
private TextV
private RadioButton rb1;
private RadioButton rb2;
private List&String&
private StringB
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
sb = new StringBuilder();
num = new ArrayList&String&();
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
tm.listen(myPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
InitViews();
PhoneStateListener myPhoneStateListener = new PhoneStateListener(){
public void onCallStateChanged(int state, String incomingNumber) {
switch (state) {
case TelephonyManager.CALL_STATE_IDLE://待机状态
Toast.makeText(MainActivity.this, &手机处于待机状态&, Toast.LENGTH_SHORT).show();
if(rb1.isChecked() == true){//会议模式
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if(am != null){
am.setRingerMode(AudioManager.RINGER_MODE_SILENT);//设置静音模式
am.getStreamVolume(AudioManager.STREAM_RING);
AudioManager am = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
if(am != null){
am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);//设置静音模式
am.getStreamVolume(AudioManager.STREAM_RING);
case TelephonyManager.CALL_STATE_RINGING:
if(num.size() == 0){
for(int i=0;i&num.size();i++){
if(incomingNumber.equals(num.get(i))){
vibrator.vibrate(new long[]{100,10,100,1000},0);
Toast.makeText(MainActivity.this, &手机正在震动&, Toast.LENGTH_SHORT).show();
case TelephonyManager.CALL_STATE_OFFHOOK:
vibrator.cancel();
Toast.makeText(MainActivity.this, &手机震动已取消&, Toast.LENGTH_SHORT).show();
private void InitViews() {
rg = (RadioGroup) findViewById(R.id.rg);
rb1 = (RadioButton) findViewById(R.id.rb1);
rb2 = (RadioButton) findViewById(R.id.rb2);
et = (EditText) findViewById(R.id.et);
btn = (Button) findViewById(R.id.btn);
tv = (TextView) findViewById(R.id.tv);
vibrator = (Vibrator) this.getSystemService(Context.VIBRATOR_SERVICE);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
String msg = et.getText().toString().trim();
if(msg.matches(&^[0-9]*$&) && !msg.equals(&&)){
num.add(msg);
et.setText(&&);
sb.append(count++);
sb.append(&.&);
sb.append(msg);
sb.append(&\n&);
tv.setText(sb.toString());
Toast.makeText(MainActivity.this, &电话号码中只允许有数字并且不能为空&, Toast.LENGTH_SHORT).show();
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
public void onCheckedChanged(RadioGroup group, int checkedId) {
if(checkedId == rb1.getId()){//会议模式
AudioManager am = (AudioManager) MainActivity.this.getSystemService(Context.AUDIO_SERVICE);
if(am != null){
am.setRingerMode(AudioManager.RINGER_MODE_SILENT);//设置为静音模式
am.getStreamVolume(AudioManager.STREAM_RING);
Toast.makeText(MainActivity.this, &手机已设定为静音模式&, Toast.LENGTH_SHORT).show();
}else if(checkedId == rb2.getId())
AudioManager am = (AudioManager) MainActivity.this.getSystemService(Context.AUDIO_SERVICE);
if(am != null){
am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);//设置为正常模式
am.getStreamVolume(AudioManager.STREAM_RING);
Toast.makeText(MainActivity.this, &手机已设定为正常模式&, Toast.LENGTH_SHORT).show();
手机设定为静音模式:
am.setRingerMode(AudioManager.RINGER_MODE_SILENT);//设置静音模式
am.getStreamVolume(AudioManager.STREAM_RING);
手机设定为正常模式:
am.setRingerMode(AudioManager.RINGER_MODE_NORMAL);//设置静音模式
am.getStreamVolume(AudioManager.STREAM_RING);
具体代码参考上面,最后就是添加权限了:
&uses-permission android:name=&android.permission.VIBRATE&/&
&uses-permission android:name=&android.permission.READ_PHONE_STATE&/&
参考知识库
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
访问:49363次
积分:1900
积分:1900
排名:第16540名
原创:141篇
转载:18篇
评论:16条
(5)(5)(1)(2)(4)(6)(6)(10)(3)(15)(17)(6)(9)(18)(33)(9)(9)(1)&&&&&&当前位置:&gt
618超级返狂欢节
一淘网为您找到电话静音产品的详细资讯,实时报价,价格行情,电话静音商品分类,论坛问答/求购等相关产品信息。
增值电信业务经营许可证:浙B2-

我要回帖

更多关于 座机来电没有声音 的文章

 

随机推荐