相关疑难解决方法(0)

如何在我的Android应用程序中使用Twilio发送短信?

在我的Android应用程序中,我创建了一个按钮,当我按下按钮时我想发送消息.所以我创建了一个java类并编写了twilio代码.

final TwilioRestClient client = new TwilioRestClient(
                        ACCOUNT_SID, AUTH_TOKEN);

                // Get the main account (The one we used to authenticate the
                // client)
                final Account mainAccount = client.getAccount();

                final SmsFactory messageFactory = mainAccount.getSmsFactory();
                final Map<String, String> messageParams = new HashMap<String, String>();
                messageParams.put("To", "+912342423423");
                messageParams.put("From", "+132432432434");
                messageParams.put("Body", "This is my message");
                try {
                    messageFactory.create(messageParams);
                } catch (TwilioRestException e) {
                    e.printStackTrace();
                }
Run Code Online (Sandbox Code Playgroud)

当我使用上面的代码时,它显示出一些错误 java.lang.NoSuchMethodError: org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager

我在lib文件夹中只添加了一个jar文件 " twilio-java-sdk-3.3.10-jar-with-dependencies.jar ".

请告诉我我该怎么办?

sms android twilio

10
推荐指数
3
解决办法
6169
查看次数

标签 统计

android ×1

sms ×1

twilio ×1