I would like to add details to the incoming call screen on android.
lets say I have a string 'x', so I want 'x' to show up on the incoming call screen under the name of the person who is currently calling.
I know this is possible because of these apps:
CallerId,
Vringo
I'm pretty new to this area, so I need to know what is the process to achieve that, for example: get the event of incoming call, go to the incoming call interface and so on.
Thanks!
I think you have to look at the intent receivers (actually called intent filter => have to be defined in your manifest), there should be one for incoming calls. And then you define your own application, with an activity that is made to receive this kind of intent and with the design you like...
if i'm not mistaken, it should be this :
ACTION_ANSWER
you can find more doc here and there.
CallerId seems to show Toast on the Call screen or they maybe use WindowManager addView methods (i think Vringo is working in a such way). The most problem in such case is to know that Call Screen is now on the foreground.
Related
I'm making an app in which you can chat and call with other contacts. But in case of calling, I've designed the app in such a way that after typing the number and clicking on the call icon, it takes you to native calls app for calling and updates the call log in my current app.
For this process, this is the code I've written:
if (nativeCall(mobileNumber)) {
Intent intent = new Intent(Intent.ACTION_CALL).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setData(Uri.parse("tel:" + mobileNumber));
if (((BaseActivity) context).isNetworkOk()) {
addToUserCallLogs(context, DateUtils.convertTimestampToDate(), contactUri, "Out", System.currentTimeMillis());
}
context.startActivity(intent);
return true;
}
You can see that I'm putting mobile number into the intent and starting it. And I'm using addToUserCallLogs() function to show it in my app's call logs.
This works fine usually, but in the issue is in the following case.
When the user has multiple calling applications(For eg, the user has installed application named SMARTalk. Now he has native caller app and SMARTalk app to call from), in that case the Android system gives options to chose from like this:
Now, if he choses from one of them, even in that case there is no issue. Say he didn't chose any of those and clicked on the other part of the screen. Then this options bar will be closed. Since all this is happening after starting the intent, this call will be added in the call logs of the app from the function addToUserCallLogs(). But I don't want the call to be shown in the call Logs because I haven't done any call.
But according to the code I've written, before starting the intent, I'm adding into my app's call logs database. Is there a way the information of whether the call has happened or not can be sent back from the system to the app?
Or a way to get these options to be shown manually from the app?
Please comment if you need any more explanation.
I guess no way to receive the callback information because ACTION_CALL does not return a result. You can see the output is nothing from docs even you use startActivityForResult
I'm new to android so I appreciate all the comments you have.
I want to call a new Intent from a BroadcastReceiver.
Is it possible to set the displayed size of the new intent and position it?
Precisely, I would like to place a custom picture on top of the incoming
call screen and still be able to answer or reject the call.
I could do it with toast, but it disappears after I while and I don't want that
to happen.
Thanks in advance!
I want to call a new Intent from a BroadcastReceiver
You do not "call a new Intent" in Android.
Is it possible to set the displayed size of the new intent and position it?
I am assuming that by "call a new Intent" you mean "start an activity", and by "set the displayed size of the new Intent" you mean "set the displayed size of the activity".
In that case, the code that is starting the activity has no control over the rendering of that activity. The implementer of the activity is the one that controls the rendering. It is possible for an activity to not fill the screen and have control over its size. I presume that it is possible for the activity to control where it is on the screen, though I haven't looked into that.
I would like to place a custom picture on top of the incoming call screen and still be able to answer or reject the call
That is both impossible and impractical.
It is impossible because only the foreground activity gets user input. Your activity that will "place a custom picture" will receive all input; the incoming-call screen will not receive input, and so the user cannot accept or reject the call.
It is impractical because across thousands of Android device models there are dozens, if not hundreds, of incoming-call screen implementations, none of which have to look the same. As a result, you have no way of knowing whether your "custom picture" will visually overlay important things in the incoming-call screen, such as the buttons to accept or reject the call.
i wish to end an incoming call programmatically through my app. after searching i got the code which uses com.android.internal.telephony but says it wont work for versions higher than 2.3.
i got the code for attending a call through key press event
Intent i = new Intent(Intent.ACTION_MEDIA_BUTTON);
KeyEvent event = new KeyEvent(KeyEvent.ACTION_DOWN,KeyEvent.KEYCODE_HEADSETHOOK);
i.putExtra(Intent.EXTRA_KEY_EVENT, event );
context.sendOrderedBroadcast(i, null);
is there any similar method available for ending a call?? plz help
check out this link for carrying it out on a honeycomb device after that its deprecated and it won't work however,here's a trick to handle that
http://prasanta-paul.blogspot.in/2010/09/call-control-in-android.html
Solution
You make a window appear as soon as you get a broadcast for incoming call and place your END call button on the same position as the default android end call button in center so user presses your button but you will pass the event below that window and hence call ends by android but You become a winner..
heres a tutorial for creating a window anywhere you want to without starting an activity for it...
http://www.piwai.info/chatheads-basics/#AndroidHead
I've read the following for Android Intents:
Think of Intents as a verb and object; a description of what you want done –
E.g. VIEW, CALL, PLAY etc.
I am not able to understand this sentence. Can anyone please explain me this? I know that An Intent is an abstract description of an operation to be performed.
I will try and explain. You use an Intent when you want a particular activity in your application to do something. The action that you want to perform is specified as the Intent itself (Like play music, call someone, take a photo). Verbs are something which represent any action. Intents also represent actions that you app will do with the help of activities and intents.
Also intents always need an object to perform the desired action which is an argument in the Intent. Hence the destination class object in the Intent is the is description (it contains all the detailed methods of the operation to be performed).
Hope it helps!!!
Intent transport infomation between 2 Activity, amagine it's like a transporter send mail, gift, information... between you and I.
So, I want to send you a PhoneNumber and I need you call this number. So the transporter need your name, address,... (--> It's like setClassName() in Intent) and action i want you do (--> like ACTION in Intent). After that, the transporter will send infomation to you and you will call the phonenumber for me.
hey, im new to android development and trying to make my first application.
What im trying to implement is a feature i've seen in Handcent SMS: the popup notification.
So far, my application has a broadcast receiver that uses Toast to display an incoming SMS message.
However, instead of a Toast notification, I want to make a pop up window that shows the message and offers users a space to type a reply and a button to send. (also a button to simply acknowledge the message without replying)
how would I accomplish this?
can I make my own 'floating' activity and use startActivityForResult?
would that have to be fired from inside of a service since broadcast receivers arent supposed to do any heavy lifting?
or can i use NotificationManager or something.
You need to have an activity (layout+events etc) and in order to be 'floating' you need to set it's theme to dialog, this can be done in the manifest file where you define your activity
Something like
<activity android:name=".utils.TextEntryActivity"
android:label="Type in the value" android:theme="#android:style/Theme.Dialog" />
For starting other activity from BroadcastReceiver you can use the passed Context of the onReceive event.
context.startActivityForResult(...)