×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jun 2010
    Posts
    21

    Question FIle Connection Api No YES

    hi!! i used the file connection api example in the wiki section..

    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.io.file.*;
    import javax.microedition.io.*;
    import java.io.*;

    public class WriteMIDlet extends MIDlet implements CommandListener {
    private TextBox textbox;
    private String photos = "fileconn.dir.photos";
    private Command saveCommand;
    private Command exitCommand;
    private String path;

    public void startApp() {
    textbox = new TextBox("WriteMIDlet", "", 1000, TextField.ANY);
    saveCommand = new Command("Save", Command.SCREEN, 1);
    exitCommand = new Command("Exit", Command.EXIT, 1);
    textbox.addCommand(saveCommand);
    textbox.addCommand(exitCommand);
    textbox.setCommandListener(this);
    Display.getDisplay(this).setCurrent(textbox);
    path = System.getProperty(photos);
    }

    public void pauseApp() {
    }

    public void destroyApp(boolean unconditional) {
    }

    private void saveFile(String path, String name) {
    try {
    String url = path + name;
    String string = textbox.getString();
    byte data[] = string.getBytes();
    FileConnection fconn = (FileConnection)Connector.open(url, Connector.READ_WRITE);
    if (!fconn.exists()) {
    fconn.create();
    }
    OutputStream ops = fconn.openOutputStream();
    ops.write(data);
    ops.close();
    fconn.close();
    }
    catch (IOException ioe) {
    System.out.println("IOException: "+ioe.getMessage());
    }
    catch (SecurityException se) {
    System.out.println("Security exception:" + se.getMessage());
    }
    }

    public void commandAction(Command c, Displayable d) {
    if (c == saveCommand) saveFile(path, "readme.txt");
    if (c == exitCommand) this.notifyDestroyed();
    }
    }

    but the application is asking "Allow application to edit and add new data in: ". Gallery, Yes No

    could it be possible that the file just save without asking...

  2. #2
    Super Contributor
    Join Date
    Mar 2008
    Location
    The Capital of INDIA
    Posts
    4,328

    Re: FIle Connection Api No YES

    You can get rid of these permission alerts if you signed the application using the third party certificate like the Verisign, Thwate ort even the Java Signing.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Registered User
    Join Date
    Jun 2010
    Posts
    21

    Re: FIle Connection Api No YES

    do you have any samples Sir..
    for using any of those tools?..

    tnx

  4. #4
    Registered User
    Join Date
    Jun 2010
    Posts
    5

    Re: FIle Connection Api No YES

    ahm..yah ..we have the same problem sir.. but aside from signing, is there any other way to get rid of these permissions?..

    thanks.

Similar Threads

  1. File Connection API
    By helwg1130 in forum Mobile Java General
    Replies: 5
    Last Post: 2009-06-29, 18:20
  2. File Connection API
    By mahesh_aquarius in forum Mobile Java Media (Graphics & Sounds)
    Replies: 3
    Last Post: 2009-03-09, 05:54
  3. File Connection Api
    By savio_mf in forum Near Field Communication
    Replies: 3
    Last Post: 2008-08-12, 12:14
  4. File System(File Connection API)
    By amalshah73 in forum Mobile Java General
    Replies: 1
    Last Post: 2007-08-26, 02:41
  5. file connection api vs signing
    By Rozik in forum Mobile Java General
    Replies: 1
    Last Post: 2007-05-15, 19:52

Posting Permissions

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