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


Java AppRTCUtils类代码示例

本文整理汇总了Java中org.appspot.apprtc.util.AppRTCUtils的典型用法代码示例。如果您正苦于以下问题:Java AppRTCUtils类的具体用法?Java AppRTCUtils怎么用?Java AppRTCUtils使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AppRTCUtils类属于org.appspot.apprtc.util包,在下文中一共展示了AppRTCUtils类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onAccuracyChanged

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
@Override
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
  threadChecker.checkIsOnValidThread();
  AppRTCUtils.assertIsTrue(sensor.getType() == Sensor.TYPE_PROXIMITY);
  if (accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
    Log.e(TAG, "The values returned by this sensor cannot be trusted");
  }
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:9,代码来源:AppRTCProximitySensor.java

示例2: onSensorChanged

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
@Override
public final void onSensorChanged(SensorEvent event) {
  threadChecker.checkIsOnValidThread();
  AppRTCUtils.assertIsTrue(event.sensor.getType() == Sensor.TYPE_PROXIMITY);
  // As a best practice; do as little as possible within this method and
  // avoid blocking.
  float distanceInCentimeters = event.values[0];
  if (distanceInCentimeters < proximitySensor.getMaximumRange()) {
    Log.d(TAG, "Proximity sensor => NEAR state");
    lastStateReportIsNear = true;
  } else {
    Log.d(TAG, "Proximity sensor => FAR state");
    lastStateReportIsNear = false;
  }

  // Report about new state to listening client. Client can then call
  // sensorReportsNearState() to query the current state (NEAR or FAR).
  if (onSensorStateListener != null) {
    onSensorStateListener.run();
  }

  Log.d(TAG, "onSensorChanged" + AppRTCUtils.getThreadInfo() + ": "
          + "accuracy=" + event.accuracy + ", timestamp=" + event.timestamp + ", distance="
          + event.values[0]);
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:26,代码来源:AppRTCProximitySensor.java

示例3: setAudioDeviceInternal

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
/** Changes selection of the currently active audio device. */
private void setAudioDeviceInternal(AudioDevice device) {
  Log.d(TAG, "setAudioDeviceInternal(device=" + device + ")");
  AppRTCUtils.assertIsTrue(audioDevices.contains(device));

  switch (device) {
    case SPEAKER_PHONE:
      setSpeakerphoneOn(true);
      break;
    case EARPIECE:
      setSpeakerphoneOn(false);
      break;
    case WIRED_HEADSET:
      setSpeakerphoneOn(false);
      break;
    case BLUETOOTH:
      setSpeakerphoneOn(false);
      break;
    default:
      Log.e(TAG, "Invalid audio device selection");
      break;
  }
  selectedAudioDevice = device;
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:25,代码来源:AppRTCAudioManager.java

示例4: onSensorChanged

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
@Override
public final void onSensorChanged(SensorEvent event) {
    threadChecker.checkIsOnValidThread();
    AppRTCUtils.assertIsTrue(event.sensor.getType() == Sensor.TYPE_PROXIMITY);
    // As a best practice; do as little as possible within this method and
    // avoid blocking.
    float distanceInCentimeters = event.values[0];
    if (distanceInCentimeters < proximitySensor.getMaximumRange()) {
        Log.d(TAG, "Proximity sensor => NEAR state");
        lastStateReportIsNear = true;
    } else {
        Log.d(TAG, "Proximity sensor => FAR state");
        lastStateReportIsNear = false;
    }

    // Report about new state to listening client. Client can then call
    // sensorReportsNearState() to query the current state (NEAR or FAR).
    if (onSensorStateListener != null) {
        onSensorStateListener.run();
    }

    Log.d(TAG, "onSensorChanged" + AppRTCUtils.getThreadInfo() + ": "
            + "accuracy=" + event.accuracy + ", timestamp=" + event.timestamp + ", distance="
            + event.values[0]);
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:26,代码来源:AppRTCProximitySensor.java

示例5: setAudioDeviceInternal

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
/**
 * Changes selection of the currently active audio device.
 */
private void setAudioDeviceInternal(AudioDevice device) {
    Log.d(TAG, "setAudioDeviceInternal(device=" + device + ")");
    AppRTCUtils.assertIsTrue(audioDevices.contains(device));

    switch (device) {
        case SPEAKER_PHONE:
            setSpeakerphoneOn(true);
            break;
        case EARPIECE:
            setSpeakerphoneOn(false);
            break;
        case WIRED_HEADSET:
            setSpeakerphoneOn(false);
            break;
        case BLUETOOTH:
            setSpeakerphoneOn(false);
            break;
        default:
            Log.e(TAG, "Invalid audio device selection");
            break;
    }
    selectedAudioDevice = device;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:27,代码来源:AppRTCAudioManager.java

示例6: AppRTCAudioManager

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
private AppRTCAudioManager(Context context,
                           Runnable deviceStateChangeListener)
{
   apprtcContext = context;
   onStateChangeListener = deviceStateChangeListener;
   /*
   audioManager = ((AudioManager) context.getSystemService(
         Context.AUDIO_SERVICE));

   // Create and initialize the proximity sensor.
   // Tablet devices (e.g. Nexus 7) does not support proximity sensors.
   // Note that, the sensor will not be active until start() has been called.
   proximitySensor = AppRTCProximitySensor.create(context, new Runnable() {
      // This method will be called each time a state change is detected.
      // Example: user holds his hand over the device (closer than ~5 cm),
      // or removes his hand from the device.
      public void run()
      {
         onProximitySensorChangedState();
      }
   });
   */
   AppRTCUtils.logDeviceInfo(TAG);
}
 
开发者ID:RestComm,项目名称:restcomm-android-sdk,代码行数:25,代码来源:AppRTCAudioManager.java

示例7: setAudioDevice

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
/**
 * Changes selection of the currently active audio device.
 */
public void setAudioDevice(AudioDevice device)
{
   RCLogger.d(TAG, "setAudioDevice(device=" + device + ")");
   AppRTCUtils.assertIsTrue(audioDevices.contains(device));

   switch (device) {
      case SPEAKER_PHONE:
         setSpeakerphoneOn(true);
         selectedAudioDevice = AudioDevice.SPEAKER_PHONE;
         break;
      case EARPIECE:
         setSpeakerphoneOn(false);
         selectedAudioDevice = AudioDevice.EARPIECE;
         break;
      case WIRED_HEADSET:
         setSpeakerphoneOn(false);
         selectedAudioDevice = AudioDevice.WIRED_HEADSET;
         break;
      default:
         RCLogger.e(TAG, "Invalid audio device selection");
         break;
   }
   onAudioManagerChangedState();
}
 
开发者ID:RestComm,项目名称:restcomm-android-sdk,代码行数:28,代码来源:AppRTCAudioManager.java

示例8: start

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
/**
 * Activate the proximity sensor. Also do initialization if called for the
 * first time.
 */
public boolean start() {
  threadChecker.checkIsOnValidThread();
  Log.d(TAG, "start" + AppRTCUtils.getThreadInfo());
  if (!initDefaultSensor()) {
    // Proximity sensor is not supported on this device.
    return false;
  }
  sensorManager.registerListener(this, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL);
  return true;
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:15,代码来源:AppRTCProximitySensor.java

示例9: stop

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
/** Deactivate the proximity sensor. */
public void stop() {
  threadChecker.checkIsOnValidThread();
  Log.d(TAG, "stop" + AppRTCUtils.getThreadInfo());
  if (proximitySensor == null) {
    return;
  }
  sensorManager.unregisterListener(this, proximitySensor);
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:10,代码来源:AppRTCProximitySensor.java

示例10: onReceive

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
@Override
public void onReceive(Context context, Intent intent) {
  int state = intent.getIntExtra("state", STATE_UNPLUGGED);
  int microphone = intent.getIntExtra("microphone", HAS_NO_MIC);
  String name = intent.getStringExtra("name");
  Log.d(TAG, "WiredHeadsetReceiver.onReceive" + AppRTCUtils.getThreadInfo() + ": "
          + "a=" + intent.getAction() + ", s="
          + (state == STATE_UNPLUGGED ? "unplugged" : "plugged") + ", m="
          + (microphone == HAS_MIC ? "mic" : "no mic") + ", n=" + name + ", sb="
          + isInitialStickyBroadcast());
  hasWiredHeadset = (state == STATE_PLUGGED);
  updateAudioDeviceState();
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:14,代码来源:AppRTCAudioManager.java

示例11: AppRTCAudioManager

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
private AppRTCAudioManager(Context context) {
  Log.d(TAG, "ctor");
  ThreadUtils.checkIsOnMainThread();
  apprtcContext = context;
  audioManager = ((AudioManager) context.getSystemService(Context.AUDIO_SERVICE));
  bluetoothManager = AppRTCBluetoothManager.create(context, this);
  wiredHeadsetReceiver = new WiredHeadsetReceiver();
  amState = AudioManagerState.UNINITIALIZED;

  SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
  useSpeakerphone = sharedPreferences.getString(context.getString(R.string.pref_speakerphone_key),
      context.getString(R.string.pref_speakerphone_default));
  Log.d(TAG, "useSpeakerphone: " + useSpeakerphone);
  if (useSpeakerphone.equals(SPEAKERPHONE_FALSE)) {
    defaultAudioDevice = AudioDevice.EARPIECE;
  } else {
    defaultAudioDevice = AudioDevice.SPEAKER_PHONE;
  }

  // Create and initialize the proximity sensor.
  // Tablet devices (e.g. Nexus 7) does not support proximity sensors.
  // Note that, the sensor will not be active until start() has been called.
  proximitySensor = AppRTCProximitySensor.create(context, new Runnable() {
    // This method will be called each time a state change is detected.
    // Example: user holds his hand over the device (closer than ~5 cm),
    // or removes his hand from the device.
    public void run() {
      onProximitySensorChangedState();
    }
  });

  Log.d(TAG, "defaultAudioDevice: " + defaultAudioDevice);
  AppRTCUtils.logDeviceInfo(TAG);
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:35,代码来源:AppRTCAudioManager.java

示例12: start

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
/**
 * Activate the proximity sensor. Also do initialization if called for the
 * first time.
 */
public boolean start() {
    threadChecker.checkIsOnValidThread();
    Log.d(TAG, "start" + AppRTCUtils.getThreadInfo());
    if (!initDefaultSensor()) {
        // Proximity sensor is not supported on this device.
        return false;
    }
    sensorManager.registerListener(this, proximitySensor, SensorManager.SENSOR_DELAY_NORMAL);
    return true;
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:15,代码来源:AppRTCProximitySensor.java

示例13: stop

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
/**
 * Deactivate the proximity sensor.
 */
public void stop() {
    threadChecker.checkIsOnValidThread();
    Log.d(TAG, "stop" + AppRTCUtils.getThreadInfo());
    if (proximitySensor == null) {
        return;
    }
    sensorManager.unregisterListener(this, proximitySensor);
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:12,代码来源:AppRTCProximitySensor.java

示例14: onAccuracyChanged

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
@Override
public final void onAccuracyChanged(Sensor sensor, int accuracy) {
    threadChecker.checkIsOnValidThread();
    AppRTCUtils.assertIsTrue(sensor.getType() == Sensor.TYPE_PROXIMITY);
    if (accuracy == SensorManager.SENSOR_STATUS_UNRELIABLE) {
        Log.e(TAG, "The values returned by this sensor cannot be trusted");
    }
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:9,代码来源:AppRTCProximitySensor.java

示例15: AppRTCAudioManager

import org.appspot.apprtc.util.AppRTCUtils; //导入依赖的package包/类
private AppRTCAudioManager(Context context) {
    Log.d(TAG, "ctor");
    ThreadUtils.checkIsOnMainThread();
    apprtcContext = context;
    audioManager = ((AudioManager) context.getSystemService(Context.AUDIO_SERVICE));
    bluetoothManager = AppRTCBluetoothManager.create(context, this);
    wiredHeadsetReceiver = new WiredHeadsetReceiver();
    amState = AudioManagerState.UNINITIALIZED;

    SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
    useSpeakerphone = sharedPreferences.getString(context.getString(R.string.pref_speakerphone_key),
            context.getString(R.string.pref_speakerphone_default));
    Log.d(TAG, "useSpeakerphone: " + useSpeakerphone);
    if (useSpeakerphone.equals(SPEAKERPHONE_FALSE)) {
        defaultAudioDevice = AudioDevice.EARPIECE;
    } else {
        defaultAudioDevice = AudioDevice.SPEAKER_PHONE;
    }

    // Create and initialize the proximity sensor.
    // Tablet devices (e.g. Nexus 7) does not support proximity sensors.
    // Note that, the sensor will not be active until start() has been called.
    proximitySensor = AppRTCProximitySensor.create(context, new Runnable() {
        // This method will be called each time a state change is detected.
        // Example: user holds his hand over the device (closer than ~5 cm),
        // or removes his hand from the device.
        public void run() {
            onProximitySensorChangedState();
        }
    });

    Log.d(TAG, "defaultAudioDevice: " + defaultAudioDevice);
    AppRTCUtils.logDeviceInfo(TAG);
}
 
开发者ID:lgyjg,项目名称:AndroidRTC,代码行数:35,代码来源:AppRTCAudioManager.java


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