×

Discussion Board

Results 1 to 6 of 6
  1. #1
    Regular Contributor
    Join Date
    Feb 2010
    Posts
    78

    Smile Motorola application error

    Hi,

    Am doing a Contact based application in my Motorola phone. When i compile the phone in a Motorola SDK it works fine.

    The problem is when I install it in my motorola phone and when i run it , am getting a application error.


    Can anyone please help me.

    Thanks in advance
    Deva

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

    Re: Motorola application error

    What are the MIDP and CLDC version of the app?
    Please compare the same with the device's ?

    Which device are you working with?
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

  3. #3
    Super Contributor
    Join Date
    Mar 2003
    Location
    Finland
    Posts
    9,561

    Re: Motorola application error

    Nokia is a different company from Motorola. Motorola's developer support can be found here: http://developer.motorola.com/

  4. #4
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Motorola application error

    Hi,

    Am doing a Contact based application in my Motorola phone. When i compile the phone in a Motorola SDK it works fine.

    The problem is when I install it in my motorola phone and when i run it , am getting a application error.


    Can anyone please help me.

    Thanks in advance
    Deva
    You need to sign the application with Motorola certificate to access the PIM data from a Motorola device. Its free, you can get it from motorola dev support site and you will require to sign the build for your device IMEI no. for testing.

    thanks,
    Ekta

  5. #5
    Regular Contributor
    Join Date
    Feb 2010
    Posts
    78

    Smile Re: Motorola application error

    Quote Originally Posted by raj_J2ME View Post
    What are the MIDP and CLDC version of the app?
    Please compare the same with the device's ?

    Which device are you working with?
    have checked the MIDP and CLDC version...when i removed the PIM from the Constructor that error goes off..but the problem is
    the contact is not being added up.. am i making mistakes in the case of header files.
    Am pasting my code below..
    Code:
    import javax.microedition.midlet.*;
    import javax.microedition.lcdui.*;
    import javax.microedition.pim.*;
    import java.util.*;
    
    
    
    public class MyPim extends MIDlet implements CommandListener {
        
    	private Display display;
            
    	private Form    myForm;
    	private Form    newContactForm;
    /****************** Text Fields *************************/
    	private TextField enterName;
    	private TextField enterNick;
    	private TextField enterNumber;
            
    /****************** ContactList **************************/
            ContactList myContactList  =  null;
            Contact                 c  =  null;
    /***************** Enumeration object for storing contacts in **********/
            
            Enumeration contact;
            
    /***************** Commands ******************************/
            //private Command contactDB;
            private Command displayPhonebook;
            private Command enterContact; //Take to contact input form
            private Command addContact; //Commit contact to DB
            private Command showFields;
            private Command showFieldAttributes;
            private Command showCategories;
            private Command clearScreen;
    		//PIMS
            PIM myPIM;
            
    public MyPim(){
            display = Display.getDisplay(this);
    
    	myForm              =  new Form("Contact PIM");
    	displayPhonebook    =  new Command("PhoneBook",Command.OK,0);
    	enterContact        =  new Command("EnterContact",Command.OK,0);
    	showFields          =  new Command("Fields",Command.OK,0);
    	showFieldAttributes =  new Command("Attributes",Command.OK,0);
    	showCategories      =  new Command("Categories",Command.OK,0);
    	clearScreen         =  new Command("Clear Screen",Command.OK,0);
    		myForm.addCommand(displayPhonebook);
    		myForm.addCommand(enterContact);
    		myForm.addCommand(showFields);
    		myForm.addCommand(showFieldAttributes);
    		myForm.addCommand(showCategories);
    		myForm.addCommand(clearScreen);
    		myForm.setCommandListener(this);
    	display.setCurrent(myForm);
            
    	//myPIM = PIM.getInstance();
    	//initPIM();
    }
    private void initPIM(){
    	myForm.deleteAll();
    	myPIM = PIM.getInstance();
    	try {
    		String ContactList[] =  myPIM.listPIMLists(PIM.CONTACT_LIST);
    		myContactList        =  (ContactList)myPIM.openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
    		contact              =  myContactList.items();
    	}
    	catch (Exception e) {
    		e.printStackTrace();
    	}
    	DisplayContacts();
    }
                            
                                /*How to Create a New Contact*/
    public void DisplayNewContactForm(){
    	newContactForm =  new Form("Enter new contact");
    	addContact     =  new Command("Add", Command.OK, 0);
    	enterName      =  new TextField("Enter Name","", 20,TextField.ANY);
    	enterNick      =  new TextField("Enter Nick","", 20,TextField.ANY);
    	enterNumber    =  new TextField("Enter Tel","", 20,TextField.PHONENUMBER);
                newContactForm.append(enterName);
                newContactForm.append(enterNick);
                newContactForm.append(enterNumber);
                newContactForm.addCommand(addContact);
                newContactForm.addCommand(displayPhonebook);
                newContactForm.setCommandListener(this);
    	display.setCurrent(newContactForm);
    }
    
    public void createNewContact(){
    	String getName     =  enterName.getString();
    	String getNick     =  enterNick.getString();
    	String getNumber   =  enterNumber.getString();
            
    	Contact newContact =  myContactList.createContact();
    				//Name
    	if (myContactList.isSupportedField(Contact.FORMATTED_NAME)){
    	   try{
    		newContact.addString(Contact.FORMATTED_NAME,PIMItem.ATTR_NONE,getName);
    	   }catch(Exception e){
    		   e.printStackTrace();
    	   }
    	}
    	else{
    		System.out.println("THIS IS NAME");
    	}
    				//NickName
    	if (myContactList.isSupportedField(Contact.NICKNAME)){
    	    try{
    		newContact.addString(Contact.NICKNAME,Contact.ATTR_MOBILE, getNick);
    	    }catch(Exception e){
    			e.printStackTrace();
    	    }
    	}
    				//Telephone
    	if (myContactList.isSupportedField(Contact.TEL)){
    	    try{
    		newContact.addString(Contact.TEL, PIMItem.ATTR_NONE,getNumber);
    	    }catch(Exception e){
    		  e.printStackTrace();
    	    }
    	}
    	try{
    		//write the new Contact to the PIM database
    		newContact.commit();
    		System.out.println("Contact Added \n");
    	}
    	catch(Exception e){
    		e.printStackTrace();
    	}
    }
    
                        /* below is used for displaying all the "fields" present */
    public void displayContactListFields(){
    	int[] arrayFields = myContactList.getSupportedFields();
    	myForm.append("Supported Fields \n");
    	for(int i = 0; i < arrayFields.length ; i++){
    	   try{
    		myForm.append(myContactList.getFieldLabel(arrayFields[i]) + "\n");
    	   }catch(Exception e){
    		e.printStackTrace();
    	   }
    	}
    }
                    /* below is used for displaying all the "Categories" present */
    //To Find the list of supported fields on your device
    public void displayContactListCategories(){
    	try{
    		String[] listCategories = myContactList.getCategories();
    		myForm.append("Supported Categories");
    		for(int i = 0; i < listCategories.length ; i++){
    				myForm.append(listCategories[i] + "\n");
    		}
    	}
    	catch(Exception e){
    		e.printStackTrace();
            }
    }
                    /* below is used for displaying all the "Attributes" present */
    public void displayFieldAttributes(){
    	int[] arrayFields = myContactList.getSupportedFields();
    	for(int i = 0; i < arrayFields.length ; i++){
    	    try{
                        myForm.append("\n" +myContactList.getFieldLabel(arrayFields[i]) + " : ");
                        int attrList[] = myContactList.getSupportedAttributes(arrayFields[i]);
                        for(int j=0;j<attrList.length;j++){
                                myForm.append(myContactList.getAttributeLabel(attrList[j])+ " ");
                        }
                }catch(Exception e){
    			e.printStackTrace();
                }
    	}
    }
    public void DisplayContacts(){
            while (contact.hasMoreElements()) {
    		c                 =  (Contact) contact.nextElement();
    		int[] Fields      =  c.getFields();
    		String[] catArray =  c.getCategories();
                    
    		for(int ii = 0; ii < catArray.length ; ii++){
    			myForm.append("Category :" + catArray[ii] + "\n");
                            System.out.println("Category :" + catArray[ii]);
    		}
    		for(int i = 0; i < Fields.length ; i++){
    			String field = myContactList.getFieldLabel(Fields[i]);
                            
    			if(Fields[i] == Contact.FORMATTED_NAME){
    			     myForm.append("Name : " + c.getString(Fields[i],0) + "\n");
                                 System.out.println("Name : " +c.getString(Fields[i],0));
                            }
                            if(Fields[i] == Contact.TEL){
                                int att = c.getAttributes(Fields[i],0);
                                String attributeLabel = myContactList.getAttributeLabel(att);
                                System.out.println(attributeLabel + c.getString(Fields[i],0));
                                
                                if(attributeLabel.compareTo("NONE") < 0){
                                    myForm.append(attributeLabel + " : " +c.getString(Fields[i],0) + "\n");
                                }
                                else  if(attributeLabel.compareTo("NONE") < 0){
                                    myForm.append("Telephone : "+c.getString(Fields[i],0) + "\n");
                                }
                            }
                     }
            }
    }
    public void startApp() {
    }
    public void pauseApp() {
    }
    public void destroyApp(boolean unconditional) {
    }
    public void commandAction(Command c, Displayable d) {
           if(c == displayPhonebook){
                initPIM();
                display.setCurrent(myForm);
           }
           else if(c == enterContact){
                DisplayNewContactForm();
           } 
           else if(c == addContact){
                createNewContact();
                DisplayNewContactForm();
           }
           else if (c == showFields){
                displayContactListFields();
           }
           else if(c == showFieldAttributes){
                displayFieldAttributes();
           }
           else if(c == showCategories){
                displayContactListCategories();
           }
           else if(c == clearScreen){
                myForm.deleteAll();
           }
    }
    }
    Can u please help me..

    With Regars
    Deva

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

    Re: Motorola application error

    Hey did you read the post of the ekta?

    As he has already suggested that in order to read the PIM you must have to have the app as signed.Kindly follow that post.

    I am sure that this will help you.
    Thanks with Regards,

    R a j - The K e r n e l


    Join Delhi-NCR Nokia Developer's Community,

Similar Threads

  1. Porting MD5, but getting too many errors
    By farmdve in forum Symbian
    Replies: 4
    Last Post: 2010-05-23, 07:37
  2. Errors compiling speex1.2-rc1 in Symbian 3th edition SDK
    By mauriziomento in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2010-03-23, 00:15
  3. Error with makesis.exe and creating the .pkg file
    By gramya87 in forum Symbian Tools & SDKs
    Replies: 7
    Last Post: 2007-10-10, 13:53
  4. code warrior problems
    By mayankkedia in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 2
    Last Post: 2004-10-25, 06:59

Posting Permissions

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