×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Regular Contributor
    Join Date
    Jan 2010
    Posts
    52

    Can't access phones files system

    Hey guys,

    I have a J2ME MIDlet running on a S40 device.
    I have the following function which is used to play mp3 files from a resource file and it works perfectly:

    public void playMP3Sound(String file_name) {
    if (null != m_player) {
    m_player.close();
    m_player = null;
    System.gc();
    }
    try {
    InputStream in = getClass().getResourceAsStream(file_name);
    m_player = Manager.createPlayer(in,"audio/mpeg");}
    catch(Exception ignored) { }
    try
    {
    m_player.realize();
    m_player.prefetch();
    m_player.start();
    }
    catch(Exception ignored){ }
    }
    I'm trying to play an mp3 file from the phones memory. My MIDlet is signed so I added the following MIDlet-Permissions:
    javax.microedition.io.Connector.file.write
    javax.microedition.io.Connector.file.read
    and I changed:
    InputStream in = getClass().getResourceAsStream(file_name);
    to:
    FileConnection fileConn = (FileConnection)Connector.open(file_name, Connector.READ);
    InputStream in = fileConn.openInputStream();
    an example file name is "file:///c:/Gallery/Audio/beep.mp3"
    When I call this function, an access denied exception is thrown. What can I do to fix this?

    Thanks!

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Can't access phones files system

    You are very limited in terms of which parts of the file system you can access. You might find this thread useful.

    Graham.

  3. #3
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,087

    Re: Can't access phones files system

    It looks that you might have entered the wrong file path or the path is not accessable to your app ("file:///c:/Gallery/Audio/beep.mp3").

    Which signature are you using to sign the build, did you add permissions in your JAD, did you modify the application permissions settings on the device after installing it - chcek if access to read user data and file system is allowed?

    try to run WTK PDAPDemo on your traget device and see if this can access this file - "file:///c:/Gallery/Audio/beep.mp3"

    thanks,
    ~Amitabh

Similar Threads

  1. CBufferedImageDecoder JPG files problem at MR phones
    By igor_k11 in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2010-04-23, 08:44
  2. Unable to Access files in \\E:\ on N95 8GB
    By AnnieGetYerPhone in forum PC Suite API and PC Connectivity SDK
    Replies: 0
    Last Post: 2009-10-26, 23:04
  3. Nokia 6233 not revieving mp3 files from Samsung phones!!!!!!!!!
    By someone7272 in forum Bluetooth Technology
    Replies: 3
    Last Post: 2008-08-04, 13:53
  4. [Moved} internet access on S40 phones
    By Sam Vimes in forum Mobile Java Networking & Messaging & Security
    Replies: 2
    Last Post: 2008-07-16, 17:20
  5. 7250 image files access
    By catale in forum Mobile Java General
    Replies: 2
    Last Post: 2003-03-24, 08:36

Posting Permissions

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