User Tools

Site Tools


install

This is an old revision of the document!


A PCRE internal error occured. This might be caused by a faulty plugin

===== Installing Super Duper SMS Manager ===== 1. Download the [[SDK|SDK]] 2. In a strings file in /res, add your SDSMS_ID: <code><string name="SDSMS_ID">UNREGISTERED_APP</string> </code> If you have a registration ID, enter it here. Otherwise, this can be anything you want it to be (or leave it alone). Setting it to a unique value is recommended. 3. Determine the appropriate interface type for your app based on these values as indicated here: [[Access Types|Access Types]] 4. Replace SmsManager wtih SDSmsManager anywhere you use it in your project. If you set it globally in an Application class, that will work too. For example replace: <code java>SmsManager mSmsManager = SmsManager.getDefault(); </code> with this: <code java>SDSmsManager mSDSmsManager = SDSmsManager.getDefault(context, context.getString(R.string.SDSMS_ID), SDSmsManager.ACCESS_TYPE_MESSAGING); </code> 5. Replace all SmsManager calls with mSDSmsManager, like this: <code java> SDSmsManager sms = SDSmsManager.getDefault(context, context.getString(R.string.SDSMS_ID), SDSmsManager.ACCESS_TYPE_MESSAGING); try { sms.sendTextMessage(phoneNumber, null, message, sentPI, deliveredPI); } catch (Exception e) { // error sending message, notify user and update database sendError(msgId, phoneNumber); } </code> 6. If you use a SqliteWrapper like many examples provide, simply replace you import statement in those classes with the following: <code java>import com.sirisdevelopment.superdupersmsmanager.database.sqlite.SqliteWrapper; </code> The included class does URI resolution normally except that the standard "sms" authority is replaced with the "sdsms" authority when SDSMS is the Default Messaging App. Also included in the SDSMS SqliteWrapper is the SDContentResolver class. This class simply checks to see if you URI should be converted to SDSMS Uri's prior to being resolved. This can be used to Replace the standard ContentResolver class and will resolve "sms" related authorities appropriately. For example, if this is your code: <code java>ContentResolver contentResolver = getContentResolver(); final String[] projection = new String[] { "retr_st", "date", "_id", "ct_t" }; Uri uri = Uri.parse("content://mms-sms/conversations"); Cursor cursor = contentResolver.query(uri, projection, null, null, "_id DESC"); </code> can be written as this, and the "sms" authority will resolve to "sdsms" when necessary: <code java>SDContentResolver sdContentResolver = new SDContentResolver(context); final String[] projection = new String[] { "retr_st", "date", "_id", "ct_t" }; Uri uri = Uri.parse("content://mms-sms/conversations"); Cursor cursor = sdContentResolver.query(uri, projection, null, null,"_id DESC"); </code> This is a convenience method only. We do not require that you use SDContentResolver. Also, this class will make the appropriate calls to SDSMS to acknowledge your proper integration. 7. In some cases, you may reference Uri's from Telephony or even statically. All MmsSms Uri's need to be determined via methods that are provided. For example to get the Sms.Inbox Uri replace the following: <code java>Sms.Inbox.CONTENT_URI </code> with this code (and import SDSmsManager into any classes that do not already have it): <code java>SDSmsManager.Sms.Inbox.CONTENT_URI() </code> As a side note, if you create or make static references to these Uri's, this **will not work** because the methods will only execute as the app is instantiated. If the user changes the default SMS app, then your app may not behave properly. These **must** be runtime references. These are static methods, so your compiler will not complain but it will most likely result in problems. 8. Implement the SDSMS callback for received messages. This allows you to tell SDSMS if your app attempted to abort the incoming SMS. Here is an example: <code java> private ISDSmsReceiveCallback.Stub mCallback = new ISDSmsReceiveCallback.Stub() { @Override public boolean onReceive(Intent intent) throws RemoteException { // // do stuff here to process the SMS message // in this example, we are trying to demonstrate that you could re-use // existing code but return the appropriate result for "abort" // // true - abort broadcast // // false - your app did not abort the broadcast // SmsIntentReceiver receiver = new SmsIntentReceiver(); return receiver.onReceive(intent); } }; </code> In this example, the intent is processed and will be passed back to SDSMS unless the callback returns a value of "true" - indicating that your app aborted the SMS broadcast.

install.1393302670.txt.gz · Last modified: 2014/02/25 04:31 by superdupersms