×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    Registered User
    Join Date
    Jan 2009
    Posts
    18

    Resume MIDlet after platformRequest

    Is there anyway to resume a MIDlet after platformRequest method?

    I want to do a phone call and when it finish continue with MIDlet execution sending SMS, etc.

    My mobile is Nokia 6212 classic (Series 40 5th Edition, Feature Pack 1).


    Greetings.

  2. #2
    Registered User
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868

    Re: Resume MIDlet after platformRequest

    Hi ,
    read the platformRequest() method documentation
    It says :
    If the platform has the appropriate capabilities and resources available, it SHOULD bring the appropriate application to the foreground and let the user interact with the content, while keeping the MIDlet suite running in the background. If the platform does not have appropriate capabilities or resources available, it MAY wait to handle the URL request until after the MIDlet suite exits. In this case, when the requesting MIDlet suite exits, the platform MUST then bring the appropriate application (if one exists) to the foreground to let the user interact with the content.

    example code look like this
    boolean result = parent.platformRequest(url);
    if(result){
    // Show alert to user like before to open this link you need to exit the application
    }else{
    parent.notifyPaused(); // It will bring back the midlet
    }

    It means to do the patformRequest it require some capabilities from the phone. It's totally dependents on the capabilities. In the newer Nokia phones S40 mobiles it will bring the midlet back

  3. #3
    Regular Contributor
    Join Date
    Apr 2009
    Posts
    89

    Re: Resume MIDlet after platformRequest

    I completely agree with Banu. It's all depend on device capabilities.

    It means to do the patformRequest it require some capabilities from the phone. It's totally dependents on the capabilities. In the newer Nokia phones S40 mobiles it will bring the midlet back

  4. #4
    Registered User
    Join Date
    Jan 2009
    Posts
    18

    Re: Resume MIDlet after platformRequest

    Hi, thank you very much for your help.

    I tried with example code of bhanuchandar.k and it works perfectly. With notifyPaused the MIDlet comes back to the foreground and continues his execution.

    But now, I have another qustion, in some scenarios of my project the MIDlet will have to make several phone calls, so, is there anyway to know when a phone call is finished? Maybe if I try to do another platformRequest while a platformRequest is in execution it returns "false"? I mean, I would want to call notifyPaused method when a phone call is finished.

    Do you have any idea to do that?


    Greetings, and thank you for your help again.

  5. #5
    Registered User
    Join Date
    Sep 2007
    Location
    Bangalore
    Posts
    868

    Re: Resume MIDlet after platformRequest

    Hi,
    If the plat form request finishes it will call notifyPaused() , Notifypaused internally calls to startapp method . You can put some variable over there and come to know like platform request got finished.

  6. #6
    Registered User
    Join Date
    Jan 2009
    Posts
    18

    Re: Resume MIDlet after platformRequest

    Hi Bhanu,

    I don't understand too well. When I test your example the app continues automatically. I mean, my code looks like this:

    startApp(){
    boolean ret;
    for (int i=0;i<3;i++){
    ret = platformRequest("tel:number");
    if (ret)
    //...
    else
    notifyPaused()
    }
    }

    pauseApp method is empty.

    When I run the MIDlet it asks to me if I want to do the phone call. If I answer "yes" the phone begins the call and it asks to me again if I want to do the second phone call while the fist call isn't finished yet, etc... The app don't stop while phone is calling, it still asking to me.

    Because of that I don't understand too well your solution. When platformRequest finish and startApp is called, startApp method starts again from the beginning or from the line where it was interrupted? Where I should check the variable or set its value? How would the code be?


    Best regards, Francisco.

  7. #7
    Registered User
    Join Date
    Jan 2009
    Posts
    18

    Unhappy Re: Resume MIDlet after platformRequest

    Anybody knows how could it be??

    Please help.

  8. #8
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Resume MIDlet after platformRequest

    I'm afraid you cannot reliably tell when the phone call ends.

    Graham.

  9. #9
    Registered User
    Join Date
    Jan 2009
    Posts
    18

    Re: Resume MIDlet after platformRequest

    Hi Graham,

    How would the MIDlet life cycle be when a platformRequest is called? In my code when platformRequest is called and the phone is calling the MIDlet isn't paused, it's asking if I want to do the second phone call so I don't know if the MIDlet should be paused while the device is performing the phone call or not.


    Best regards, Francisco.

  10. #10
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Resume MIDlet after platformRequest

    There is no rule for this.

    Following a successful platformRequest() call, there are two possibilities (depending on the device).

    1. Some devices will launch the phone dialler, browser or whatever immediately, placing the application in the background.

    2. Other devices will do nothing, until the application exits. This is the case on "lower-end" devices that cannot multi-task.

    Which of these will happen is indicated by the return value from platformRequest().

    If (1) happens, then there are many possilities. Some devices will allow applications to execute in the background, others will simple "freeze" them.

    The application might receive a pauseApp() event, followed later by a startApp(). But it probably won't. If the application is displaying a Canvas, the Canvas might receive a hideNotify() event, followed later by a showNotify() event.

    hide/showNotify() events relate to whether the application is on the screen or not. They don't indicate the status of the call (or other external process).

    At the end of the call, the application might be returned to the foreground. Or it might remain in the background until the user switches back to it.

    There is no "call management" mechanism. There are no call-related events.

    Graham.

  11. #11
    Registered User
    Join Date
    Jan 2009
    Posts
    18

    Re: Resume MIDlet after platformRequest

    Hi Graham, thank you for your help.

    In my device the MIDlet continues its execution while it's performing a platformRequest so it's multi-tak, isn't it?
    Is there anyway to monitor the tasks in execution in the device?

    I'm sorry if I'm a tiresome but my final year project depends on it. The MIDlet have to do many actions for instance make a phone call first, later send a sms and finally make another phone call. When I try to do this the MIDlet make the first phone call and it doesn't wait until it's finished and before of that ask me if I want to send the sms and later if I want to do the other phone call. And this is the problem, the MIDlet doesn't wait.


    If I can't do that, thanks anyway. You are very helpful.

  12. #12
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Resume MIDlet after platformRequest

    OK... so you only need to make this work on one phone? And it only needs to work once, when your tutor looks at it?

    In that case, I suggest your best bet is to detect whether your application is on the screen or not. You can do this using isShown(), or if you have a Canvas on the screen, then you will receive hideNotify() and showNotify() events.

    Good luck!
    Graham.

  13. #13
    Registered User
    Join Date
    Jan 2009
    Posts
    18

    Re: Resume MIDlet after platformRequest

    Hi Graham, thank you again for your help.

    Exactly, in my project I have to use NFC. In the Tag, there are many URI record type and the MIDlet only have to make the corresponding actions in that URIs, and when it has made all the actions it finishes. Actions like phone call, sms, open browser..., when an action finishes, the next have to begin and so...

    I will take a look to your idea. Thanks a lot.


    Best regards, Francisco.

  14. #14
    Registered User
    Join Date
    Jan 2009
    Posts
    18

    Re: Resume MIDlet after platformRequest

    Quote Originally Posted by grahamhughes View Post
    OK... so you only need to make this work on one phone? And it only needs to work once, when your tutor looks at it?

    In that case, I suggest your best bet is to detect whether your application is on the screen or not. You can do this using isShown(), or if you have a Canvas on the screen, then you will receive hideNotify() and showNotify() events.

    Good luck!
    Graham.
    Hi Graham,
    I probed your idea but it doesn't work. After the phone asks, begin the phone call and after showing "active incoming call diverts" nothing about a phone call making is shown in the screen so the application is shown again and isShown method returns true.

    When I make a phone call, after "active incoming call diverts" the screen shows the name or the number of the person who is receiving the call, but with platformRequest it doesn't. That's rare.

    Has someone any other idea?

    Best regards, Francisco.

  15. #15
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: Resume MIDlet after platformRequest

    This is the problem. If your application is in the foreground during the call, then you can have no idea when the call ends.

    The only trick might be if you can find something that fails during a call. Playing a sound, perhaps.

    I'm afraid that MIDP is not designed to solve the problem you want.

    Graham.

Similar Threads

  1. launching another midlet using platformRequest()
    By prashantpersistent in forum Mobile Java General
    Replies: 1
    Last Post: 2008-06-20, 11:19
  2. j2me Midlet Verification/Validation Problem
    By Nikolaos in forum Mobile Java Networking & Messaging & Security
    Replies: 5
    Last Post: 2008-06-16, 16:31
  3. Nokia 6101 Locked 2 TMobile Midlet can't access internet...
    By Jason Glass in forum Mobile Java Networking & Messaging & Security
    Replies: 45
    Last Post: 2007-11-14, 02:19
  4. Problem installing MIDLET with platformRequest
    By earamsey in forum Mobile Java General
    Replies: 0
    Last Post: 2005-11-19, 05:37
  5. Correctly pause and resume MIDlet?
    By Terol in forum Mobile Java General
    Replies: 2
    Last Post: 2002-08-05, 06:25

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •