I am trying to develop an app which logs all sent SMS along with UID or package name of the application which triggered that event. I am doing this for a research purpose.Thanks in advance ...
I am looking to log the UID or package name of application which send that sms.
Sorry for my english if it is disgusting.
After a series of researches, I found that package name of application which triggered the SMS is explicitly stored in creator field(index 19) of SMS DB.
Related
I try to develop anti-smishing solution, which listen in background and analyze new SMS.
If I'm not default SMS app, I can only read the SMS.
I found information about some exceptions in use of SMS permission group for Anti-Phishing, where I have access not only to read, but also to write.
How does it work? For now I'm not able to write or edit any SMS in Android Studio. When Google accepts my request/form I will have some extra code for exception or something like it?
https://support.google.com/googleplay/android-developer/answer/10208820?hl=en&ref_topic=2364761#zippy=%2Cwyj%C4%85tki
So I have a verification code that comes through from sms and user has exit app to go copy it into an EditText.
I found out the Android Pay has a method to scan the incoming verification text from your bank and autofill the text with a verification code.
I'd like to replicate this for my own app but I'm not 100% sure how I do this as I'm struggling to search for what I need. What I've found so far is it could be done via a ContentResolver but that might not be the best solution as it could be different on different Android flavours.
You want a broadcast receiver for SMS, which reads an incoming SMS, checks if the number is right and if the format of the SMS is right, and parses the number from it.
Actually if you can do that there's no need to autofill- just send the request to the correct API for verification directly, so they don't even have to press send.
Android has this built in since play services 10.2.x.
It works only if you include an app specific hash in the SMS message body, which android uses to determine which app to alert that a new message just came in.
When an SMS message with that exact hash is received, android will fire up a broadcastreceiver that youregister in the manifest with a special intent filter:
<receiver android:name=".MySMSBroadcastReceiver" android:exported="true">
<intent-filter>
<action android:name="com.google.android.gms.auth.api.phone.SMS_RETRIEVED"/>
</intent-filter>
</receiver>
How it works in more detail and what code is required etc, you can check here on the developer's blog or here in the official guides.
Note that this won't work if you don't have access to the system that sends out the SMS, meaning you can't add the hash to the message.
I would like to know an uid from application's own pamameter.
I know how to get an uid from PackageManager with package name, however I have noticed that an application can send a fake package name or context which is created with fake package name. How can I create an API to determine exactly an uid from any app's own parameter? Or how to check this app is system app?
Sounds like you want to get the current app id. This should do the trick. Get the result of http://developer.android.com/reference/android/os/Process.html#myUid() and give it to http://developer.android.com/reference/android/content/pm/PackageManager.html#getPackagesForUid(int)
Is there any way to get device Id using MIT App inventor?
I am using Activity starter from other stuff and setting properties like this:
Action: android.intent.action.ACTION_MAIN
Activity Class: TelephonyManager
Activity Package: android.telephony
Is this the correct process for getting the device id?
as Gary already mentioned, this is currently not possible with AI
EDIT: However, you can identify a user with OAuth, see an example here http://puravidaapps.com/taifunOA.php. The user can authorize the app to get his email address for identification.
UPDATE: now with the new Extension feature, you can use an extension to get this information, see also my answer here.
I'm working on an SMS Application for Android, which undoubtedly needs to send SMSes (go figure! ;)
Now, i know there are a plenty of sources on the net that describe using the SmsManager to send SMSes...But, apparently, when using that method, the SMSes aren't stored in the "SENT" Folder...which is kind of a basic requirement for an SMS application.
How do i add an entry (of a message) into the "Outbox", so that it gets sent (and stored in the SENT Folder Automatically)....
What would be the Values of the fields "_id,threadid,read,status,type,service_center" (Attributes of the message table)??
Any other alternatives are also welcome. :)
Thanks in Advance...
I had been looking for a work around this issue. Add the following lines of code after sending the sms... this will make an entry in the outbox of native sms application
ContentValues values = new ContentValues();
values.put("address", number);
values.put("body", desc);
getApplicationContext().getContentResolver().insert(Uri.parse("content://sms/sent"), values);
i would like to get help from ppl who could tell how to use this content provider to make entry for multiple receivers... Thanks..
But, apparently, when using that
method, the SMSes aren't stored in the
"SENT" Folder...which is kind of a
basic requirement for an SMS
application.
The concept of a "SENT" folder is a feature of an application, not the operating system. If you wish to create your own SMS client application, create your own "SENT" folder as a feature of that application. You know what messages you are sending, so you can store them wherever you like (e.g., SQLite database).
If you want to send SMS messages and have them appear in the "SENT" folder of the user's chosen SMS client, don't use SmsManager. Instead, use ACTION_SENDTO and have the message be sent by the user's chosen SMS client, as is demonstrated by this sample project.
At least on 6.0 and 7.0 the system app com.android.phone is responsible for storing the messages sent by other apps. Unfortunately, this functionality is broken by some manufacturers and this is why we don't see sent messages.
It does work on AVD though. See the method persistSentMessageIfRequired() in com.android.internal.telephony.SMSDispatcher.
Only this app or the selected default SMS app has a write permission to the SMS content provider. When you send it using the SMS app, it calls insert() directly. When you use SmsManager in your app, the system app com.android.phone somehow gets notified, performs the sending and then stores the sent message. Here's the callstack (I didn't dig further):
at android.os.Handler.obtainMessage(Handler.java:293)
at com.android.internal.telephony.gsm.GsmSMSDispatcher.sendSmsByPstn(GsmSMSDispatcher.java:291)
at com.android.internal.telephony.gsm.GsmSMSDispatcher.sendSms(GsmSMSDispatcher.java:274)
at com.android.internal.telephony.SMSDispatcher.sendRawPdu(SMSDispatcher.java:999)
at com.android.internal.telephony.gsm.GsmSMSDispatcher.sendText(GsmSMSDispatcher.java:198)
at com.android.internal.telephony.ImsSMSDispatcher.sendText(ImsSMSDispatcher.java:206)
at com.android.internal.telephony.IccSmsInterfaceManager.sendTextInternal(IccSmsInterfaceManager.java:452)
at com.android.internal.telephony.IccSmsInterfaceManager.sendText(IccSmsInterfaceManager.java:393)
at com.android.internal.telephony.UiccSmsController.sendTextForSubscriber(UiccSmsController.java:136)
at com.android.internal.telephony.ISms$Stub.onTransact(ISms.java:201)
at android.os.Binder.execTransact(Binder.java:565)
After the SMS is sent, the app posts a Handler message to itself:
at android.database.sqlite.SQLiteDatabase.insert(SQLiteDatabase.java:1343)
at com.android.providers.telephony.SmsProvider.insertInner(SmsProvider.java:618)
at com.android.providers.telephony.SmsProvider.insert(SmsProvider.java:442)
at android.content.ContentProvider$Transport.insert(ContentProvider.java:264)
at android.content.ContentResolver.insert(ContentResolver.java:1274)
at com.android.internal.telephony.SMSDispatcher$SmsTracker.persistSentMessageIfRequired(SMSDispatcher.java:1445)
at com.android.internal.telephony.SMSDispatcher$SmsTracker.persistOrUpdateMessage(SMSDispatcher.java:1476)
at com.android.internal.telephony.SMSDispatcher$SmsTracker.onSent(SMSDispatcher.java:1537)
at com.android.internal.telephony.SMSDispatcher.handleSendComplete(SMSDispatcher.java:638)
at com.android.internal.telephony.SMSDispatcher.handleMessage(SMSDispatcher.java:274)
at com.android.internal.telephony.gsm.GsmSMSDispatcher.handleMessage(GsmSMSDispatcher.java:108)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)