0

(通过说接收器,我的意思是当你正常听到电话时的部分。)有人给出了以下代码片段,它不起作用。请问有什么帮助吗?

  Object obj = new Object();
  Method method;
  try {
   method = Class.forName("android.media.AudioSystem").getMethod(
     "setDeviceConnectionState", new Class[] { Integer.TYPE,Integer.TYPE,
                                               String.class });
   method.invoke(obj, new Object[] {num,1,""});
  } catch (Exception e) {
   e.printStackTrace();
   Log.i(TAG, e.toString());
  }

  Intent intent = new Intent();
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  intent.setAction(android.content.Intent.ACTION_VIEW);
  String type = getMIMEType(f);
  intent.setDataAndType(Uri.fromFile(f), type);
  startActivity(intent);
4

1 回答 1

0
m_amAudioManager.setMode(AudioManager.MODE_IN_CALL);
于 2010-12-07T03:46:03.977 回答