I wrote sms application to receive/send sms for Galaxy s5 (Kitkat 4.4.2). Everything works fine but my application writes to the SMS Provider, so may app must be the default SMS app. I added required permission according to - http://android-developers.blogspot.com/2013/10/getting-your-sms-apps-ready-for-kitkat.html. But I don't want to read/send mms message. Is it possible to receive mms by native sms/mms app (no default) and receive/send sms by my app (default)? I know that to send mms native app must be set up as default but I just thinking about receiving. Now my app is default and I have empty mms reciver and when user receive mms it get lost.
Hmmmm.... maybe can I save mms to the SMS Provider from my app in onReceive()
method and next launch native (no default) sms/mms app to display them? Is it good idea? How can I do that?
MmsReceiver
public class MmsReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
}
}
Manifest.xml
<receiver
android:name="com.mateusz.simplesmsapp.broadcasts.MmsReceiver"
android:exported="true"
android:permission="android.permission.BROADCAST_WAP_PUSH" >
<intent-filter>
<action android:name="android.provider.Telephony.WAP_PUSH_DELIVER" />
<action android:name="android.provider.Telephony.WAP_PUSH_RECEIVE" />
<data android:mimeType="application/vnd.wap.mms-message" />
</intent-filter>
</receiver>
maybe can I save mms to the SMS Provider from my app in onReceive() method and next launch native (no default) sms/mms app to display them?
This, I would imagine, is possible, but I don't think it's going to work out well in the end. To do this, your app, upon first startup, would need to get the already-set default app using Telephony.Sms.getDefaultSmsPackage()
, and store this package name in order to launch it after your app's writes upon MMS receipt. This part I see no problem with.
The catch comes when the now-demoted app tries to send an MMS. Quoting the blog you've linked:
Although the system writes sent SMS messages to the SMS Provider while your app is not the default SMS app, it does not write sent MMS messages
Now, this might be acceptable, if your app could do the outgoing writes as well. The first problem I see is that, as far as I know, there is no system-wide broadcast when an MMS is sent, so your app wouldn't know it's happening, let alone have access to data not explicitly handed to it. Secondly, again quoting:
while your app is not selected as the default, it's important that you understand the limitations placed upon your app and disable features as appropriate
Assuming the platform app follows these prescribed practices, when it is no longer the default, it may very well disable its outgoing MMS functions. But, even if it doesn't, and it reverts from its direct sends to passing the request and data through an Intent to the default app, well, at this point you're handling both incoming and outgoing MMS, thus defeating the whole point of your workaround.
In the end, it's probably just easier to go ahead and make your app totally compliant.