Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit c44c865
Showing
13 changed files
with
491 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="kalsms.niryariv.itp" | ||
android:versionCode="1" | ||
android:versionName="1.0"> | ||
|
||
<uses-permission android:name="android.permission.RECEIVE_SMS" /> | ||
<uses-permission android:name="android.permission.SEND_SMS" /> | ||
<uses-permission android:name="android.permission.READ_SMS" /> | ||
<uses-permission android:name="android.permission.WRITE_SMS" /> | ||
<uses-permission android:name="android.permission.INTERNET" /> | ||
|
||
<application android:icon="@drawable/icon" android:label="@string/app_name"> | ||
<activity android:name=".Main" android:label="@string/app_name"> | ||
<intent-filter> | ||
<action android:name="android.intent.action.MAIN" /> | ||
<category android:name="android.intent.category.LAUNCHER" /> | ||
</intent-filter> | ||
</activity> | ||
|
||
<receiver android:name=".SMSReceiver"> | ||
<intent-filter> | ||
<action android:name="android.provider.Telephony.SMS_RECEIVED" /> | ||
</intent-filter> | ||
</receiver> | ||
|
||
<activity android:name=".Prefs" | ||
android:label="@string/app_name"> | ||
</activity> | ||
|
||
</application> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
KalSMS is an simple Android SMS gateway application. | ||
|
||
Info & setup here: http://wiki.github.com/niryariv/kalsms/ | ||
|
||
Please contact niryariv@gmail.com with any questions or feedback. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# This file is automatically generated by Android Tools. | ||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED! | ||
# | ||
# This file must be checked in Version Control Systems. | ||
# | ||
# To customize properties used by the Ant build system use, | ||
# "build.properties", and override values to adapt the script to your | ||
# project structure. | ||
|
||
# Project target. | ||
target=android-4 | ||
# Indicates whether an apk should be generated for each density. | ||
split.density=false |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:orientation="vertical" | ||
android:layout_width="fill_parent" | ||
android:layout_height="fill_parent" android:background="#333333"> | ||
<TextView | ||
android:layout_width="fill_parent" | ||
android:layout_height="wrap_content" | ||
android:text="@string/hello" | ||
android:textColor="#FFFFFF" android:textSize="30px" android:layout_margin="2px"/> | ||
<TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/info" android:textColor="#FFFFFF" android:layout_margin="5px"></TextView> | ||
<!--<Button android:layout_width="fill_parent" android:layout_height="wrap_content" android:gravity="center" android:id="@+id/settingsButton" android:text="Edit Settings" android:layout_marginRight="50px" android:layout_marginLeft="50px"></Button>--> | ||
</LinearLayout> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<string name="hello">SMS Gateway Running.\n</string> | ||
<string name="app_name">KalSMS</string> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<PreferenceScreen | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<EditTextPreference android:key="pref_target_url" android:title="Target URL" android:defaultValue="http://qkhack.appspot.com/kalsms_demo" android:summary="URL to load when the SMS is received"></EditTextPreference> | ||
<EditTextPreference android:key="pref_identifier" android:title="SMS Identifier" android:defaultValue="kal " android:summary="Handle only SMS messages starting with this string (leave empty to handle all messages)"></EditTextPreference> | ||
</PreferenceScreen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package kalsms.niryariv.itp; | ||
|
||
import kalsms.niryariv.itp.R; | ||
import android.app.Activity; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
import android.preference.PreferenceActivity; | ||
import android.preference.Preference; | ||
import android.os.Bundle; | ||
import android.preference.PreferenceManager; | ||
import android.text.Html; | ||
import android.util.Log; | ||
import android.view.Menu; | ||
import android.widget.TextView; | ||
|
||
public class Main extends Activity { | ||
|
||
// public static final String PREFS_NAME = "KalPrefsFile"; | ||
|
||
public String identifier = ""; | ||
public String targetUrl = ""; | ||
|
||
|
||
public void onResume() { | ||
Log.d("KALSMS", "RESUME"); | ||
super.onResume(); | ||
|
||
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences(this); | ||
|
||
this.identifier = settings.getString("pref_identifier", ""); | ||
this.targetUrl = settings.getString("pref_target_url", ""); | ||
|
||
Log.d("KALSMS", "onResume ident:" + this.identifier +"\ntarget:" + this.targetUrl); | ||
|
||
String infoText = new String(); | ||
|
||
infoText = "All SMS messages"; | ||
|
||
if (this.identifier.trim() != "") { | ||
infoText += " starting with <b>" + this.identifier + "</b>"; | ||
} | ||
|
||
infoText += " are now sent to <b>" + this.targetUrl +"</b> in the following format:"; | ||
infoText += "<p><tt>GET " + this.targetUrl + "?sender=<phone#>&msg=<message></tt></p>"; | ||
infoText += "If the response body contains text, it will SMSed back to the sender."; | ||
|
||
infoText += "<br /><br /><b>Press Menu to set SMS identifier or target URL.</b>"; | ||
|
||
infoText += "<br /><br /><br />Questions/feedback: niryariv@gmail.com"; | ||
|
||
TextView info = (TextView) this.findViewById(R.id.info); | ||
info.setText(Html.fromHtml(infoText)); | ||
|
||
} | ||
|
||
/** Called when the activity is first created. */ | ||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
setContentView(R.layout.main); | ||
PreferenceManager.setDefaultValues(this, R.xml.prefs, false); | ||
|
||
Log.d("KALSMS", "STARTED"); | ||
} | ||
|
||
|
||
// first time the Menu key is pressed | ||
public boolean onCreateOptionsMenu(Menu menu) { | ||
startActivity(new Intent(this, Prefs.class)); | ||
return(true); | ||
} | ||
|
||
// any other time the Menu key is pressed | ||
public boolean onPrepareOptionsMenu(Menu menu) { | ||
startActivity(new Intent(this, Prefs.class)); | ||
return(true); | ||
} | ||
|
||
|
||
@Override | ||
protected void onStop(){ | ||
// dont do much with this, atm.. | ||
super.onStop(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package kalsms.niryariv.itp; | ||
|
||
import kalsms.niryariv.itp.R; | ||
import android.content.SharedPreferences; | ||
import android.os.Bundle; | ||
import android.preference.EditTextPreference; | ||
import android.preference.Preference; | ||
import android.preference.PreferenceActivity; | ||
import android.util.Log; | ||
|
||
|
||
public class Prefs extends PreferenceActivity { | ||
|
||
@Override | ||
public void onCreate(Bundle savedInstanceState) { | ||
super.onCreate(savedInstanceState); | ||
|
||
addPreferencesFromResource(R.xml.prefs); | ||
} | ||
|
||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { | ||
Preference pref = findPreference(key); | ||
|
||
if (pref instanceof EditTextPreference) { | ||
EditTextPreference textPref = (EditTextPreference) pref; | ||
pref.setSummary(textPref.getSummary()); | ||
Log.d("KALSMS", "textPref.getSummary(): " + textPref.getSummary()); | ||
} | ||
} | ||
} | ||
|
Oops, something went wrong.