mirror of
https://github.com/cwinfo/envayasms.git
synced 2024-12-04 20:45:32 +00:00
use kalsms version code in http requests
This commit is contained in:
parent
4b0010ffda
commit
687400f91a
@ -8,6 +8,8 @@ import android.content.BroadcastReceiver;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.content.pm.PackageInfo;
|
||||||
|
import android.content.pm.PackageManager.NameNotFoundException;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.SystemClock;
|
import android.os.SystemClock;
|
||||||
@ -23,7 +25,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import org.apache.http.client.HttpClient;
|
import org.apache.http.client.HttpClient;
|
||||||
import org.apache.http.conn.params.ConnManagerParams;
|
|
||||||
import org.apache.http.conn.scheme.PlainSocketFactory;
|
import org.apache.http.conn.scheme.PlainSocketFactory;
|
||||||
import org.apache.http.conn.scheme.Scheme;
|
import org.apache.http.conn.scheme.Scheme;
|
||||||
import org.apache.http.conn.scheme.SchemeRegistry;
|
import org.apache.http.conn.scheme.SchemeRegistry;
|
||||||
@ -96,6 +97,8 @@ public final class App extends Application {
|
|||||||
private SpannableStringBuilder displayedLog = new SpannableStringBuilder();
|
private SpannableStringBuilder displayedLog = new SpannableStringBuilder();
|
||||||
private long lastLogTime;
|
private long lastLogTime;
|
||||||
|
|
||||||
|
private PackageInfo packageInfo;
|
||||||
|
|
||||||
// list of package names (e.g. org.envaya.kalsms, or org.envaya.kalsms.packXX)
|
// list of package names (e.g. org.envaya.kalsms, or org.envaya.kalsms.packXX)
|
||||||
// for this package and all expansion packs
|
// for this package and all expansion packs
|
||||||
private List<String> outgoingMessagePackages = new ArrayList<String>();
|
private List<String> outgoingMessagePackages = new ArrayList<String>();
|
||||||
@ -119,6 +122,17 @@ public final class App extends Application {
|
|||||||
|
|
||||||
outgoingMessagePackages.add(getPackageName());
|
outgoingMessagePackages.add(getPackageName());
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
|
||||||
|
}
|
||||||
|
catch (NameNotFoundException ex)
|
||||||
|
{
|
||||||
|
// should not happen
|
||||||
|
logError("Error finding package info", ex);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
updateExpansionPacks();
|
updateExpansionPacks();
|
||||||
|
|
||||||
log(Html.fromHtml(
|
log(Html.fromHtml(
|
||||||
@ -136,7 +150,7 @@ public final class App extends Application {
|
|||||||
{
|
{
|
||||||
log(" " + sender);
|
log(" " + sender);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mmsObserver = new MmsObserver(this);
|
mmsObserver = new MmsObserver(this);
|
||||||
mmsObserver.register();
|
mmsObserver.register();
|
||||||
@ -150,6 +164,12 @@ public final class App extends Application {
|
|||||||
startService(new Intent(this, ForegroundService.class));
|
startService(new Intent(this, ForegroundService.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PackageInfo getPackageInfo()
|
||||||
|
{
|
||||||
|
return packageInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public synchronized String chooseOutgoingSmsPackage()
|
public synchronized String chooseOutgoingSmsPackage()
|
||||||
{
|
{
|
||||||
outgoingMessageCount++;
|
outgoingMessageCount++;
|
||||||
|
@ -53,7 +53,7 @@ public class HttpTask extends AsyncTask<String, Void, HttpResponse> {
|
|||||||
this.app = app;
|
this.app = app;
|
||||||
this.url = app.getServerUrl();
|
this.url = app.getServerUrl();
|
||||||
params = new ArrayList<BasicNameValuePair>(Arrays.asList(paramsArr));
|
params = new ArrayList<BasicNameValuePair>(Arrays.asList(paramsArr));
|
||||||
params.add(new BasicNameValuePair("version", "2"));
|
params.add(new BasicNameValuePair("version", "" + app.getPackageInfo().versionCode));
|
||||||
params.add(new BasicNameValuePair("phone_number", app.getPhoneNumber()));
|
params.add(new BasicNameValuePair("phone_number", app.getPhoneNumber()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
package org.envaya.kalsms.ui;
|
package org.envaya.kalsms.ui;
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.pm.PackageManager.NameNotFoundException;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.text.Html;
|
import android.text.Html;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
import org.envaya.kalsms.App;
|
||||||
import org.envaya.kalsms.R;
|
import org.envaya.kalsms.R;
|
||||||
|
|
||||||
public class Help extends Activity {
|
public class Help extends Activity {
|
||||||
@ -16,19 +16,10 @@ public class Help extends Activity {
|
|||||||
setContentView(R.layout.help);
|
setContentView(R.layout.help);
|
||||||
|
|
||||||
TextView help = (TextView) this.findViewById(R.id.help);
|
TextView help = (TextView) this.findViewById(R.id.help);
|
||||||
|
|
||||||
String version;
|
App app = (App)getApplication();
|
||||||
|
|
||||||
try
|
String html = "<b>KalSMS " + app.getPackageInfo().versionName + "</b><br /><br />"
|
||||||
{
|
|
||||||
version = this.getPackageManager().getPackageInfo(this.getPackageName(), 0).versionName;
|
|
||||||
}
|
|
||||||
catch (NameNotFoundException ex)
|
|
||||||
{
|
|
||||||
version = "(Unknown version)";
|
|
||||||
}
|
|
||||||
|
|
||||||
String html = "<b>KalSMS " + version + "</b><br /><br />"
|
|
||||||
+ "KalSMS is a SMS gateway.<br /><br /> "
|
+ "KalSMS is a SMS gateway.<br /><br /> "
|
||||||
+ "It forwards all incoming SMS messages received by this phone to a server on the internet, "
|
+ "It forwards all incoming SMS messages received by this phone to a server on the internet, "
|
||||||
+ "and also sends outgoing SMS messages from that server to other phones.<br /><br />"
|
+ "and also sends outgoing SMS messages from that server to other phones.<br /><br />"
|
||||||
|
Loading…
Reference in New Issue
Block a user