You Are Here:

Community: Developer Discussion Boards

#1 Old When I add Contactlist , it shows Security Exception - 2008-11-09, 02:54

Join Date: Apr 2008
Posts: 11
pornchaispencer
Offline
Registered User
When I run this code by using emulator s40.Everything seems to be ok but when I put on my real mobile phone which is the same as my emulator (I using nokia6270), it shows "Security Exception" and I cannot add any ContactList. Can anyone help me how to solve this problem. If I put a catch(SecurityException) then it won't add contactlist to my mobile phone. What is the best solution to add my contact list on my mobile phone

Thank you

Code:
 final String VCard = "BEGIN:VCARD\r\n"+
                "VERSION:3.0\r\n"+
                "FN:12345678qwerty\r\n"+
                "REV:2008-05-05\r\n"+
                "TEL:111111\r\n"+
                "UID:1.vcf\r\n"+
                "END:VCARD\r\n";
        
//        final String VCard = "swrgb";
        PIMList list;
        try {
            list = PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
            ByteArrayInputStream bais = new ByteArrayInputStream(VCard.getBytes());
            DataInputStream dis = new DataInputStream(bais);
            PIMItem[] items;
            items = PIM.getInstance().fromSerialFormat(dis, "UTF-8");
            Contact c = ((ContactList) list).createContact();
            c = (Contact) items[0];
            Contact contact = ((ContactList) list).importContact(c);
            contact.commit();
        } catch (PIMException ex) {
            ex.printStackTrace();
        } catch (UnsupportedEncodingException ex) {
            ex.printStackTrace();
        }
Reply With Quote

#2 Old Re: When I add Contactlist , it shows Security Exception - 2008-11-09, 20:59

Join Date: Apr 2003
Posts: 6,408
Location: USA, CA
hartti's Avatar
hartti
Offline
Nokia Expert
Is your phone branded for some operator? if yes, which one?
Have you signed your MIDlet?

Hartti
Reply With Quote

#3 Old Re: When I add Contactlist , it shows Security Exception - 2008-11-10, 08:15

Join Date: Nov 2008
Posts: 6
spcboy
Offline
Registered User
Please check these steps:
1. Have you added API permissions to your jad files?
2. Have you signed your applications?
3. If so, Does you signature has enough authority to do such operation?
Reply With Quote

#4 Old Re: When I add Contactlist , it shows Security Exception - 2008-11-10, 16:53

Join Date: Apr 2008
Posts: 11
pornchaispencer
Offline
Registered User
Thank you, but can you tell me
How to add API permissions to my jad files?
and How to sign my applications?

Thank you for ur advices.
Reply With Quote

#5 Old Re: When I add Contactlist , it shows Security Exception - 2008-11-10, 17:04

Join Date: Nov 2008
Posts: 6
spcboy
Offline
Registered User
You may need to add following to your jad:

MIDlet-Permissions: javax.microedition.pim.ContactList.read, javax.microedition.pim.ContactList.write
Reply With Quote

#6 Old Re: When I add Contactlist , it shows Security Exception - 2008-11-11, 06:01

Join Date: Jul 2008
Posts: 329
Location: Faridabad(Delhi NCR)
Send a message via MSN to ansh.chauhan Send a message via Yahoo to ansh.chauhan
ansh.chauhan's Avatar
ansh.chauhan
Offline
Regular Contributor
Please Signed ur midlet then go to Application(Midlet Setting) Property ...then Allow permission for accessing user read and write data...


Anshu Chauhan
J2me Developer
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
Socket usage throws a security exception on Nokia devices. tamboss2 Mobile Java Networking & Messaging & Security 4 2005-09-01 17:24
security exception on datagram open despite signed midlet dwigdor Mobile Java Networking & Messaging & Security 0 2005-08-22 01:21
i got the Security Exception when i call the madnan_java Mobile Java General 1 2004-10-06 13:13
Security Exception on networking midlet using JSR-82 jurthe Mobile Java Networking & Messaging & Security 0 2004-08-27 10:32
Security Exception when I execute a MIDlet in Sun One powercle Mobile Java General 0 2003-06-12 20:32

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia