通话双向录音代码:

private final class PhoneListener extends PhoneStateListener {        private String incomeNumber; // 来电号码        private MediaRecorder mediaRecorder;        private File file;        @Override        public void onCallStateChanged(int state, String incomingNumber) {            try {                System.out.println(">>>>>>CallState>>>>>>>>" + state);                switch (state) {                case TelephonyManager.CALL_STATE_RINGING: // 来电                    System.out.println(">>>>>>来电>>>>>>>>" + state);                    this.incomeNumber = incomingNumber;                    break;                case TelephonyManager.CALL_STATE_OFFHOOK: // 接通电话                    file = new File(Environment.getExternalStorageDirectory(),                            this.incomeNumber + System.currentTimeMillis()                                    + ".3gp");                    System.out.println(">>>>>>接通>>>>>>>>" + state);                    mediaRecorder = new MediaRecorder();                    // mediaRecorder.setAudioSource(MediaRecorder.AudioSource.MIC);                    //获得声音数据源(下麦克风)                    mediaRecorder                            .setAudioSource(MediaRecorder.AudioSource.VOICE_CALL);//这个设置就是获取双向声音                    mediaRecorder                            .setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP); // 按3gp格式输出                    mediaRecorder                            .setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);                    mediaRecorder.setOutputFile(file.getAbsolutePath()); // 输出文件                    mediaRecorder.prepare(); // 准备                    mediaRecorder.start();                    break;                case TelephonyManager.CALL_STATE_IDLE: // 挂掉电话                    System.out.println(">>>>>>挂电话>>>>>>>>" + state);                    if (mediaRecorder != null) {                        System.out.println(">>>>"                                + Environment.getExternalStorageDirectory());                        mediaRecorder.stop();                        mediaRecorder.release();                        mediaRecorder = null;                        AppliacationIMmpl.file = file;                    }                    break;                }            } catch (IllegalStateException e) {                // TODO Auto-generated catch block                e.printStackTrace();            } catch (IOException e) {                // TODO Auto-generated catch block                e.printStackTrace();            }        }    }

http://www.freebuf.com/news/88835.html
假说有一个应用通过某种类型的用户交互在剪切板中创建,增加一个包含了被认为是“公用”组件的Intent对象的ClipData

final ClipboardManager clipboardManager = (ClipboardManager)          getSystemService(Context.CLIPBOARD_SERVICE); Intent intent = new Intent(getApplicationContext(), PublicActivity.class); intent.setAction("android.intent.action.VIEW"); intent.putExtra("ExtraString", "foobar"); ClipData setClipData; setClipData = ClipData.newIntent("intent", intent); clipboardManager.setPrimaryClip(setClipData);

ClipboardManager.OnPrimaryClipChangedListener
onPrimaryClipChangedListener = new
ClipboardManager.OnPrimaryClipChangedListener() {

@Override
public void onPrimaryClipChanged() {
try {
replaceClipData(clipboardManager);
} catch (URISyntaxException e) {

        e.printStackTrace();                                  }                                           }                                               

};

pymongo连接coding的mongo

def getMongoInfo():    print getMongoInfo    out = {}    envs=os.environ    if envs.has_key('VCAP_SERVICES'):        decode = json.loads(envs['VCAP_SERVICES'])        out['host'] = decode['mongodb'][0]['credentials']['host']        out['port'] = decode['mongodb'][0]['credentials']['port']        out['username'] = decode['mongodb'][0]['credentials']['username']        out['password'] = decode['mongodb'][0]['credentials']['password']        out['uri'] = decode['mongodb'][0]['credentials']['uri']        out['name'] = decode['mongodb'][0]['credentials']['name']#主要这一行,必须使用这个name的数据库,不然一直提示没有权限~    if not out.has_key('host'):        out['host'] = 'localhost'        out['port'] = 27017        out['username'] = 'root'        out['password'] = 'root'        out['name'] = 'Blog'    print 'out=%s'%out    return out

更多相关文章

  1. Android 的开源电话/通讯/IM聊天项目全集
  2. Android7.0 设置音量最小时有声音输出
  3. Android 拨打电话功能
  4. 打开电话Android系统调用
  5. RK3288 android 5.1 HDMI 喇叭同时输出声音
  6. android模拟器发送短信和打电话
  7. Android之电话拨号器
  8. Android的AIDL以及挂断电话

随机推荐

  1. Android(安卓)RadioButton与ListView的混
  2. android WebView网页浏览器
  3. Android(安卓)SDK/ADT 历史版本下载地址
  4. android shape的使用
  5. android studio 2.2下载地址
  6. 垂直跑马灯、滚动通知
  7. Android头部停留及分页加载功能整合列表
  8. Android超炫日期日历控件:TimesSquare
  9. 【4.2】Android_Edittext/Button
  10. 从零开始学android-一行两个按钮居中 布