當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。