As it seems that you cannot end a call directly from your application, I want to know if there's a way to go back to the android call screen from my application. So the user just have to press a button on my application and be redirected to the android call screen to hang up the call ?
I think you can... it's just not easy.
If you have a ITelephony.aidl you can interact with it.
Check this:
Reflection to access advanced telephony features
Some other examples in this project:
http://code.google.com/p/teddsdroidtools/
Related
I've just read about the Android APIs called Assist and VoiceInteraction.
What I'm trying to achieve is an app like NowOnTap. For this, I need an access to the screen's content before the user long presses the home button.
First, I tried using a normal activity with the android.intent.action.ASSIST action.
Digging more into this, I found out that in order to access a screenshot before opening the apps, I need to implement VoiceInteractionSession and its methods onCreateContentView and onHandleScreenshot.
I wasn't able to create UI by using onCreateContentView and, according to my logs, it doesn't even gets called. Anyone with experience using this APIs?
I am building an Android app and want to initiate an anonymous phone call for both caller and receiver.
For example:
User A press 'call User B' button, and then initiate an anonymous phone call to User B. The tricky point is that both User A and B don't know each other's phone number and after the conversation, there is no record left and privacy is protected.
I don't know if native Android can do this. Could anyone give me some clues about this? Thank you very much!
According to the platform source-code there is NO WAY to place a call without the knowledge of the user. The best thing you can do is to make the call automatically but the user will see a dialog saying: "Calling XXXXXXXX" and he will have the chance to cancel it.
Even if you make your own dialer application you will have to sign it with the system key and place it in the system/apps folder in order to get the required permissions for that kind of things.
As for the call log, I don't know if you can make the call not to appear in it in the first place but I think (not sure though) that you can find it and deleted afterwards. Android informs other applications of call actions via Intents so it is relative easy to detect when a call ended and then query the call log.
Hope this helps...
I have 2 different applications A and B and I want to create a special animation from B to A, that is when A is opened after B was visible. This means that I need to somehow know the previous app after which my app was opened. I can have different scenarios of going from B to A - using Recent Apps (multitasking) button, using Back button, using Home button (application A is a custom home screen). Are there any ideas how to do this? Some functions in ActivityManager might help, but they have comments in documentation saying not to use them for implementing logic and control flow.
Not sure if this will work across different applications, but how about getCallingActivity() or getCallingPackage()?
If that doesn't work, could you pass along some 'extra' data in the bundle when you launch the intent that indicates the launching application?
I managed to figure out how to implement this, its working for me.
I used this answer, but replaced the ActivityManager.getRunningTasks() with ActivityManager.getRecentTasks() supplying RECENT_WITH_EXCLUDED | RECENT_IGNORE_UNAVAILABLE, and took the component name from baseIntent member of the result. The info at index 1 is the one that was running before the current app was opened, irrelevant of the fact how you get back to your app - back button, home button, recents button or opened from another app.
NOTE: This works when your app is started, like in onResume() but doesn't work when your app is closed (when called in onPause()) because the new task is not yet loaded into the activity manager. So if you need to also know to which app are you going then it might be a bit more complex.
NOTE2: Although the documentation tells not to use the API above for any kind of logic and control flow, I saw that the multitasking/recent app's code is doing exactly the same, so in my opinion it should not be as risky as they write it docs.
NOTE3: Don't forget to follow all the steps in the answer I mentioned above, like adding needed permissions, otherwise you will get exceptions. Being part of the system in my case makes it much easier for me.
I want to capture event when an user try to go into the preferences screen, so I can ask password for it. The reason why I try this, I am developing app for the disabled. I don't want them to touch system settings directly, just the permitted helper.
Is there any event listener or receiver for this?
Thanks in advance.
I don't think there is anything in the public APIs that will allow you to do this. Device Admin is probably the closest thing, but I don't think it does this exactly.
If you wish to implement this (and be certain that it will be effective) you'd have to modify the OS slightly on your devices.
One possibility that might work and is within the APIs is to create a replacement home screen that does not show the usual items in the menu. If you were to go this route you could "lock" the into your activity and simply provide them no way to go to the settings except with a password or something. This would be a lot of work though, and would require the user to set your application as their default home screen. And even with this on the newer devices you may run into the trouble because there is a settings button inside the notification pull down, which I don't think there is a way to block, even with a replacement homescreen.
My requirement is to create Custom LockScreen, using below link http://code.google.com/p/contactowner/source/browse/#svn%2Ftrunk%2Fsrc%2Fcom%2Fappengine%2Fparanoid_android%2Flost i am able to create working Fine. But my Problem is when i press HOME button it is opening the Launcher screen. (1) How to Block home button in android ? (2)If it is not possible, How few custom lock screen .apks in the android market able to block Home button.
How can i achieve that ?
Appreciate your help...
You cannot intercept the key and do this unless you have access to the android source code and can change it. From an app's perspective, you can't do this unless you have the source either. Keep in mind that this is Frowned upon in android.
So the only thing you have available is onUserLeaveHint() which is a method from an Activity. But you still CANNOT stop a user from going home.
Ref:
http://developer.android.com/reference/android/app/Activity.html#onUserLeaveHint()
Here is proof that you cannot do it directly
public static final int KEYCODE_HOME
Since: API Level 1
Key code constant: Home key. This key is handled by the
framework and is never delivered to applications.
Constant Value: 3 (0x00000003)
actually it is possible to block the home button , as locker replacement apps do (like this one and this one) . however , they do it using a sneaky way which might not work on some devices and/or future versions of android (hint: look at the code of android OS - where and when in the entire runtime of the OS is the home button being blocked from the user?) .
that's why the best thing to do in order to do it nicely is to capture the home button by acting as a launcher . then , when it's time to unlock the locker , you call the original launcher.
another advantage of using this method is that the locker will "stay better" in the memory and will be the first one that will be launched upon bootup (no need for special permission for bootup ) .
it's possible!
use window params setType(TYPE_SYSTEM_ERROR) and you'll get what you want.
JoxTraex is probably right , you shouldn't disable HOME key, or else users will report your app in future
But there is a way to detect home button press,
Check the answer to this question