12-06-2012 02:26 AM
I am facing a problem while calling BlackBerryContactList.choose() from background applicaiton (Applicaiton) nothing is happening.
Bellow is code
BlackBerryContactList list = (BlackBerryContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
PIMItem choose = list.choose();
While calling it from a UI applicaiton is working fine but same is not working while calling from Background applicaiton.
Please help me...
Solved! Go to Solution.
12-06-2012 05:00 AM
Doesn't this popup a list for the user to choose from? If so, how do you expect that to work from a background application?
12-06-2012 06:41 AM
Actually i am having a background applicaiton which will prompt the user to add to MDN to adress book if that is not in address book in that case i want to call choose to tack a selection via user.
This complete operation is managed by Background applicaiton.
Invoke.invokeApplication(Invoke.APP_TYPE_ADDRESSBO
12-06-2012 08:18 AM
The invocation will be fine from a background application because it starts a completely separate application that is not related at all to your current application. But in the choose you want to pop up a screen for the user and keep control of this processing. I don't think you are going to be able to do this from a background application that has no screen.
I am not actually clear on what you are trying to do. You are prompting the user to add MDN (what is MDN?) to the address book - presumably that is how you are using the invoke. But be aware that your application does not stop while this happening. In other words if you test that a user is not present, use invoke to get the user to add it, and then immediately after the invoke, check if the user is there, it will NOT be there, regardless of what the user does on the Address book screen that you have invoked. Does this make sense?
I don't get the second part. If it is not in there, then the user has to choose another what? I don't understand "tack a selection via user"
12-07-2012 04:50 AM
MDN is actually a mobile no.
My Applicaiton flow is when user gets a call then at call end my Background applicaiton will check in addressbook and if that mobile no is not there then will ask user do you want to add this contact to your addressbook with 2 options
As as new contact or Add to existing contact. Here my first case if fine because in that i need to user directoly invoke but in 2nd case i need to first tack the user contact selection. For that i need to call choose and that is not working.
Please suggest a way to achive the same.
12-07-2012 09:57 AM
Let us start at the beginning. How are you doing this?
"will ask user do you want to add this contact to your addressbook with 2 options"
12-08-2012 12:28 AM
That dialog i am colling from UI.getUIEngine.pushModleScreen(dialog, ..., Globle_Queue);
Then once user selects option Add to a existing contact then i want to call choose method.
12-08-2012 11:28 AM
This Dialog runs separately from your Application. It is not actually part of your Application. It is a Global screen. This will work fine.
However to use the choose Dialog, I think you will have to get control back into your application and, as you have found, I think you will need to bring your application to the foreground in order to make sure that he choose Dialog is shown. This means you are going to have to run a UiApplication, not an Application.
To make sure this Application can not bought to the foreground accidentally, you can set acceptsForeground() to false.
But when you want to use the choose Dialog, you will need to have this method return true, and then bring your Application to the foreground. When you get the response to the choose, you can set it to false, and take your application to the background again.
I suggest while you are developing this you just create a standard UiApplication, and get it working like that. Then try simulating a background application by adjusting acceptsForeground() at appropriate times.
Since your application will in fact be a UiApplication, I suggest that you do have a screen associated with it too. A simple splash screen will do.
Hope this helps.
PS> There is a small chance that you can requestForeground on your Application when you invoke the choose method and it will display. Try it. But I won't be surprised if it fails.