Permalink
Browse files

Fixed issue with sms forwarding to ushahid deployment

  • Loading branch information...
1 parent f453b56 commit 1d6884c4a335b709691e48c2d642afd469da9eb3 @eyedol eyedol committed Jan 26, 2011
View
@@ -19,8 +19,8 @@
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.ushahidi.android.app"
- android:versionCode="4"
- android:versionName="0.9.4">
+ android:versionCode="5"
+ android:versionName="0.9.5">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
View
@@ -146,7 +146,7 @@
Settings.</string>
<string name="loc_not_found">Your location could not be determined. Make sure you have
pin point the exact location on the map.</string>
- <string name="version">0.9.4</string>
+ <string name="version">0.9.5</string>
<string name="report_title">Title</string>
<string name="report_verified">Verified</string>
<string name="report_unverified">Unverified</string>
@@ -43,6 +43,7 @@
import android.os.Process;
import android.provider.Settings;
import android.telephony.SmsMessage;
+import android.util.Log;
public class SmsReceiverService extends Service {
@@ -53,15 +54,18 @@
private String fromAddress = "";
private String messageBody = "";
private static final Object mStartingServiceSync = new Object();
+ private static final String TAG = "Ushahidi";
private static PowerManager.WakeLock mStartingService;
private HashMap<String,String> params = new HashMap<String, String>();
+ private Context mContext;
@Override
public void onCreate() {
- HandlerThread thread = new HandlerThread("Message sending starts", Process.THREAD_PRIORITY_BACKGROUND);
+ HandlerThread thread = new HandlerThread(TAG, Process.THREAD_PRIORITY_BACKGROUND);
thread.start();
- getApplicationContext();
+ mContext = getApplicationContext();
+ UshahidiService.loadSettings(mContext);
mServiceLooper = thread.getLooper();
mServiceHandler = new ServiceHandler(mServiceLooper);
}
@@ -113,8 +117,9 @@ public void handleMessage(Message msg) {
*/
private void handleSmsReceived(Intent intent) {
- //TODO send the message to ushahidi via the api
Bundle bundle = intent.getExtras();
+ UshahidiService.loadSettings(mContext);
+
if (bundle != null) {
SmsMessage[] messages = getMessagesFromIntent(intent);
SmsMessage sms = messages[0];
@@ -150,8 +155,9 @@ private void handleSmsReceived(Intent intent) {
private boolean postToUshahidi() {
-
+ UshahidiService.loadSettings(mContext);
StringBuilder urlBuilder = new StringBuilder(UshahidiService.domain);
+
urlBuilder.append("/api");
params.put("task","sms");
params.put("username", UshahidiService.username);
@@ -121,7 +121,7 @@ public void onCreate() {
super.onCreate();
queue = new QueueThread("ushahidi");
mHandler = new Handler();
-
+ loadSettings(UshahidiService.this);
if(AutoFetch){
Log.i("Service ","Service is checked to start.");
mNotificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

0 comments on commit 1d6884c

Please sign in to comment.