I am developing an android application in which my application send some message which have some specific codes and these codes used to operate my device. And my device is not phone it's an another custom hardware device (Developed an another hardware which is used to control other hardware such as AC/Cooler etc).
Now problem is that whenever my application send any SMS this is shown in SMS default application (O.S 5.0 or greater). While in my phone O.S. 4.2 these sent SMS not shown. And that's what I want. These specific codes should not shown to any one.
I know this is some API change android have done in SDK but there is any solution to overcome from this problem.
only solution for this problem can be "Delete the sms from Sent folder/table of SMS database."
But on or after Android 4.0, Deletion from SMS database is not allowed by public apps. SMS deletion not allowed
Related
Question description
I'm working on a sms application, and I've found something strange in sending message test.
My test mobile phones are these: an oneplue5(Android 8.0), a Meizu mobile(I forgot the specific model, Android 4.4), a Huawei Honer(the same to Meizu, Android 7.1). After sending the message, oneplue5 has saved record successfully in its default sms application even if my application isn't the default app, Meizu mobile make the same performence, Huawei Honer dosen't save the message in smd db.
So I've tried set my application as default sms application, and Huawei Honer saved the message in the sms db. I can't make my app as default app because of this way vetoed by my leader, is there any way to send a message successfully in my app in Huawei mobile without being default sms app?
Is it possible to create/send SMS using voice commands in Android Auto? I'm not seeing anything about it in the docs at https://developer.android.com/training/auto/messaging/index.html
I have an HTC 10 and when the stock HTC "Messages" app is set as the default, I can tap the mic and say something like "Text Alice" or "Send a message to Bob" and it will then prompt me for the message, listen, and then send it. Similarly, if I set the Android Messages app (from Google) as my default SMS application, it works fine.
Lately I have been using Signal as my default messaging app. I cannot initiate a message via Signal. If I'm using Android Auto and I say "Text Bob" it will send an SMS, but it does NOT send a Signal message even though it's the default SMS app. Instead, it will send it through the HTC Messages app even though it's not the default.
Looking at their code, they have implemented the ANDROID_AUTO_HEARD and ANDROID_AUTO_REPLY intents as mentioned in the documentation. See lines 485-497 of https://github.com/WhisperSystems/Signal-Android/blob/master/AndroidManifest.xml and then the 2 Android Auto notification handlers at https://github.com/WhisperSystems/Signal-Android/tree/master/src/org/thoughtcrime/securesms/notifications
There doesn't seem to be any sort of ANDROID_AUTO_SEND intent or anything of that sort.
Is it possible to add an intent (to Signal) to make Android Auto send SMS through it instead of the other apps? I don't understand why it isn't using Signal when it's set as the default messaging app on my phone. The Android Messages app handles this properly. Is that just because Google put some special code into that app that third-party developers aren't allowed to use?
In accordance with the doc:
Note that—beginning with Android 4.4—any attempt by your app to abort
the SMS_RECEIVED_ACTION broadcast will be ignored so all apps
interested have the chance to receive it.
so, only default SMS app can do it and looks like nothing is changed with Android 5.0 (due to unknown reason, according issue is marked as Obsolete).
Is there any way to block incoming SMS for non-default SMS app if phone is rooted (this is is needed for spam-blocking app)? How to do it?
You could write a service that overrides CarrierMessagingService .
If the bind to this is successful , then the message is not delivered to the main app.
BIND_CARRIER_MESSAGING_SERVICE permission required to register as carrier messaging service requires the app to be system app. So you need to push your app to the system.
Make your app the default SMS provider. Then it can register for SMS_DELIVER_ACTION. In that receiver, you can choose to either write the SMS to the database or not. If you choose not to, the SMS is basically ignored. If you choose to, any other app can receive the SMS.
You can try the following solution:
Iterate through list of packages capable of handling SMS and disable them programmatically.
To get an API to disable an app you will have to become an MDM(Mobile Device Management) partner app.OEMs provides additional APIs to their MDM partner apps to control the device.For example samsung provides api to disable specific app.I guess they also have APIs to control permission of specific apps.
Alternatively I guess the new android Device/Profile Owner mode must have an API to disable specific apps.
As of android 4.3 the programatically sent sms is working fine, but 4.4.4 programatically sent sms is also copied to native inbox - how to handle this issue.
How to stop an sms from going to inbox or delete sms in android 4.4.4 and above
Starting with Android 4.4, any non-default SMS app using SmsManager to send messages will have them automatically written to the Provider by the system. There is really no way to prevent this, other than your app being the default SMS app. The default app is responsible for writing its own outgoing messages to the Provider, and it can opt not to do so. The case is the same for incoming SMS messages; if your app is not the default SMS app, it really doesn't have any control over whether an incoming message is written to the Provider. This link describes what is necessary for an app to be able to act as a default SMS app.
Getting Your SMS Apps Ready for KitKat
That said, I do have a workaround that allows a non-default app write access to the Provider, but only for Android 4.4; it does not work (yet) in Android 5.0 or above. With this, it would be possible to delete both incoming and outgoing messages, but only after they've been written.
I checked out the sample code for making your app the default sms client (found here), and the sample project works great on my Nexus 4 running 4.4. There is a button that when clicked, it does the following:
Intent intent = new Intent(Intents.ACTION_CHANGE_DEFAULT);
intent.putExtra(Intents.EXTRA_PACKAGE_NAME, context.getPackageName());
context.startActivity(intent);
and that makes the 'change sms app' dialog appear, that allows the user to switch their default sms application.
When I run the exact same project on my Nexus 7 (2012, Wifi), the button does nothing, although I can read in Logcat that the intent starts. The same thing happens with a Nexus 7 2013, wifi model I checked.
I tried downloading some sms app from the market and the exact same thing happens in all of them. They work great in my N4, no luck in my N7.
Anyone facing the same issue? Did they cut out the ability to write messages to devices that are unable to send texts as a whole?
Edit: Just noticed that the Telephony documentation writes:
Note: These APIs are not available on all Android-powered devices. If your app depends on telephony features such as for managing SMS messages, include a element in your manifest that declares the "android.hardware.telephony" hardware feature. Alternatively, you can check for telephony availability at runtime using either hasSystemFeature(PackageManager.FEATURE_TELEPHONY) or getPhoneType().
So, I'm guessing that if the device doesn't have the above feature it cannot 'manage SMS messages' (be the default SMS app).
It seems that sms no longer works on the Nexus 7 3G if you upgrade to Android 4.4.
In the past, some people have been able to use sms on their tablets by downloading and installing a third party sms app . Even though there is no stock messaging app with the ROM (and AFAIK, this is not an official feature), this has generally worked.
However, Android 4.4 KitKat on the Nexus 7 3G takes away this feature.
In Android 4.4, a messaging app must be set as the "default sms app" so it can be allowed to save new messages to the phone's message database. In other words, a messaging app must be the default sms app in order to operate fully.
In the Nexus 5 (and Android emulators), there is a setting Settings » ... » Wireless » Default sms app which allows you to choose your default sms app.
In the Nexus 7 3G, this setting DOES NOT EXIST.
It seems that the "default sms app" is not supported on the Nexus 7. In other words, you cannot set an app to be the default sms app. That means it is not possible to use an sms app.