Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am using midp 2.0. Here, I am using FileConnection for read and write files on mobile memory. I am able to read and write files on mobiles successfully. But while I am trying to write file data on mobile, it asking message like below.

Application wants to read from the local file system

is it OK to read your files?

if I press yes, then it again shows

Application wants to write to the local file system

is it OK to update your files?

These message are continuously showing approximately 10 times.

Is there any way to prevent this repeating this more than one time?

I have included my fileWrite method for your reference also:

    public String fileWrite(String root)
{                
    FileConnection fc = null;
    String fName = "test.txt";
    DataOutputStream dos=null;
    try
    {
        fc = (FileConnection) Connector.open(root + fName, Connector.READ_WRITE);
        if(!fc.exists())
        {
            fc.create();
        }
        else
        {
            System.out.println("File Exists part");
            fc.delete();
            fc.create();
        }

        dos = fc.openDataOutputStream();
        dos.write("f".getBytes());
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
    finally
    {
        try
        {
            fc.close();
            dos.close();
        }
        catch (IOException e) { }
    }


return "Saved in "+root+fName;
    //return "NULL";
}//filewrite ends here*/
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
473 views
Welcome To Ask or Share your Answers For Others

1 Answer

This is not coding related issue. Basically this type of confirm alert asking for security purpose. Because you are using JSR-75.

In this purpose, You need to sign your application with atleast any 3rd party signature like one from Verisign or Thrawte and then go to the application settings - permissions - and set permission for "Access User Data" as "Ask only Once" or "Allow Always" (these settings might not be available for your unsiged app on the device.)

If you facing this Issue on the emulator, go to preferences and MIDP tab, set the application domain to Trusted and set permission as "Allow Always". For more info, see here...

Signing sites are,

Thawte

Verisign

Java Verified


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...