Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions .classpath
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="build/.apt_generated"/>
<classpathentry kind="src" path="android/src"/>
<classpathentry kind="src" path="android/build/.apt_generated"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="/Users/olivier/android-sdk-macosx/platforms/android-8/android.jar"/>
<classpathentry kind="lib" path="/Library/Application Support/Titanium/mobilesdk/osx/1.8.2/android/titanium.jar"/>
<classpathentry kind="lib" path="/Library/Application Support/Titanium/mobilesdk/osx/1.8.2/android/js.jar"/>
<classpathentry kind="lib" path="/Users/InGrowth/Library/Android/sdk/platforms/android-23/android.jar"/>
<classpathentry kind="lib" path="/Users/InGrowth/Library/Application Support/Titanium/mobilesdk/osx/6.0.0.GA/android/titanium.jar"/>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="/Users/InGrowth/Library/Application Support/Titanium/mobilesdk/osx/6.0.0.GA/android/kroll-common.jar"/>
<classpathentry kind="lib" path="/Users/InGrowth/Library/Application Support/Titanium/mobilesdk/osx/6.0.0.GA/android/kroll-apt.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
12 changes: 12 additions & 0 deletions .project
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,20 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.appcelerator.titanium.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>com.aptana.ide.core.unifiedBuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>com.appcelerator.titanium.mobile.module.nature</nature>
<nature>com.aptana.projects.webnature</nature>
</natures>
</projectDescription>
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ In order to access the module from JavaScript, you should do the following:
alert('Message sending result: ' + result);
} );

In version 1.0.1 a message can fire more than one "complete" event. If you rely on the this event in your code, please note this change. More information in the Change Log below.

### Sending a message

Sending a message is as simple as:
Expand All @@ -80,6 +82,13 @@ Sending a message is as simple as:

The result of the operation can be tracked through the `complete` event previously registered.

### Change Log
1.0.1 Added support for messages with over 140 characters, in which case the message will be sent using multiple SMSs, depending on the length of the message. Those messages will appear as one SMS on modern phones (all smart phones) regardless.
This applies also to some message of 140 characters and less which include characters in non-Latin script (e.g. Russian, Hebrew, Arabic), which, due to character encoding may actually contain more than 140 characters in the SMS itself.
For example, a message using Latin script which consists of 150 characters will be sent using two SMSs. A message which consists of 140 characters, but which has one or more characters in non-Latin script will also be sent using two SMSs.

Due to this change, a message sent using this version will fire the complete event once for every SMS sent. Please take that into consideration if your application relies on this event to run a function, since this code may now run more than once.

## License

Copyright (c) 2011 Olivier Morandi
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions android/build.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
titanium.platform=/Users/InGrowth/Library/Application Support/Titanium/mobilesdk/osx/6.0.0.GA/android
android.platform=/Users/InGrowth/Library/android-sdk-macosx/platforms/android-23
google.apis=/Users/InGrowth/Library/android-sdk-macosx/add-ons/addon-google_apis-google-23
android.ndk=/Users/InGrowth/Library/android-sdk-macosx/ndk-bundle
28 changes: 28 additions & 0 deletions android/build.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<project name="sms" default="dist">
<description>
Ant build script for Titanium Android module sms
</description>

<property name="ti.module.root" location="${basedir}"/>
<property file="build.properties" />

<!-- Make sure 'architectures' is in manifest file -->
<property file="${ti.module.root}/manifest" prefix="manifest"/>
<fail message="Missing required manifest key 'architectures'.">
<condition>
<not>
<isset property="manifest.architectures"/>
</not>
</condition>
</fail>

<fail message="Manifest key 'architectures' has no value.">
<condition>
<not>
<length string="${manifest.architectures}" trim="true" when="greater" length="0"/>
</not>
</condition>
</fail>

<import file="${titanium.platform}/../module/android/build.xml"/>
</project>
Binary file added android/dist/sms.jar
Binary file not shown.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions android/java-sources.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
"/Users/InGrowth/Documents/Projects/Ti-Android-SMS/android/build/generated/java/ti/android/sms/SmsBootstrap.java"
"/Users/InGrowth/Documents/Projects/Ti-Android-SMS/android/src/ti/android/sms/SmsModule.java"
File renamed without changes.
7 changes: 4 additions & 3 deletions manifest → android/manifest
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@
# this is your module manifest and used by Titanium
# during compilation, packaging, distribution, etc.
#
version: 1.0.0
apiversion: 2
version: 1.1.2
apiversion: 3
architectures: armeabi-v7a x86
description: Sms module for Titanium Android
author: Olivier Morandi
license: MIT
Expand All @@ -15,4 +16,4 @@ name: sms
moduleid: ti.android.sms
guid: d86a1f51-1abf-4392-b453-a99a20392890
platform: android
minsdk: 3.0.0.GA
minsdk: 6.0.0.GA
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
import org.appcelerator.kroll.common.Log;
import org.appcelerator.kroll.common.TiConfig;


import android.app.Activity;
import android.app.PendingIntent;
import android.content.BroadcastReceiver;
Expand All @@ -25,6 +24,8 @@
import android.content.IntentFilter;
import android.telephony.SmsManager;

import java.util.ArrayList;

@Kroll.module(name="Sms", id="ti.android.sms")
public class SmsModule extends KrollModule
{
Expand Down Expand Up @@ -133,7 +134,6 @@ public KrollDict createEventObject (boolean success, int result, String resultMe
@Kroll.method
public void sendSMS(String recipient, String messageBody)
{

Activity currentActivity = this.getActivity();

Intent sentIntent = new Intent(MESSAGE_SENT);
Expand All @@ -145,10 +145,21 @@ public void sendSMS(String recipient, String messageBody)
PendingIntent deliveredPI = PendingIntent.getBroadcast(currentActivity, 0,
deliveredIntent, 0);

ArrayList<PendingIntent> sentIntents = new ArrayList<PendingIntent>();

ArrayList<PendingIntent> deliveryIntents = new ArrayList<PendingIntent>();

SmsManager sms = SmsManager.getDefault();

sms.sendTextMessage(recipient, null, messageBody, sentPI, deliveredPI);
ArrayList<String> parts = sms.divideMessage(messageBody);

for (int i = 0; i < parts.size(); i++) {
sentIntents.add(i, sentPI);

deliveryIntents.add(i, deliveredPI);
}

sms.sendMultipartTextMessage(recipient, null, parts, sentIntents, deliveryIntents);
}


Expand Down
File renamed without changes.
3 changes: 0 additions & 3 deletions build.properties

This file was deleted.

10 changes: 0 additions & 10 deletions build.xml

This file was deleted.

Binary file removed dist/sms.jar
Binary file not shown.
Binary file removed dist/ti.android.sms-android-1.0.0.zip
Binary file not shown.
Binary file added dist/ti.android.sms-android-1.0.2.zip
Binary file not shown.
Binary file added dist/ti.android.sms-android-1.1.2.zip
Binary file not shown.