4

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*/
gnat
  • 6,213
  • 108
  • 53
  • 73
Saravanan
  • 11,372
  • 43
  • 143
  • 213

2 Answers2

3

If you go to 3rd party trusted certificate means its minimum cost is RS.10000 per year. For deploying your application in client (final stage). It will worth.

But for testing, validating input, developing stage the cost is high. So check if your mobile has support for self signed certificate. If it supports self signed certificate, then process with self signed certificate.

But keep in mind self signed certificate is only for testing / development purpose. For delivering the project to client you should go to trusted party certificates.

gnat
  • 6,213
  • 108
  • 53
  • 73
SIVAKUMAR.J
  • 4,258
  • 9
  • 45
  • 80
3

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

bharath
  • 14,283
  • 16
  • 57
  • 95
  • thanks bhakki, i found preference on edit menu and couldn't able to find any MIDP tab or option for set Application domain to trusted and set permission as "Allow always"... Please guide me to get this issue.. – Saravanan Jan 10 '11 at 07:48
  • 1
    In sun java emulator, u can choose preference - security - change the MSA value to maximum. – bharath Jan 10 '11 at 08:03
  • thanks a lot bhakki... It working fine.but it did not ask any msg. Is there a way to ask it once? – Saravanan Jan 10 '11 at 08:59
  • change the security domain and try it. but i dont know the exactly. – bharath Jan 10 '11 at 09:17
  • How to sign my application with 3rd party signature like from verisign or thrawte? Give me a procedure to get this problem? – Saravanan Jan 10 '11 at 09:23
  • thanks bhakki., don't mistake me for asking this question... Is there any cost free 3rd party available? – Saravanan Jan 10 '11 at 09:54
  • I have bought certificate of COMODO. But I have no idea how to sign my application using this. Please help. – Jemish Patel Jun 06 '13 at 12:19