5
0
mirror of https://github.com/cwinfo/envayasms.git synced 2024-12-04 20:45:32 +00:00

fix encoding problem for post requests, make test a separate action

This commit is contained in:
Jesse Young 2011-09-27 11:20:10 -07:00
parent 986b50f0a8
commit bf14f23fe5
6 changed files with 12 additions and 4 deletions

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.envaya.sms"
android:versionCode="8"
android:versionName="2.0-beta6">
android:versionCode="9"
android:versionName="2.0-beta7">
<uses-sdk android:minSdkVersion="4" />

View File

@ -47,6 +47,7 @@ public final class App extends Application {
public static final String ACTION_OUTGOING = "outgoing";
public static final String ACTION_INCOMING = "incoming";
public static final String ACTION_SEND_STATUS = "send_status";
public static final String ACTION_TEST = "test";
public static final String STATUS_QUEUED = "queued";
public static final String STATUS_FAILED = "failed";

View File

@ -65,6 +65,7 @@ public class IncomingSms extends IncomingMessage {
}
public void tryForwardToServer() {
new ForwarderTask(this,
new BasicNameValuePair("from", getFrom()),
new BasicNameValuePair("message_type", App.MESSAGE_TYPE_SMS),

View File

@ -90,6 +90,12 @@ public class OutgoingMessage extends QueuedMessage {
SmsManager smgr = SmsManager.getDefault();
ArrayList<String> bodyParts = smgr.divideMessage(getMessageBody());
int numParts = bodyParts.size();
if (numParts > 1)
{
app.log("(Multipart message with "+numParts+" parts)");
}
String packageName = app.chooseOutgoingSmsPackage(bodyParts.size());
if (packageName == null)

View File

@ -125,7 +125,7 @@ public class HttpTask extends AsyncTask<String, Void, HttpResponse> {
}
else
{
post.setEntity(new UrlEncodedFormEntity(params));
post.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
}
HttpClient client = app.getHttpClient();

View File

@ -37,7 +37,7 @@ public class Main extends Activity {
private class TestTask extends HttpTask
{
public TestTask() {
super(Main.this.app, new BasicNameValuePair("action", App.ACTION_OUTGOING));
super(Main.this.app, new BasicNameValuePair("action", App.ACTION_TEST));
}
@Override