How do I send SMS from PC to mobile using simplewire for Java?

浪尽此生 提交于 2020-01-02 06:59:08

问题


I am using "simplewire" library (for Java) which should be able to send SMS from PC to mobile. However, I am seeting the following error:

Message was not sent! Error Code: 420 Error Description: Invalid Subscriber ID or Subscriber Password.

Here is my code sample

import com.simplewire.sms.*;

public class send_text
{
    public static void main(String[] args) throws Exception
    {
        SMS sms = new SMS();

        // Subscriber Settings
        sms.setSubscriberID("123-456-789-12345");
        sms.setSubscriberPassword("1234");

        // Message Settings
        sms.setMsgPin("+11005101234");
        sms.setMsgFrom("Demo");
        sms.setMsgCallback("+11005551212");
        sms.setMsgText("Hello World From Simplewire!");

        System.out.println("Sending message to Simplewire...");

        // Send Message
        sms.msgSend();

        // Check For Errors
        if(sms.isSuccess())
        {
            System.out.println("Message was sent!");
        }
        else
        {
            System.out.println("Message was not sent!");
            System.out.println("Error Code: " + sms.getErrorCode());
            System.out.println("Error Description: " + sms.getErrorDesc());
            System.out.println("Error Resolution: " + sms.getErrorResolution() + "\n");
        }
    }
}

I want to know how to get Subscriber ID and Subscriber Password? Do I need an account for that?.


回答1:


From the Simplewire Java SMS SDK Manual

The subscriber ID is an ID number provided to paid subscribers that gives access to all of Simplewire’s resources. The appropriate password must also be set.




回答2:


SimpleWire is now OpenMarket

You would need to setup an account with OpenMarket to use their SDK.

They offer two types of accounts:

  • Demo: which is where you could test your code on a short code that is for testing
  • Commercial: This is where you would pay for a Short Code and access to their platform/service


来源:https://stackoverflow.com/questions/4656996/how-do-i-send-sms-from-pc-to-mobile-using-simplewire-for-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!