android apps that alter normal phone operations - android

so i was wondering if its possible to for an application that i would write to be constantly running in the background and alter regular phone operations. For example this could be something like as soon as you receive a text from anyone you forward it automatically to another number. Is something like this at all possible?
Just to be clear I don't want to solve that particular problem through some other means, just want to know if apps can accomplish that.
Also if that is possible is it possible for an app that i write to alter more immediate and instant things, like an incoming call.
thanks all for reading this, and hopefully a helpful response :)

It depends on how far you want to go, but I would expect that what you want to achieve probably isn't possible.
The Android OS does reserve some actions and prevent them from being doing programmatically. For example, you can display the Dialer with a number filled in but the user has to press the call button to make a call. Similarly, you can display the SMS app with a message already written but it is up to the user to send the message.
I don't know for sure, but I assume this is for security. For example, let's imagine you could write an application which could start a call with no user interaction. I would release my Super-Handy-Dialer application which makes quick calls for you making you life easier, but what it also would do is wait until 2am and call my premium rate phone line every night for 3 hours.

Related

Android: How to determine if the number being called is valid or invalid

I have a big list of opt-in numbers.
Some of them are bogus or fake.
I need to write a small app that does the following:-
Read numbers from an excel file
Call each number: if the call gets through (the phone rings or is busy/engaged), we mark the number as valid in a new column in the excel sheet. If the number is invalid, we mark the number as invalid.
Is it possible to achieve this in Android?
Can we get the response status while making a call from the app?
Example: Status=Ringing, Status=Busy/Engaged, Status=Invalid etc
Is there a better way of finding if a phone number is valid or invalid?
You can't. You are unable to call any phone number other way than firing out an intent to invoke device's Phone app do the job, therefore full and smooth automation is hardly possible. You may try to do that and at the same time set up own listener to know if the call succeeded or not, but that's far from what you wanted.
You cannot do it in Android but you can develop it in a cloud-based IVR system using Call Control XML (CCXML) and a platform that has good call progress analysis, like Voxeo. Take a look at this Answer which provides more detail. Be careful with this type of solution as there are laws which govern automatic notification. Make sure people opt in for this type of notification/verification.

Updating the app at exactly midnight

Is there a way to cause my app to update itself at exactly midnight every night? I need the new content to be displayed on the app right when it hits midnight. I have an idea of how to accomplish this, but if it isn't in another thread and is in the onCreate and the app is running in the background next time it is opened it would just display the previous info and not the updated?
I could also use help accomplishing this same thing with iPhone as well.
I will clarify a bit. So all the information that is to be displayed on the app will be in the app already. I simply want the content (whats displayed) on the app to randomize and then display the new group of content only once per 24hours or at exactly midnight. Hope that makes it more clear.
Android:
You can set pre-determined times to update with AlarmManager
You can look at a snippet here: Android: How to use AlarmManager
iPhone:
With iPhone you probably have to download the content whenever you re-open the app.
Can't you just have the app update the content upon launch, or when entering the foreground in the appDelegate.
This question is very vague - but if I understand the requirements correctly you will need to serve the application's content dynamically via a content server (or some type of a CDN). In this case there could be various scenarios.
In the easiest possible implementation, you could have the application be powered by data (XML, JSON, etc...) from something like Amazon S3 and have logic within the application to know how to fetch the correct data depending on the current day.
This wouldn't be extremely difficult to implement, but it would require building some type of cross-platform framework that reads the same kind of data for each application.
Is the content available before midnight?
If so, can't you have the app download it in the background beforehand and then make it available exactly at midnight?
If not, there's surely going to be some delay anyway.
app can not update itself at least in iOS apps.

Can my activity receive the result of sending an MMI?

I can send MMIs using the approach described in e.g. Call forwarding. After the MMI is sent, there is usually a reply such as "Call forward successfully activated" or some-such.
Is it possible for the activity which started the intent to access this reply (especially for MMIs which query status messages such as "Is call forward on?") ?
Is it possible for my activity to prevent the system displaying the reply to the user directly? I mean this in the sense of "Not bother the user unnecessarily" rather than "stealthily doing things behind the user's back"; i.e. I don't care if the UI displays status icons etc, I just don't want the user having to confirm a large message box each time.
If not normally, how about on a root-ed phone?
In case this is MMI dependent, I'm mainly interested in MMIs that set, query, or cancel call-forward.
You couldn't necessarily block the popup, but for example in my app, you can send an sms to enable call forwarding, so you could run the mmi code (call startActivity from a broadcast receiver), and set an alarm to start the home screen about 10 seconds later. That wouldn't remove the popup, but it wouldn't be quite as annoying that way, I don't think.
If it really is important and you still care, you could break down the settings application using dex2jar and then use A java decompiler to read the jar file.
If anybody finds out the answer to this question, I would also be interested. I may do the work myself sometime, but I just don't care enough right now or have the time.

application open and close notification

How can I receive a notification whenever a user is opening and closing any application on the phone?
Depends on what you want. Inside the application: ofcourse. you can find out if your own application is getting opened or closed using the function from the lifecycle.
Using the same functions you can deduce you are being send to the background, so that's a bit like finding out something is happening, although it doesn't need to be another app (it could just be 'home'). Also, you won't get the notice what app is being run.
As far as I know there is no "this application is being started" trigger, but you could go the long way around: just like taskkillers do, you can ofcourse find out what tasks are being run. If one is added, then you can kind-off be sure it is being started, and so there you could create some sort of trigger for yourself. But this sounds a bit like a hack.
Maybe you want to expand on your goal, and check out of there are other sollutions?

movement of phone causes unexpected result in code

I am developing an android app which makes no reference to the sensor aspect of the phone. At a certain pint the program sends an sms and then sleeps for five minutes. If I move the phone during this sleep period a dialog box displayed earlier reappears. I realise this is rather vague without code at this stage but to start with is this something to be expected. I am wondering if one of the broadcast listeners is being triggered by the movement but even if this is so I cant make the connection with the dialog box. Any pointers will be much appreciated.
Fist off, I would take care of the orientation change possibility by forcing the app into an orientation by using the option in the manifest file.
Second, I would look at what other apps are on the device that might have an affect on this functionality. Assuming by your question, your app uses BroadcastReceivers. If this is the case, provided your business logic permits, use explicit intents ( new Intent(this, )) in place of implicit intents and receivers. If this is not possible because of business logic, then perhaps using permissions to protect against accidental implicit intent receive triggers. Ref: http://developer.android.com/guide/topics/manifest/permission-element.html (its a good starting place anyways).
Without more info on your specific business logic or source code I can't go much deeper into the problem, but my first suggestion would probably give the simplest result. Just remember to set this attribute for each activity that this problem affects.
Steve.

Categories

Resources