Q
黑莓通话记录器
0
A
回答
1
是的,你需要注册PhoneListener
与应用程序和需要实现所需的方法,如:
callInitiated()
callEnded()
etc..etc
即每当特定呼叫被发起,你可以听该事件并执行自定义代码。
您可以使用PhoneCall
类读取呼叫信息。
希望这会有所帮助。
3
,我认为它的工作原理:黑莓
通话记录
public final class MyScreen extends MainScreen {
/**
* Creates a new MyScreen objects
*
*/
Player player;
RecordControl recorder;
private ByteArrayOutputStream output;
byte[] data;
boolean yes = false;
int st;
public MyScreen() {
// Set the displayed title of the screen
setTitle("Call Recorder");
Phone.addPhoneListener(new PhoneListener() {
public void conferenceCallDisconnected(int callId) {
// TODO Auto-generated method stub
}
public void callWaiting(int callid) {
// TODO Auto-generated method stub
}
public void callResumed(int callId) {
// TODO Auto-generated method stub
}
public void callRemoved(int callId) {
// TODO Auto-generated method stub
}
public void callInitiated(int callid) {
PhoneCall phoneCall = Phone.getCall(callid);
if (phoneCall != null) {
st = Dialog.ask(Dialog.D_YES_NO,
"Are u sure to record this call");
if (st == Dialog.YES)
yes = true;
else
yes = false;
// TODO Auto-generated method stub
}
}
public void callIncoming(int callId) {
// TODO Auto-generated method stub
// TODO Auto-generated method stub
Dialog.ask(Dialog.D_YES_NO, "Are u sure to record this call");
// TODO Auto-generated method stub
}
public void callHeld(int callId) {
// TODO Auto-generated method stub
}
public void callFailed(int callId, int reason) {
// TODO Auto-generated method stub
}
public void callEndedByUser(int callId) {
// TODO Auto-generated method stub
}
public void callDisconnected(int callId) {
// TODO Auto-generated method stub
if (yes) {
try {
recorder.commit();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
player.close();
data = output.toByteArray();
saveRecordedFile(data);
}
}
public void callDirectConnectDisconnected(int callId) {
// TODO Auto-generated method stub
}
public void callDirectConnectConnected(int callId) {
// TODO Auto-generated method stub
}
public void callConnected(int callId) {
// TODO Auto-generated method s
PhoneCall phoneCall = Phone.getCall(callId);
if (phoneCall != null) {
if (yes)
initPlay();
}
}
public void callConferenceCallEstablished(int callId) {
// TODO Auto-generated method stub
}
public void callAnswered(int callId) {
// TODO Auto-generated method stub
// yes = true;
// TODO Auto-generated method stub
}
public void callAdded(int callId) {
// TODO Auto-generated method stub
}
});
}
// private void initMenuItem() {
// final String[] path = new String[1];
// ApplicationDescriptor appDesc = ApplicationDescriptor
// .currentApplicationDescriptor();
//
// final ApplicationDescriptor newDesc = new ApplicationDescriptor(
// appDesc, path);
//
// ApplicationMenuItemRepository amir = ApplicationMenuItemRepository
// .getInstance();
// ApplicationMenuItem a = new ApplicationMenuItem(1) {
// public Object run(final Object context) {
// Application.getApplication().invokeLater(new Runnable() {
//
// public void run() {
//
// }
// });
//
// return context;
// }
//
// public String toString() {
// return "Record Call";
// }
//
// };
// amir.addMenuItem(ApplicationMenuItemRepository.MENUITEM_PHONE, a,
// newDesc);
//
// }
private void initPlay() {
// TODO Auto-generated method stub
try {
player = Manager.createPlayer("capture://audio");
player.realize();
recorder = (RecordControl) player.getControl("RecordControl");
output = new ByteArrayOutputStream();
recorder.setRecordStream(output);
recorder.startRecord();
player.start();
} catch (Exception e) {
// TODO: handle exception
Dialog.alert(e + "");
}
}
public static boolean saveRecordedFile(byte[] data) {
try {
String filePath1 = System.getProperty("fileconn.dir.music");
String fileName = "Call Recorder(";
boolean existed = true;
for (int i = 0; i < Integer.MAX_VALUE; i++) {
try {
FileConnection fc = (FileConnection) Connector
.open(filePath1 + fileName + i + ").amr");
if (!fc.exists()) {
existed = false;
}
fc.close();
} catch (IOException e) {
Dialog.alert("unable to save");
return existed;
}
if (!existed) {
fileName += i + ").amr";
filePath1 += fileName;
break;
}
}
System.out.println(filePath1);
// output---file:///store/home/user/pictures/Photo Editor(10).bmp
System.out.println("");
FileConnection fconn = (FileConnection) javax.microedition.io.Connector
.open(filePath1, javax.microedition.io.Connector.READ_WRITE);
if (fconn.exists())
fconn.delete();
fconn.create();
OutputStream outputStream = fconn.openOutputStream();
outputStream.write(data);
outputStream.close();
fconn.close();
return true;
} catch (Exception e) {
}
return false;
}
}
+0
我相信BB的通话记录器只有在免提通话时才有效。 – Swati 2011-05-18 15:38:57
+0
它会同时保存多个文件.. 为什么.... ?? – 2011-11-15 09:45:01
相关问题
- 1. 取黑莓10通话记录
- 2. 查看通话记录历史记录后的黑莓通话方法?
- 3. 更改通话记录屏幕并推送自己的通话ID的黑莓
- 4. 如何在黑莓手机中录制通话?
- 5. 黑莓 - 使用会话?
- 6. 通缉:WinAPI通话记录器
- 7. Android。通话记录
- 8. android通话记录
- 9. Facebook登录黑莓Webworks
- 10. 黑莓6黑莓5
- 11. 黑莓:通过黑莓企业服务器调用webservice的Java应用程序
- 12. 黑莓Midlet安装通知
- 13. 获取通过GPS黑莓
- 14. 黑莓收到通知。
- 15. 推送通知:黑莓
- 16. 黑莓推送通知
- 17. Android通话记录监听器
- 18. 通话记录不保存记录
- 19. iPhone通话记录/历史记录
- 20. 黑莓Web模拟器
- 21. 黑莓旧的模拟器
- 22. 黑莓图像加载器
- 23. 黑莓QNX仿真器
- 24. 黑莓图片浏览器
- 25. 黑莓手机模拟器
- 26. 黑莓json解析器
- 27. 黑莓URL编码器
- 28. 黑莓关闭计时器
- 29. 黑莓听音器暂停?
- 30. 黑莓模拟器问题
感谢您的答复。 因此,录制通话不会有任何安全问题。我问这是因为,我听说,iPhone不允许通话录音功能。 – Kris 2011-05-18 13:44:02