在BlackBerry中发送PIN消息不起作用

时间:2012-10-04 17:29:01

标签: blackberry java-me

我的应用程序发送PIN消息,但是当我的应用程序发送PIN消息时,它只是到达发件箱文件夹并保留在那里,带有时钟图标。它并没有真正发送给收件人。

下面是我的代码,请你告诉我它有什么问题:

public class SendPin implements carinfoResource
{
    private static ResourceBundle _res = 
       ResourceBundle.getBundle(BUNDLE_ID, BUNDLE_NAME);

    public SendPin() {
    }

    public void sendPin(int command)
    {
        Store store = Session.getDefaultInstance().getStore();
        //retrieve the sent folder
        Folder[] folders = store.list(Folder.SENT);
        Folder sentfolder = folders[0];
        //create a new message and store it in the sent folder
        Message msg = new Message(sentfolder);
        PINAddress recipients[] = new PINAddress[1];
        try{
            //create a pin address with destination address of 20000000
            recipients[0]= new PINAddress("289A2FF6", "Soporte Desarrollo");
        }
        catch (AddressException ae)
        {
            System.err.println(ae);
        }

        try{
            //add the recipient list to the message
            msg.addRecipients(Message.RecipientType.TO, recipients);
            //Command travel without troubles
            if(command == 0)
            {
                //set a subject for the message
                msg.setSubject(_res.getString(OKSUBJECT));
                //sets the body of the message
                msg.setContent(_res.getString(OKBODY));
            }
            else
            {
                //set a subject for the message
                msg.setSubject(_res.getString(ISSUESUBJECT));
                //sets the body of the message
                msg.setContent(_res.getString(ISSUEBODY)+"  "+this.getIMSI());
            }
            Transport.send(msg);
        }
        catch (MessagingException me)
        {
            System.err.println(me);
        }
    }

    public  String getIMSI() {
        String imsi = null;
        try {
            imsi = GPRSInfo.imeiToString(SIMCardInfo.getIMSI());
        } catch (Exception e) {
            System.err.println(e);
        }
        return imsi;
    }
}

0 个答案:

没有答案