×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    May 2009
    Posts
    2

    Question RecordControl, endless confirmations

    Hello to all.

    I've tried to find the way around my problem, but the answer eluding me for quite some time now.
    I'm developing a small midlet that will allow user to record sound and trasmit it. The transmit part works fine and the examples for recordings are all around the internet. The device used for testing is 6233.

    The problems I encounter:
    - After installing the midlet, I set "Application Accesss -> Data Access -> Multimedia recording - "Ask first time only", but every time I start a record, the phone still ask permission.
    - After record is done, the phone asks again: "Application may send recorded data"? If I don't accept sending data, I get "java.IO.IOException: Unable to upload data". What that is? Why does it have something to do with upload anyway?
    - If I allow to upload data and try to play the other exception is generated. "Media Exception: device error".

    So the actual questions are:
    - How do I get rid of those really annoying promts? They disrupt normal program operation. Signing probably the best solution, but for my testing application and development 400$ to Versign is way to much. I can understand one time first time prompt, as for network communication prompts, but every time is a critical failure.
    - What is the "send recorded data" thing. Is it related to transferring data to output stream? How to suppress it, since I don't really understand why it's actually there?
    - What are correct URI string for recording from microphone and playing recorded data?

    Also related questions:
    - How would you sign your certificate without paying tons of money to 3rd party sites? I've tried to sing my midlet with a custom certificate, but the phone, obviously rejects it with "Can't find root/user certificate". The search on "how to add user certificate to S40 phone" turned nothing of value. (Or I didn't find any clear explanation on how to import user certificates to 6233 phone). The phone itself don't have the "Add certificate" option.

    Please help me, because I'm really stuck, since the annoying popup dialogs simply negates all my work and reason for developing.

    Regards,
    Oleg.

    The code used for test is:
    Code:
    class VoiceRecordForm extends Form implements CommandListener {
          private StringItem message;
          private StringItem errormessage;
          private final Command record, play;
          private Player player;
          private byte[] recordedAudioArray = null;
          public VoiceRecordForm() {
                super("Recording Audio");
                message = new StringItem("", "Select Record to start recording.");
                this.append(message);
                errormessage = new StringItem("", "");
                this.append(errormessage);
                record = new Command("Record", Command.OK, 0);
                this.addCommand(record);
                play = new Command("Play", Command.BACK, 0);
                this.addCommand(play);
                this.setCommandListener(this);
          }
          public void commandAction(Command comm, Displayable disp) {
                if (comm == record) {
                      Thread t = new Thread() {
                            public void run() {
                                  try {
                                        player = Manager.createPlayer("capture://audio");
                                        player.realize();
                                        RecordControl rc = (RecordControl) player.getControl("RecordControl");
                                        ByteArrayOutputStream output = new ByteArrayOutputStream();
                                        rc.setRecordStream(output);
                                        rc.startRecord();
                                        player.start();
                                        message.setText("Recording...");
                                        Thread.sleep(5000);
                                        message.setText("Recording Done!");
                                        rc.commit();
                                        recordedAudioArray = output.toByteArray();
                                        player.close();
                                  } catch (Exception e) {
                                        errormessage.setLabel("Error");
                                        errormessage.setText(e.toString());
                                  }
                            }
                      };
                      t.start();
    
                }
                else if (comm == play) {
                      try {
                            ByteArrayInputStream recordedInputStream = new ByteArrayInputStream(recordedAudioArray);
                            Player p2 = Manager.createPlayer(recordedInputStream, "audio/x-wav");
                            p2.prefetch();
                            p2.start();
                      } catch (Exception e) {
                            errormessage.setLabel("Error");
                            errormessage.setText(e.toString());
                      }
                }
          }
    Last edited by toplionkin; 2010-04-02 at 10:34.

  2. #2
    Super Contributor
    Join Date
    May 2008
    Location
    Helsinki, Finland
    Posts
    1,100

    Re: RecordControl, endless confirmations

    Hello toplionkin,

    MIDlets indeed are very strict because of the "sandbox model" they use. This is done because untrusted MIDlets could compromise user security. That's why they generate also security/IOExeptions.

    The user can do a manual setting for the midlet, e.g. some models("Nokia > Menu > Tools > Manager > your MIDlet > Suite settings > Multimedia > Ask first time?")

    To make these settings become default after installation you should go with creating trusted MIDLets by signing them.

    The signing will add possibility to allow this "always".

    MIDP 2.0 (JSR-118) introduced the concept of "trusted" and "untrusted" MIDlet suites. An "untrusted" suite operates under the same restrictions as in MIDP 1.0 - the only API's that can be accessed are those that are part of the MIDP specification. "Trusted" suites can be granted access to a wider selection of API's on the device. In addition, as part of the MIDP 2.0 specification, certain "standard" API's were provided that required authorization to use. For example, an untrusted MIDlet suite must be able to access the javax.microedition.io.HttpConnection API, but the system is required to make the user confirm that it is OK for the MIDlet suite to use this API.

    Trusted MIDlet suites can, on the other hand, be granted access to API's without explicit user authorization, and may have access to API's that an untrusted MIDlet is not allowed to access. Details of all of this are spelled out in JSR-118 definition.


    Please check this out :"Signed MIDlet Developers Guide":

    http://www.forum.nokia.com/info/sw.n..._0_en.pdf.html

    You could go thru this too: http://developers.sun.com/mobility/learn/midp/security/

    Also related questions:
    - How would you sign your certificate without paying tons of money to 3rd party sites?
    I've tried to sing my midlet with a custom certificate, but the phone, obviously rejects it with "Can't find root/user certificate". The search on "how to add user certificate to S40 phone" turned nothing of value. (Or I didn't find any clear explanation on how to import user certificates to 6233 phone). The phone itself don't have the "Add certificate" option.
    Again...the fact that a midlet is signed by the author (vendor) certifies two things:

    * that the author really authored that MIDlet
    * that the MIDlet is in original state (i.e. it hasn’t been modified
    by a third party)

    The purpose of signing a MIDlet is two-fold:

    * to gain access to security-sensible operations on the phone (such as sending an SMS or opening a TCP connection)

    * to make sure that a (malicious) third party can’t present a different MIDlet as the original one


    Please let me know what are you thoughts on this and what would you like to go thru in more detail?

    Best Regards,
    Last edited by Maveric; 2010-04-02 at 19:25.
    [FONT="Comic Sans MS"][COLOR="Blue"][/COLOR][I]Marko Lumivuori
    Technical Support
    +358 40 8019330
    [email]marko.lumivuori@nokia.com[/email][/I][/FONT]

Similar Threads

  1. *Sometimes* getSnapshot throws MediaException, RecordControl Error
    By olan75 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 2
    Last Post: 2011-04-03, 16:11
  2. Setting size limitation to RecordControl
    By Krapula in forum Mobile Java Media (Graphics & Sounds)
    Replies: 0
    Last Post: 2009-01-16, 12:20
  3. RecordControl problem
    By gordon32 in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2007-03-09, 01:57
  4. Strange RecordControl behaviour in N93
    By neovoen in forum Mobile Java Media (Graphics & Sounds)
    Replies: 4
    Last Post: 2006-09-16, 18:35
  5. N6230i and delivery confirmations
    By ta3sherpa in forum General Development Questions
    Replies: 1
    Last Post: 2005-07-07, 18:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×