本文整理汇总了Java中io.rong.imkit.utils.NotificationUtil类的典型用法代码示例。如果您正苦于以下问题:Java NotificationUtil类的具体用法?Java NotificationUtil怎么用?Java NotificationUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NotificationUtil类属于io.rong.imkit.utils包,在下文中一共展示了NotificationUtil类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onIncomingCallRinging
import io.rong.imkit.utils.NotificationUtil; //导入依赖的package包/类
public void onIncomingCallRinging() {
int ringerMode = NotificationUtil.getRingerMode(this);
if (ringerMode != AudioManager.RINGER_MODE_SILENT) {
if (ringerMode == AudioManager.RINGER_MODE_VIBRATE) {
mVibrator = (Vibrator) RongContext.getInstance().getSystemService(Context.VIBRATOR_SERVICE);
mVibrator.vibrate(new long[]{500, 1000}, 0);
} else {
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
mMediaPlayer = new MediaPlayer();
try {
mMediaPlayer.setDataSource(this, uri);
mMediaPlayer.setLooping(true);
mMediaPlayer.prepare();
mMediaPlayer.start();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
示例2: onIncomingCallRinging
import io.rong.imkit.utils.NotificationUtil; //导入依赖的package包/类
public void onIncomingCallRinging() {
int ringerMode = NotificationUtil.getRingerMode(this);
if(ringerMode != AudioManager.RINGER_MODE_SILENT){
if(ringerMode == AudioManager.RINGER_MODE_VIBRATE){
mVibrator = (Vibrator) RongContext.getInstance().getSystemService(Context.VIBRATOR_SERVICE);
mVibrator.vibrate(new long[] {500, 1000}, 0);
} else {
Uri uri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_RINGTONE);
mMediaPlayer = new MediaPlayer();
try {
mMediaPlayer.setDataSource(this, uri);
mMediaPlayer.setLooping(true);
mMediaPlayer.prepare();
mMediaPlayer.start();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
示例3: showOnGoingNotification
import io.rong.imkit.utils.NotificationUtil; //导入依赖的package包/类
public void showOnGoingNotification(String title, String content) {
Intent intent = new Intent(getIntent().getAction());
Bundle bundle = new Bundle();
onSaveFloatBoxState(bundle);
intent.putExtra("floatbox", bundle);
intent.putExtra("callAction", RongCallAction.ACTION_RESUME_CALL.getName());
PendingIntent pendingIntent = PendingIntent.getActivity(this, 1000, intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationUtil.showNotification(this, title, content, pendingIntent, CALL_NOTIFICATION_ID, Notification.DEFAULT_LIGHTS);
}
示例4: onCallDisconnected
import io.rong.imkit.utils.NotificationUtil; //导入依赖的package包/类
@Override
public void onCallDisconnected(RongCallSession callProfile, RongCallCommon.CallDisconnectedReason reason) {
shouldShowFloat = false;
String text = null;
switch (reason) {
case CANCEL:
text = getString(R.string.rc_voip_mo_cancel);
break;
case REJECT:
text = getString(R.string.rc_voip_mo_reject);
break;
case NO_RESPONSE:
case BUSY_LINE:
text = getString(R.string.rc_voip_mo_no_response);
break;
case REMOTE_BUSY_LINE:
text = getString(R.string.rc_voip_mt_busy);
break;
case REMOTE_CANCEL:
text = getString(R.string.rc_voip_mt_cancel);
break;
case REMOTE_REJECT:
text = getString(R.string.rc_voip_mt_reject);
break;
case REMOTE_NO_RESPONSE:
text = getString(R.string.rc_voip_mt_no_response);
break;
case REMOTE_HANGUP:
case HANGUP:
case NETWORK_ERROR:
case INIT_VIDEO_ERROR:
text = getString(R.string.rc_voip_call_terminalted);
break;
}
if (text != null) {
showShortToast(text);
}
stopRing();
NotificationUtil.clearNotification(this, BaseCallActivity.CALL_NOTIFICATION_ID);
RongCallProxy.getInstance().setCallListener(null);
}
示例5: onCallDisconnected
import io.rong.imkit.utils.NotificationUtil; //导入依赖的package包/类
@Override
public void onCallDisconnected(RongCallSession callProfile, RongCallCommon.CallDisconnectedReason reason) {
shouldShowFloat = false;
String text = null;
switch (reason) {
case CANCEL:
text = getString(R.string.rc_voip_mo_cancel);
break;
case REJECT:
text = getString(R.string.rc_voip_mo_reject);
break;
case NO_RESPONSE:
case BUSY_LINE:
text = getString(R.string.rc_voip_mo_no_response);
break;
case REMOTE_BUSY_LINE:
text = getString(R.string.rc_voip_mt_busy);
break;
case REMOTE_CANCEL:
text = getString(R.string.rc_voip_mt_cancel);
break;
case REMOTE_REJECT:
text = getString(R.string.rc_voip_mt_reject);
break;
case REMOTE_NO_RESPONSE:
text = getString(R.string.rc_voip_mt_no_response);
break;
case REMOTE_HANGUP:
case HANGUP:
case NETWORK_ERROR:
text = getString(R.string.rc_voip_call_terminalted);
break;
}
if (text != null) {
showShortToast(text);
}
stopRing();
NotificationUtil.clearNotification(this, BaseCallActivity.CALL_NOTIFICATION_ID);
RongCallProxy.getInstance().setCallListener(null);
}
示例6: onCallDisconnected
import io.rong.imkit.utils.NotificationUtil; //导入依赖的package包/类
@Override
public void onCallDisconnected(RongCallSession callProfile, RongCallCommon.CallDisconnectedReason reason) {
if (RongCallKit.getCustomerHandlerListener() != null) {
RongCallKit.getCustomerHandlerListener().onCallDisconnected(callProfile, reason);
}
shouldShowFloat = false;
String text = null;
switch (reason) {
case CANCEL:
text = getString(R.string.rc_voip_mo_cancel);
break;
case REJECT:
text = getString(R.string.rc_voip_mo_reject);
break;
case NO_RESPONSE:
case BUSY_LINE:
text = getString(R.string.rc_voip_mo_no_response);
break;
case REMOTE_BUSY_LINE:
text = getString(R.string.rc_voip_mt_busy);
break;
case REMOTE_CANCEL:
text = getString(R.string.rc_voip_mt_cancel);
break;
case REMOTE_REJECT:
text = getString(R.string.rc_voip_mt_reject);
break;
case REMOTE_NO_RESPONSE:
text = getString(R.string.rc_voip_mt_no_response);
break;
case REMOTE_HANGUP:
case HANGUP:
case NETWORK_ERROR:
case INIT_VIDEO_ERROR:
text = getString(R.string.rc_voip_call_terminalted);
break;
}
if (text != null) {
showShortToast(text);
}
stopRing();
NotificationUtil.clearNotification(this, BaseCallActivity.CALL_NOTIFICATION_ID);
RongCallProxy.getInstance().setCallListener(null);
}