Detect an incoming call

Hello
I implement a game using the MIDlet and GameCanvas. I read in the forum a way to detect that an incoming call is using the library of PhoneListener of the RIM.
But I wonder, is there another way to do a little fooling maybe!
I noticed that when the unit receives a call, the user accepts the call, the device calls the MIDlet pauseApp and the displayable IsShown method returns false. But when the device receives a call and the user decides to take it or not, the appliance calls pauseApp no displayable methos as isshown returns false, it's returning true in this stadium. If the user declines the call, the game continues to work as if nothing had happened. But the problem is that the device takes control of the sound, and when he returns to the game, there is no sound in my game. Note that this only happens if the user declines the call, because no pauseApp method is called, and IsShown continues to return true.

Yes, is there a way to detect and incoming call without using PhoneListener?
Thanks in advance

Kind regards
Vitor

PS: I found and really old thread asking the same thing and it is not resolved yet, so I posted it again, hope this isn't a big problem.

I found a solution, kind of a thing. In my game there is background music, in adding a PlayerListener, I could detect when a call is received by the playerUpdate method. When a call is received the device stop him his game and receiver playerUpdate a DEVICE_UNAVAILABLE event. So whenever I'm in the middle of the game and receive this event, I can put my game paused.

Thank you all

Tags: BlackBerry Developers

