User Tools

Site Tools


antispam_integration

This is an old revision of the document!


Integrating Antispam Apps with SDMM

Antispam apps are classifed as apps that block messages from the user's standard text messaging app. These apps simply block messages, and in some cases they respond to the sender according to the user's setup in the antispam app. Your app will not have permission to modify existing messages in the SMS database. If your app requires this feature either select a different Access Type or contact us for premium access details.

SDMM allows your app to abort messages prior to being processed by a full-featured messaging app. When you integrate and register with SDMM, SDMM will notify your app of any incoming messages prior to them being processed by the full-featured app.

To integrate with SDMM, do the following:

1. Download and import the SDK into your IDE. You will need to include the SDK as a library in your app's project.

2. Copy the sdmm_default_strings.xml file to your /res directory.

3. Change the following entries to match your app:

<string name="sdmm_app_version">1</string>
<string name="sdmm_app_name">Super Duper Messaging Manager SDK</string>
<string name="sdmm_app_id">sdmm_test_id</string>
<string name="sdmm_package_id">com.sdmmllc.superdupersmsmanager.sdk</string>

The sdmm_app_version is for your reference only when we are assisting with debugging online.

Enter your app's name for sdmm_app_name - this should match your Play Store name.

After your register your app with SDMM, you will receive the sdmm_app_id for this app. For testing you do not have to change it.

Enter your app's “package name” for sdmm_package_id. We use this to validate your app's access authority since many developers have lots of apps and Access Type may change over the life of the app.

4. Change the sdmm_access_type to 2:

<string name="sdmm_access_type">2</string>

5. To register your app with SDMM on the device, include this call in your Application class “onCreate” method (if you do not have one, you can easily create one for example):

public void onCreate() {
        SDSmsManager.initialize(this);
}

6. With each SMS, SDMM will send a duplicate SMS broadcast with a “DUPLICATE” extra. When your app recognizes an incoming SMS/MMS that should be blocked, check the SMS intent for the SDMM extra “DUPLICATE” so your app can signal SDMM that the message should be aborted. To block the message, check for the DUPLICATE extra and abort the broadcast like this:

String sdmmDup = "";
if (intent.hasExtra(SDSmsConsts.SDSMS_DUPLICATE)) sdmmDup = SDSmsConsts.SDSMS_DUPLICATE;
if (!SDSmsConsts.SDSMS_DUPLICATE.equals(sdmmDup)) {
      // your code here
      //
      //
      // if you want SDMM to abort the message, include the following two lines
      if (your_code_abort_this_message) {
            setResultCode(0);
            setResultData(SDSmsConsts.SDSMS_ABORT);
      }
} else {
      // like the example above, these codes tell SDMM to ignore the broadcast
      setResultCode(0);
      setResultData(SDSmsConsts.SDSMS_ABORT);
}

Setting the appropriate result code and result data will tell SDMM that the message should not propagate further. It will not be written to the SMS database.

7. Replace all SmsManager calls with SDSmsManager calls, like this:

SDSmsManager sms = SDSmsManager.getDefault();
try {
	sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI);
} catch (Exception e) {
	// error sending message, attempt to resend or ignore
}

9. If you use a SqliteWrapper, like many examples that are readily available, simply replace your import statement in those classes with the following:

import com.sdmmllc.superdupersmsmanager.database.sqlite.SqliteWrapper;

The included class does URI resolution normally except that the standard “sms” authority is replaced with the “sdsms” authority. When SDMM is the Default Messaging App, SDMM will handle the call. If another app is the Default Messaging App, it will resolve to the standard “sms” authority and your response message will be written to the SMS database.

antispam_integration.1403118441.txt.gz · Last modified: 2014/06/18 19:07 by superdupersms