当前位置: 首页>>代码示例>>Java>>正文


Java NotificationUtil类代码示例

本文整理汇总了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();
            }
        }
    }
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:21,代码来源:BaseCallActivity.java

示例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();
            }
        }
    }
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:21,代码来源:BaseCallActivity.java

示例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);
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:10,代码来源:BaseCallActivity.java

示例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);
}
 
开发者ID:hushengjun,项目名称:FastAndroid,代码行数:43,代码来源:BaseCallActivity.java

示例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);
}
 
开发者ID:LanguidSheep,项目名称:sealtalk-android-master,代码行数:42,代码来源:BaseCallActivity.java

示例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);
}
 
开发者ID:sealtalk,项目名称:sealtalk-android,代码行数:46,代码来源:BaseCallActivity.java


注:本文中的io.rong.imkit.utils.NotificationUtil类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。