Similar Questions

  • How to detect incoming calls in the background?

    Hello

    our application works in the background (and playes audio). We are looking for a way to detect incoming calls (and to stop playing).

    It comes to CLDC app, not a moped.

    Is it possible in background mode and how? In which case I can listen?

    If not, is it possible in the leading fashion and how?

    I guess we can add a net.rim.blackberry.api.phone.PhoneListener and use the callIncoming method
    in the main application, but it works in background mode?

    If anyone can confirm, I would appreciate... Thank you...

    @ BBDev, but when a call is incoming, and then sound stops automatically right? And we don't have to capture the event however!

    Thank you!

  • How can I get the number of callers phone number (call history) of an incoming call on iPhone by program (as TrueCaller App does)

    I try to get the caller ID (telephone number or the call history) at the time of the incoming call. TrueCaller has implemented it and they get the phone number of the caller and the call also history.

    Please help me get there.

    Tips:

    1 CoreTelephony Framework(It gives only calling states)

    2 apples 9.0 update: "Maybe" contacts sync. with the mail application and detects the incoming phone number.

    3 TrueCaller App https://www.truecaller.com/articles/iphone

    https://iTunes.Apple.com/app/truecaller-enhances-your-phonebook/id448142450

    You're talking not here who you think you are. Please read the terms of the user agreement you signed.

  • Divert incoming call programmatically

    Hey

    Writing an application which diverts incoming calls to another number. Nothing more complicated than just detect incoming call and redirect the call to a diffren number.

    Is it still possible?

    Thank you inadvance

    No, this is not possible.

  • How to detect an incomming SMS? -HELPPPP

    Hello everyone,

    This is my first post in this forum. So far, it has helped me a lot. But since a few days, I have had a problem. I want to detect an incomming SMS. I read some post and I found a few pieces of codes that are interesting. But, I failed to do so.

    Here are a few links I've read:

    -http://www.j2mepolish.org/javadoc/j2me/de/enough/polish/messaging/MessageListener.html

    -http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What _...

    - http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/How_To _...

    - http://supportforums.blackberry.com/t5/Java-Development/notifyIncomingMessage-only-called-for-first-...

    - http://supportforums.blackberry.com/t5/Java-Development/How-to-listen-to-incoming-sms-message-only/m...

    I will stop here with links.

    Now, here is my code:

    /*
     * hw.java
     *
     * © , 2003-2008
     * Confidential and proprietary.
     */
    
    import java.util.*;
    import java.lang.*;
    import java.io.*;
    import java.io.IOException;
    import javax.microedition.location.*;
    import javax.microedition.io.*;
    import javax.microedition.io.file.*;
    import javax.microedition.pim.*;
    import javax.wireless.messaging.*;
    import net.rim.device.api.io.*;
    import net.rim.device.api.ui.*;
    import net.rim.device.api.ui.component.*;
    import net.rim.device.api.ui.container.*;
    import net.rim.device.api.system.*;
    import net.rim.device.api.i18n.*;
    import net.rim.blackberry.api.invoke.*;
    
    /**
     *
     */
    class hw extends UiApplication {
        public static void main(String[] args)
        {
            hw instance = new hw();
            instance.enterEventDispatcher();
        }
        public hw()
        {
            pushScreen(new SalutationScreen());
        }
    }
    
    class SalutationScreen extends MainScreen implements Runnable //, MessageListener
    {
        private Thread t;
        private MessageConnection _mc;
    
        public SalutationScreen()
        {
            super();
            LabelField applicationTitle =
                new LabelField("Hello World Title");
            setTitle(applicationTitle);
            RichTextField helloWorldTextField = new RichTextField("Hello World!");
            add(helloWorldTextField);
    
            t = new Thread(this);
            t.start();
    /*
            try {
                _mc = (MessageConnection)Connector.open("sms://:0");
                _mc.setMessageListener(this);
                helloWorldTextField = new RichTextField("setMessageListener : done");
                add(helloWorldTextField);
            }
            catch (IOException e) {
                helloWorldTextField = new RichTextField("erreur constructeur : " + e);
                add(helloWorldTextField);
            }
    */
        }
    
        public boolean onClose()
        {
            Dialog.alert("Bye World!");
            System.exit(0);
                    return true;
        }
    
        public void run()
        {
            try{
                DatagramConnection _dc = (DatagramConnection)Connector.open("sms://:0");
    
                for(;;)
                {
                    Datagram d = _dc.newDatagram(_dc.getMaximumLength());
                    _dc.receive(d);
                    byte[] bytes = d.getData();
                    String address = d.getAddress();
                    String msg = new String(bytes);
    
                    helloWorldTextField = new RichTextField("  Message text received : " + msg );
                    add(helloWorldTextField);
                }
            }
            catch(Exception e){}
    
    /* METHOD 2
            while(true)
            {
                try
                {
                    DatagramConnection _dc = (DatagramConnection)Connector.open("sms://");
                    Datagram d = _dc.newDatagram(_dc.getMaximumLength());
                    _dc.receive(d);
                    String address = new String(d.getAddress());
                    String msg = new String(d.getData()); 
    
                    helloWorldTextField = new RichTextField("Message received: " + msg + "\n" + address);
                    add(helloWorldTextField);
                    Alert.startVibrate(3000);
                }
                catch (IOException e)
                {
                        System.err.println(e.toString());
                }
            }
    */           
    
    /*  METHOD 3
            try {
                MessageConnection _mc = (MessageConnection)Connector.open("sms://:0");
    
                for(;;)
                {
                    Message m = _mc.receive();
                    String address = m.getAddress();
                    String msg = null;
                    if ( m instanceof TextMessage )
                    {
                        TextMessage tm = (TextMessage)m;
                        msg = tm.getPayloadText();
                    }
                    else if (m instanceof BinaryMessage) {
    
                        StringBuffer buf = new StringBuffer();
                        byte[] data = ((BinaryMessage) m).getPayloadData();
                        // convert Binary Data to Text
                        msg = new String(data, "UTF-8");
                    }
                    else
                        System.out.println("Invalid Message Format");
    
                    RichTextField helloWorldTextField = new RichTextField("Received SMS text from " + address + "\n" + msg);
                    add(helloWorldTextField);
                }
        }
        catch (IOException e)
        {
                System.err.println(e.toString());
        }
    */
        }
    
    /*  METHOD 4
            public void notifyIncomingMessage(MessageConnection conn) {
                RichTextField helloWorldTextField = new RichTextField("notifyIncomingMessage DEBUT");
                add(helloWorldTextField);                
    
                try {
                    Message m = conn.receive();
                    helloWorldTextField = new RichTextField("- Message recu");
                    add(helloWorldTextField);                
    
                    String address = m.getAddress();
                    String msg = null;
    
                    if ( m instanceof TextMessage )
                    {
                        TextMessage tm = (TextMessage)m;
                        msg = tm.getPayloadText();
                    }
                    else if (m instanceof BinaryMessage) {
                        StringBuffer buf = new StringBuffer();
                        byte[] data = ((BinaryMessage) m).getPayloadData();
    
                        // convert Binary Data to Text
                        msg = new String(data, "UTF-8");
                    }
                    else
                        System.out.println("Invalid Message Format");
    
                    helloWorldTextField = new RichTextField("- Message de : " + address + " // \""+ msg + "\"");
                    add(helloWorldTextField);
                }
                catch (IOException e) {
                    helloWorldTextField = new RichTextField("erreur _mc.receive : " + e);
                    add(helloWorldTextField);
                }
    
            }
    */
    
    /*  METHOD 5
            public void notifyIncomingMessage(MessageConnection messageConnection)
            {
                new Thread()
                {
                    MessageConnection conn;
                    Thread set(MessageConnection conn)
                    {
                        this.conn = conn;
                        return (this);
                    }
                    public void run()
                    {
                        try
                        {
                            Message m = conn.receive();
                            String msg = null;
    
                            if ( m instanceof TextMessage)
                            {
                                TextMessage tm = (TextMessage) m;
                                msg = tm.getPayloadText();
    
                                RichTextField helloWorldTextField = new RichTextField("- Message de : " + m.getAddress() + " // \""+ msg + "\"");
                                this.add(helloWorldTextField);
                            }
                        }
                        catch (Exception e)
                        {
                        }
                    }
                }.set(messageConnection).start();
            }
    */
    }
    

    In my code, I tested 5 methods. But, I think that all of them blocked the line where there is method of 'received() '.

    If there is someone who can help me find my problem, it's going to be great. (Or if there is someone who wants to send me a complete code that works, it will be better than the grand )

    Thank you for all the answers.

    I agree with you. It's better if I post a solution.

    I have re-written some other program that gets the phone number and the content of the incomming SMS.

    Here is my code

    public class smsReceived extends UiApplication
    {
        private LabelField _status;
        private DatagramConnection _dc;
    
        public static void main(String[] args)
        {
            new smsReceived().enterEventDispatcher();
        }
    
        public smsReceived()
        {
            super();
            waitASms();
       }
    
        public void waitASms()
        {
            try
            {
                _dc = (DatagramConnection)Connector.open("sms://");
                for(;;)
                {
                    Datagram d = _dc.newDatagram(_dc.getMaximumLength());
                    _dc.receive(d);
                    String address = new String(d.getAddress());
                    String msg = new String(d.getData());
                }
            }
            catch (IOException e)
            {
                System.err.println(e.toString());
            }
        }
    }
    

    In this code, the string 'address' is the phone number and the string 'msg' is the content.

    To view, please do another method with this channels.

    Next time.

  • Can't do out calls and incoming calls go straight to voicemail

    Cannot do out calls and incoming calls are directed to voicemail

    See If you can not connect to a cellular or cell - data Apple Support Network.

    TT2

  • Incoming calls mute after updating iOS 10.0.0.2 iPhone SE

    Hello

    After the update of 10.0.0.2, I saw a strange problem on my iPhone SE:

    • Incoming calls appear to be muted 2 ways (the two of us don't hear)
    • The speaker and mute icons on the screen looks normal (non-active)
    • When pressing the speaker icon 2 times (the first time it activates the "speaker" icon, but not the President himself, the second time, it disables the icon) all works fine again.

    It's the same when you use the standard helmet.

    A reboot seems to fix my problem for 1 time. But after that, the problem returns.

    I could not find any related problem, so maybe I'm missing some (new) settings?

    Any help is greatly appreciated!

    Peter

    Hi Montfrooij,

    Thank you for using communities of Apple Support. From what you have said, it seems that you are not able to hear a person during a call on the iPhone. Looks like you already have a troubleshooting.  I recommend you to read this article, it may be able to help solve the problem. You can also check that the iPhone is not connected to a headset Bluetooth, the sound of routing to that rather than the receiver.

    If you do not hear a person on an appeal or a voice message or if the sound is not clear on your iPhone - Apple Support

    See you soon.

  • Can not see incoming calls when the iPhone is locked

    When my iPhone is blocked I don't see if there are messages or incoming calls. It isn't anything like that before.

    Thank you

    check the tools on your phone

  • no caller ID on a second incoming call on IPhone 6

    If I talk to someone, and someone else tries to call, I get a sound notification of this second appeal, but NO caller ID. Sometimes I do not even an option to swtich to the second call. Or, I have to let him keep a sound signal, or cling to the original caller. Why is this?

    Also, if I'm (although once in awhile), able to switch to an incoming call, I am UNABLE to return to the original call. Sometimes a 'swap' message, but most of the time, I end up hanging up everyone. so I ignored any second call when I am engaged in the conversation. It is a $600.00 phone that is apparently able to do everything, except what was originally invented for the phone. someone at - it a solution?

    I've not seen this. That your operator has had to say when you ask, they control the management of calls?

  • No sound on the hands-free car on incoming calls after upgrade iOS 10

    I recently updated my iPhone to iOS 10 6s. With one of the versions iOS 9 it makes my hands-free connection in my Toyota 'agitated', but this time I could call people without problem, so I thought everything was ok. That was, until I got a call and didn't hear a thing after accepting it.

    Seems iOS 10 has broken my audio on incoming calls. I can't hear the caller, and the caller does not hear me. I tried to reset network and matching settings once again, but unfortunately which didn't help either (this resolved the problem of stuttering last time).

    Anyone got tips on how to solve this problem?

    DelGurth salvation!

    I see that your car radio on your iPhone Bluetooth connection no longer works correctly.  I know it's important to have this job just so I'm happy to offer assistance.  Please follow the instructions in this article, and it may be necessary to contact Toyota to see if there is an update of the firmware available for your car stereo.

    Help to connect your iPhone, iPad or iPod touch with your car radio

    Thank you for using communities of Apple Support.

    See you soon!

  • Reject incoming calls on ios 10 not listed is not on the lock screen (Notification)

    Reject incoming calls when the phone is locked by pressing the power button / stop on ios 10 that the same call does not appear on the lock screen or (Notification) as a reminder...

    N ° it will not. He never has. you will see a missed call notification if you miss the call. If you actively reject the call, you don't have to Miss it. Access your recent calls list and call back them was from there.

  • Shows incoming calls to the United States instead of the city and the State

    IiPhone 6plus, IOS 10.  Incoming calls from unknown number of shows in the United States instead of / the State of the city. How can I fix this. Thank you

    Settings > general > language and region > region = 'United States'... assuming that is where you are.

  • Apple Watch not advise with haptics during incoming calls

    Hi, my Apple Watch is not advising me with haptics for incoming calls. When I see the call on my phone and check my watch, I see appear on my Apple Watch face, but not with haptics the incoming call.

    I have the latest iOS on my iPhone 6 (9.3.4) and on my Apple Watch (2.2.2)

    Must be with the implementation in the application of Apple Watch, configure the options for the phone in the mirror?

    Hello

    It can help to use these settings:

    • On your iPhone, in the application of the watch, go to: My Watch (tab) > Notifications > phone:
      • Choose custom.
      • Allow everyone to view alerts, sounds and Haptic.
  • Cannot receive incoming calls

    Sometimes. All of a sudden. My phone is in my pocket and someone calls me. I see the cursor that is used to receive incoming calls. But when I slide, nothing happens. Seems that the screen was hung. I remember one day I've relied on the home button and then I could use the cursor and receive the call, but it worked for once. It's boring. I use 6s, latest iOS. Any solution please?

    Hey CoolBrain,

    I see that the phone app seems to be freezing when you attempt to drag in order to answer a call. Certainly, this is not an ideal situation, and I am happy to help you get on the path to solving this problem.

    Before you start, I would recommend that you back up your device either using iCloud or iTunes using the steps here:

    The backup of your iPhone, iPad and iPod touch - Apple Support

    After you back up your device, try to restart it at first to see if the problem persists when you receive a call. If the problem persists, try the steps here to force quit the application and try again:

    Force an application to close on your iPhone, iPad or iPod touch - Apple Support

    If the problem persists after trying the above steps, you will need to reinstall the application phone by restoring your iOS software in iTunes. Take a look at the following resources for more information on this process:

    Use iTunes on your Mac or PC to restore your iPhone, iPad or iPod settings - Apple Support

    Once the restore is complete, try to test "set up in the new" to ensure that the problem does not persist. Once you have finished stable, you can follow the steps here to restore from your backup iOS:

    Restore your iPhone, iPad or iPod touch from a backup - Apple Support

    Take care.

  • How can I convert an incoming call read only an attachment so I can change it?

    How can I convert an incoming call reads only attachment so that I can change it? Save in Word does not it, and find research peut t.

    So, the problem seems to be that attachments are stored as files read-only by Thunderbird and an application it can open without editing privileges, so you cannot change the. Read-only mode was chosen because these files are kept in a temporary location. For example, if you modify and save the back, they are deleted when Thunderbird is closed, so losing your changes. The idea is to force to save you to a different location. You should be able to do it, then open it from that location with full editing capabilities.

    For a permanent change in this behavior, go in the [tools >] Options > advanced > general tab and click on Config Editor there. After you confirm the warning, copy - paste browser.helperApps.deleteTempFileOnExit into the search bar and switch false to true by double clicking on it. Now, saved attachments are created with read/write permissions, but is more removed when Thunderbird is closed (i.e., stored in % AppData%\Local\Temp).

Maybe you are looking for