Android: Display a message during a call - java

I have a program that makes a phone call when a user clicks on a button. The user will need to provide some information very fast to the person who answers the call(ie GPS coordinates). The problem that I am having is that, once the user clicks on the call button, they cant go back to my application.
I want to know if it possible to bring my application to the front (without hanging up the call) or to display a message until the user clicks the ok button... or something like that. I tried toast notification but they disappear and I want them to stay until the user decides to close it.

look up startActivityForResult() and see if you can hook into the calling code.

Related

How not to interrupt the current process in the application when the user clicks on push?

on one screen in my application, I am recording audio.
Scenario: User records audio on this screen. A push comes from our application. The user clicks on this push and another push processing activity is launched.
Result: The user loses his session.
Question: what are the options for handling this case so that the user does not lose his session? Ideally, before switching to a new activity, the application would ask the user if he is sure that he wants to go to another screen, because the session will be lost. But how to track it?
Thanks a lot for your advice
The best solution I have found is to clear all old push notifications in the notification shade when going to the recording screen.
val notificationsManager = getSystemService<Any>(Context.NOTIFICATION_SERVICE) as NotificationManager?
notificationsManager!!.cancelAll()
Further during the recording, if a push notification arrives, I receive this in my service inherited from FirebaseMessagingService in onMessageReceived().
If the recording screen is currently open, I do not show a notification in the notification shade. But I show a widget on the recording screen with the push text and if the user presses it I ask if the user wants to go to another screen because the recording will end.
I hope my experience helps someone. Similarly implemented in Intercom

How to control print and cancel buttons on browser's print page?

I work on a Java web application on Eclipse.It has a screen, which some invoices are listed in a table.I can approve, edit,send via email,print or cancel the invoices via selecting them from the table.
When I click on print button, a MessageDialog gets opened and asks whether the user is sure to print the invoice, and I say yes.Then the browser's print page gets opened:
I want to be able to control the "Print" and "Cancel" buttons on these page.If I click on "Print", the status of invoice is going to be "PRINTED".If I click on "CANCEL" the status of invoice is not going to change, it should remain same.
When I execute the following method on the class,it opens browser's print page.
private void printPressed() {
browserContent.execute("printMe();");
}
And I am stuck at these stage.I want to modify this method for the purpose of controlling "Print" and "Cancel" buttons.How can I change it?
You can't as this will be security hole (Imagine that you make loop to print 1000000 pages of stg nasty). Every user must decide on his own.

Get user confirmation before closing a DialogFragment

I have a DialogFragment that allows a user to create a new record. I would like to intercept the close event to test whether they've started inputting any data, and if so prompt them that will lose unsaved changes. I would rather not add a close button, so the user can close the Dialog by clicking anywhere outside it in the screen.
So is there an event that will allow me to cancel the Dialog close action if the user selects not to?
You could do something similar to what is described in this answer -- make an activity that intercepts all touch events, both inside and outside its bounds, then checks for ACTION_OUTSIDE on captured touch events. Note that that's using a separate activity for the dialog, not a fragment, so if using the fragment is a strict requirement this method won't work for you.

Pressing back button on Calling screen takes user to home page. Any solution?

What i want to do is to allow user to call a number from application. i am using following code for this which is working fine for calling a number. But however when i press back button during call it takes me home page instead of back in previous screen of the application where the calling application was invoked from. please have a look over code and if anybody have solution please help me.
PhoneArguments callArgs = new PhoneArguments(
PhoneArguments.ARG_CALL, "+27 83 111 1234");
Invoke.invokeApplication(Invoke.APP_TYPE_PHONE, callArgs);
any help would be appreciated. Thanks.
You could use PhoneListener to detect when the call has ended and then try to bring your app to foreground using this:
Application.getApplication().requestForeground();
Not sure if this is going to work though, because I'm not sure if the "application" where the phone listener executes is the phone app itself. I think no, but if it were the case, you could send a global event from the phone listener callback and catch it in your app which in turn could bring itself to foreground.

Screen notifications for user

Please, I guess how it is called: an on-screen floating message with small arrow, they used to show to user what button to push when he sees the program for first time. They are usually with text "press this button to..." or "here you can get this.."
How to implement it in android application?
edit: I implemented some buttons on screen, and they say that it is not clear what they are for. I want to show user, when he (she) run the program after update, that this is a button and it is for...
maybe u could make a a whole new UI over ride for floating display or make a
activity fully transparent with a limited window size
and over lap it over ur previous activity

Categories

Resources