[Q] Monitoring called protected API Methods - Android Software Development

Hi,
is it possible to write an App, which run in the Background and show a message for example when an another app wants to read the adressbook or the sms?
Something like an event handler which react when a protected API method is called?
Thx

... or is there sometging like an Breadcast Intent Message?
Nobody an Idea?

Related

Read SMS

Hello!
I have some difficulties to read SMS in my application : my application doesn't want to use the fonction SmsOpen in mode RECEIVE. Do you know the parameters to use in this function to read Sms?
Gremlins (and I'm not Gizmo!)
funny as Gizmo asked me exact the same question via private mail ...
This was my response:
----------------------------------------
I've never used the function to read SMS messages but here is my suggestion:
check the return code of SmsOpen, it is probably SMS_E_RECEIVEHANDLEALREADYOPEN. According the SDK help it means, that another app has already opened and is using the provider. In most cases, that might be Inbox, so shut down the Inbox task befor you are running your code.
If your error code is different, check the meaning in the help file, look for SmsOpen -> SMS specific error codes.
You don't have disable Inbox. The problem is the internal SMS handler - if you look in \Windows\Startup, you'll see a SMSHandler (I don't have a T-Mobile at the moment, so can't confirm the exact name). You need to get your application to start before it. In addition, you need to do a SmsSetMessageNotification() for both SMS_MSGTYPE_RAW as well as SMS_MSGTYPE_TEXT message types. Strangely, the code does not get the notification if you only set it for one of the two.
I have a T-Mobile MDA. There is a folder called "AutoStart" in the Windows folder, so I guess the file called "SMSReceiver.exe" is the handler you were talking about. I named my application "aaamyapplication" in order to start it up first after a soft reset (There is actually no "startup" registry-entry either for "SMSReceiver" nor for my application... in the end I kicked "SMSReceiver" out).
Unfortunately receiving an SMS through my app does not work (but strangely the system is still able to receive SMS in spite of deleting "SMSReceiver").
Do you have a good guess what I should do? I would be grateful for any advice
t_lex
Could some body be more specific on what Jvd said ??? i'm running an XDA2 and when i look in windows/startup i only get the followng :
CheckAutoRun
ChgDfLnk
IA_Caller_ID
MMReg
poutlook
stk
wifiIcon

Flash sms appearing

hi all,
i had download the SendSms. from the msdn website...
however when it send the sms out to a GSM phone (Nokia 7110) it appear as a flash sms(which the contents of the sms appear directly on the screen of the phone eg:"Message:hello world", rather than "1 message receive"). Furthermore, the sms is not handled by the inbox..
does anyone knows how to disable this flash sms?
or is there any other way to send sms using VB.NET???
this is the website that i downloaded the send sms application..
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/netcfsendsms.asp
Cool!
I've been looking for a way to send flash sms..
Sorry that I can't help you though..
flashing sms...eVB
Hmm, this is cpy/pasted from the page being shown when clicking your link .....
private enum PROVIDER_SPECIFIC_MESSAGE_CLASS
{
PS_MESSAGE_CLASS0 = 0,
PS_MESSAGE_CLASS1,
PS_MESSAGE_CLASS2,
PS_MESSAGE_CLASS3,
}
PS_MESSAGE_CLASS0 indicates the message should be displayed immediately but not stored on the Subscriber Identity Module (SIM).
PS_MESSAGE_CLASS0 = 0,
What does the above value "= 0" means??
I've tried using ur method, but the message still appear as a flash sms on the phone.
how do i change the values?
and is the PS_MESSAGE_CLAASS really neccessary?
because i actually commented out the whole class and compile,and the app still send a flash SMS...
PS_MESSAGE_CLASS0 indicates the message should be displayed immediately but not stored on the Subscriber Identity Module (SIM).
PS_MESSAGE_CLASS1 indicates the service center handling the message should be notified when the message goes through and it should be stored.
PS_MESSAGE_CLASS2 indicates the message should be first sent to the SMS data field within the user's SIM before notification is sent to the service center handling the message. If the SIM is filled, an error message is sent to the service center.
PS_MESSAGE_CLASS3 indicates when the message has successfully been sent to the destination and can be stored to SIM, the service center will receive a notification.
i just want to disable the flash sms..
Can you post please your compiled flash Sms application..
its on the msdn website..
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetcomp/html/netcfsendsms.asp
it contains the codes..
i am using vb.net..
Yeah,but I am not using vb.net and don't wanna install it only to compile that app.
So,can you send me the compiled Flash sms app please?
Nice!!
But I dont have MS Visual Studio but I would like the SMS Flash Application too
Can you post it here please?
Cheers
Rdkay
I've found the solution by hacking into the msdn code. Just add the providers' data (force the providers' data to use class 1 sms type)
ProvData(4)=1
Re: Cool!
Bonzo said:
I've been looking for a way to send flash sms..
Sorry that I can't help you though..
Click to expand...
Click to collapse
Try "SMS Writer" v1.6 by DesignLab, you will have options for "Flash SMS", "Normal SMS" and "Normal SMS with Receipt"...
Best regards,,,

SMS program

Hi Folks,
This is my first post, although I've owned my XDAIIs for several weeks and I've ROM'd it to the iMATE 1.4 ROM. So I've had a good play.
I was looking at smsOrganizer (from Jeyo) which is badly supported (and it ain't free) and I wondered why I (we) couldn't write something to do the same thing, for free.
Is there a forum for this kind of activity, or could someone point me in the direction of some exmples of how to pass data between the PC and phone?
Best regards
AndrwB
Andrew, look into RAPI: eg here
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/dnarppc2k/html/ppc_teapppi.asp
Development and Hacking is the right place for this kind of query...what do you want the app to do?
V
Hi V,
Basically I want to control the SMS message transfer on my XDA from Outlook, just like smsOrganizer.
Re. your link, I think we've got those? but I generally write embedded C, non of this fancy C++ stuff :-((
AndrewB
Hi V,
I just tried this :
http://support.microsoft.com/default.aspx?scid=kb;en-us;307256
And I can now copy files to and from my device
Not bad for 1 hours playing, specially as I've fixed 2 work related bugs too )
Andrew B
Good stuff.
I'm just learning C++ actually, I never learnt C, coming from self-taught VB on the PC.
RAPI is the way to do most PC<>PDA communications, although right now I'm only just getting into sms stuff. It'd be easy enough (I think) to write an interface to create an SMS on the PC in text, transmit that to the PDA and then SMS it off, but the backend of it would require some implementation.
Keep us posted though!
V
99% of c programs should compile and work just fine on
c++ compilers and you can write c++ programs without using
oop in which case they are pretty much c programs
From what I've read it looks as if you need to write an app to sit on the device and another app on the main PC. The app on the phone just acts as an agent passing data between the sms services and the PC.
Anybody got any ideas?
AndrewB
Yipeeeee
I can now write a DLL that sits on the device and I can write a C++ application on my PC to communicate with it
Now to start reading some text messages from the device to the PC......
Does anybody know agood way to send and recieve SMS ?? I would also like to edit the text and pass it to an Edit Box.
I am not too sure about the available API's that will let me do this.
Please HELP :shock:
Hey , i would like to send and recieve SMS on my xda2. Also pass the recieved message into an Edit Control. Does anybody know a good way to do this ??
I know about the SMS API but i am unaware of others. Pleas Help !! thnkx
SMS Auto sending
Hi everybody,
Is there a way to auto send all sms in draft? Basically, every sms in draft folder needs to be send one by one by ticking send button.
OK,
I can now send a text message from my PC to a DLL on my phone using RAPI, then send a SMS using MAPI.
The trouble is I can't get the subject and body fields to display correctly on my XDAIIs. Also I can't get the Name to appear instead of the number.
I'll try to post the code later on the understanding that it is FREE and we pool our experiences/knowledge.
Here is the code for the DLL and the PC program. Just press one of the keys on the tol bar to send the message. The number and message are hard coded.
There are ABSOLUTELY NO guarentees with this code, use it at you own risk.
can it recieve SMS as well ?? Has any body thought about other API's to use for sending and recieving SMS's maybe ?
Well.... Not yet.
This is my first ever .net VC++ program !!!!
There are lots of code snipets around but no full source code.
This is a work in progress project hence it is in the "Development and Hacking" fourm.
If you'd like to add some functionality to it......
I am asking because there seems to be a problem when trying to recieve SMS with SMS api as the HANDLE is already attributed to the messaging application (inbox/draft/outbox).
I believe you are using RAPI ? However i do not understand this API that well could u specify a bit more ?
Thanks for your help.
Hi nutitija,
I'm only using the RAPI function to pass parameters from my PC to the XDA. The actual sending of messages is done using the MAPI in the XDA.
My biggest problem is getting the subject/body and from fields to display correctly in the different XDA mail views.

Help Read SMS

Hello,
I would like to use SMS in a new application using XDA. I want my application can read sms in inbox.
Do you know how I could see example of source code using SMS API? Or do you have such example to help me?
I got example to send sms but cannot get sample how to read the sms.
FYI, i am writing program using eVB.
Thanks a lot
You should take a look at PocketPC Network Programming by Steve Makofsky or simply try
http://groups.google.com/groups?q=pocketpc+sms+api&start=0&hl=de&ie=UTF-8&
and
http://msdn.microsoft.com/library/en-us/dnppcgen/html/sms_apps2.asp?frame=true
SMS API is not easy.
Yup, it's not very easy, you need to learn about POOM...
I advise you to look into VB .net, it's been made a hell of a lot easier.
I still do it the Medieval way though! Win32 C++ all the way :shock:
V
I did include some C code on sending/reading SMS in this post
http://forum.xda-developers.com/viewtopic.php?t=10761&highlight=
You are asking about reading messages in the Inbox that is when poom as mentioned by vijay555 comes into play.
I don't know anything about poom, but I have read incoming SMS by making my read thread take control of incoming SMS. This means that the message never goes into the inbox.
vangelderp: interesting code, not seen it before on the board. A very good way to do it. It doesn't need to be installed before pocket outlook etc does it? I don't imagine it does. Good stuff!
V
No it does not need to be installed before PPC Inbox (Outlook), what seems to happen is when a SMS message comes in the Inbox fires up. From that point on my code won't get a handle to SMSRead.
So what you need to do is do a warm reset and then start your user program (including my code sample) before any new incoming SMS messages and then it will get the SMSRead handle first. This then blocks Inbox getting a handle which I am sure it raises a error message on if you then try to go into inbox.
vangelderp: yup, that's what I thought. I never used that technique because of that, I stuck with POOM. But your createevent and thread work is very helpful.
V
SmsReadMessage of SMS.API
Thanks for your all comments.
Do you know how to use SmsReadMessage of SMS.API ?
This function is used to Reads a previously received SMS message. I really hope somebody else out there can help me how to use that function
Regards
You use SmsReadMessage like I do in the code attachment I have mentioned.
This function does not read a SMS message that has already been received by the normal PPC Inbox program. As said for that you need to use POOM.
SmsReadMessage for for your code to get a SMS Read Handle and then wait for the event (The Message) to occur and then use the SmsReadMessage function.
Exactly as I have done in my code snippit.

How to write to SMS Content Provider in Android KitKat WITHOUT being default SMS app

Hello,
we know that Google made huge changes on SMS management with the release of Android 4.4 KitKat.
In summary:
1) the user can choose a default SMS application and only this app can write to SMS content provider.
2) now there are two broadcast SMS_RECEIVED_ACTION (for all apps) and SMS_DELIVER_ACTION (only for the default app). You will get notified about an incoming SMS with both, but you cannot abort the broadcast anymore
If you want to delete (or to restore) an SMS, you have to become default app temporarily, annoying the user with two mandatory prompts.
Looking in Android sources we can find out that the default SMS app gets a special permission to write SMS with App Ops:
Code:
// Allow OP_WRITE_SMS for the newly configured default SMS app.
appOps.setMode(AppOpsManager.OP_WRITE_SMS, applicationData.mUid,
applicationData.mPackageName, AppOpsManager.MODE_ALLOWED);
and we also know that there is still a way to access App Ops in Android 4.4 KitKat:
From shell:
Code:
adb shell am start -a android.settings.SETTINGS -e ":android:show_fragment" "com.android.settings.applications.AppOpsSummary"
From your app:
Code:
Intent intent = new Intent(Intent.ACTION_MAIN);
ComponentName cn = new ComponentName("com.android.settings", "com.android.settings.Settings");
intent.setComponent(cn);
intent.putExtra(":android:show_fragment", "com.android.settings.applications.AppOpsSummary");
startActivity(intent);
If you go to Messaging tab and look into permissions, you will find out that your non-default SMS app has WRITE SMS OFF. But you can also turn that ON because it isn't mutually exclusive with the default app.
You still require user interaction (but not root) or root access to write this secure setting.
I hope that some developer can benefit of this before Google lock down definitively App Ops access. Sorry, but it doesn't solve abort broadcast issue.
I found this issue on AOSP: https://code.google.com/p/android/issues/detail?id=61684
I also think that Google should change something with SMS. Why not let the user choose not one but more apps as "default" (like notification listener for example) and restore the ability to abort broadcast?
Best regards!
This has stopped working in 4.4.2.
Do anyone have an work around?
Bump - need a way to fix the problem with SMS filtering. Numbers I've blocked with another app still get into my inbox defeating the purpose.
Sent from my i337 on Roids using xda premium
Goliath27 said:
Bump - need a way to fix the problem with SMS filtering. Numbers I've blocked with another app still get into my inbox defeating the purpose.
Sent from my i337 on Roids using xda premium
Click to expand...
Click to collapse
+1
Sent from my EVO using Tapatalk
Edit : Answer Deleted
How update this settings in my app if I have root privileges?
Thanks

Categories

Resources