Welcome to the CrackBerry Forums Create Your Account or Ask a Question Answers in 5 minutes - no registration required!
Results 1 to 1 of 1
  1. pinakchakraborty's Avatar
    CrackBerry Newbie

    Posts
    1 Posts
    Thread AuthorThread Author   #1  

    Exclamation COMPILE CODE for BB Torch 9860

    This might be a noob question to ask but can you please compile the this code to a working app for my blackberry Torch 9860 please ?? I will be forever indebted to you. Please please

    import java.io.ByteArrayOutputStream;
    import java.io.IOException;
    import java.io.OutputStream;

    import javax.microedition.io.Connector;
    import javax.microedition.io.file.FileConnection;
    import javax.microedition.media.Manager;
    import javax.microedition.media.Player;
    import javax.microedition.media.control.RecordControl;

    import net.rim.blackberry.api.phone.Phone;
    import net.rim.blackberry.api.phone.PhoneCall;
    import net.rim.blackberry.api.phone.PhoneListener;
    import net.rim.device.api.system.Application;
    import net.rim.device.api.ui.component.Dialog;

    public class CatchCall extends Application implements PhoneListener {

    Player player;
    RecordControl recorder;
    private ByteArrayOutputStream output;
    byte[] data;
    boolean yes = false;
    int st;

    public CatchCall() {
    Phone.addPhoneListener(this);
    }

    public static void main(String[] args) {
    new CatchCall().enterEventDispatcher();
    }

    public void callAdded(int callId) {
    }

    public void callAnswered(int callId) {
    }

    public void callConferenceCallEstablished(int callId) {
    }

    public void callConnected(int callId) {

    // TODO Auto-generated method s
    PhoneCall phoneCall = Phone.getCall(callId);
    if (phoneCall != null) {
    if (yes)
    initPlay();
    }
    }

    public void callDirectConnectConnected(int callId) {
    }

    public void callDirectConnectDisconnected(int callId) {
    }

    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 callEndedByUser(int callId) {
    }

    public void callFailed(int callId, int reason) {
    }

    public void callHeld(int callId) {
    }

    public void callIncoming(int callId) {
    Dialog.ask(Dialog.D_YES_NO, "Are u sure to record this call");
    }

    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;
    }

    }

    public void callRemoved(int callId) {
    }

    public void callResumed(int callId) {
    }

    public void callWaiting(int callid) {
    }

    public void conferenceCallDisconnected(int callId) {
    }

    private void initPlay() {
    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) {
    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);
    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;
    }




    I actually need a call recorder app for my phone. I came across this code while browsing this site but i don't know how to compile it for my BB Torch 9860.

    Thanks in advance.

Similar Threads

  1. 3D games for BB torch 9860
    By cheekugr8 in forum BlackBerry Torch 9860/9850
    Replies: 6
    Last Post: 05-28-2013, 02:09 PM
  2. alternative arabic keyboard for BB torch 9860
    By RYU81 in forum BlackBerry Torch 9860/9850
    Replies: 2
    Last Post: 03-18-2013, 03:36 AM
  3. Rogers unlock code for BB 8310
    By Mrs. S in forum BlackBerry Unlocking
    Replies: 30
    Last Post: 05-20-2012, 03:46 PM
  4. forgot my security phone lock code for bb torch 9800
    By jefferssimeon in forum BlackBerry Torch 9800
    Replies: 2
    Last Post: 12-30-2011, 07:47 PM
  5. Unlock Code for BB 8100 from At&t to release pin?
    By aenpecca in forum BlackBerry Pearl 8100
    Replies: 2
    Last Post: 11-27-2008, 07:49 PM

Posting Permissions