How to close blackberry application programmatically? - blackberry

inside my blackberry application, i redirect the user to a predetermined website. before sending them to the website, i wanted to programatically close the application since there is no longer a need for that app to be open. what class or method can i use to close my application?

System.exit(0);

Related

Delphi Intraweb: Is there a way to open an url in a new tab without the popup behavior?

In an Intraweb (VCL for the web) mobile web application I need to redirect the user to a java webapp. I specify that is a java webapp to stress the fact that it is a completely different thing compared to the intraweb webapp.
I would like to achieve the following behaviour:
the user clicks on a button
the java app opens in the browser and uses it, in particular he uses the mobile keboard to type data
the user taps the phone back button
the intraweb application opens in the browser
In Intraweb as far as I know there are two ways to redirect the user:
Method 1) with WebApplication.GoToUrl(javaAppUrl)
in this way the history is lost so when the user taps on back he is not able to go back to the intraweb application
Method 2) with WebApplication.NewWindow(javaAppUrl)
in this way all seems to work in particular the back button works, but when I try to use the mobile keyboard to type something in the java app the keyboard appears for a moment and then it immediately disappears, I guess this is because somehow NewWindow "Creates a new popup window when executed in the browser context".
NewWindow has also some override methods with different parameters list but no one allows to remove the "popup behavior".
Could you please suggest a way to achieve opening a new webapp in a mobile browser:
keeping the browser history
being able to use the mobile keyboard in the just opened app
?
I use Delphi 10 Seattle, Intraweb 14.2.7 and cgdevtools for the mobile part (cgdevtools anyway plays no role in this issue).
Thank you.
I implemented a workaround by passing in the URL the webapp URL so that in the java URL I display a button that closes the session and redirects the user to the intrawebapp
javaAppUrl:= javaAppUrl + '&BACK_URL=' + WebApplication.FullApplicationURL(WebApplication.Request);
WebApplication.GoToUrl(javaAppUrl);
in this way I have the benefit of GoToUrl (so mobile keyboard works) and I manage to have a back feature with a custom button.
By the way this is still a workaround, I need this since I must release the application, but it is not the perfect solution yet.

How do I avoid the "Open this page in 'appName'" alert from appearing in Safari for iOS?

I am creating a flow that:
1) takes the user from my iOS app to my website through Safari
2) and then navigates back into the app via javascript
However when I try and redirect the user back to my app from my site using url schemes, i get the familiar "Open this page in 'appName'" alert.
Is there a way to avoid this alert from showing up? Is there some way to whitelist my website as a source for my app to allow me to direct the user back to my app w/out any alerts?
It seems like it might be possible with Universal Links, but I am wondering if there is a simpler way to do so.
EDIT: I should have mentioned that I have the unique requirement that I need to use Safari. I am processing donations in my app, and Apple requires you to go this through Safari and not a webview. Any ideas? –
You can achieve this using webView instead of Safari,so that
control will not go out of the App.
Now the problem is how to get the click from webView, for that you can
use this approach
How to invoke Objective C method from Javascript and send back data to Javascript in iOS?
I have integrated this approach in my App so this approach will work for sure. It feels like you are in APP & some times it will diificult to differentiate between WebPage & native page

Phonegap how to come back to app screen and exit from app iOS

I am creating a phonegap application that posts the login information to my website. When user signs off I want to come back to my app. Do I just send the url location along with the post data so that I can come back? or there is another elegant way?
Also when user clicks on the iphone home button, I want the application to exit. Currently it just saves the session and the page and goes back directly to the page if I start the application again.
I am using adobe phonegap site to build and test the application
From your description, I assume that you are navigating the Phonegap WebView (which is running your app) to the URL of your website?
If so, at this point you no longer have an app to navigate back to - the WebView has lost its handle on your app. In order to "navigate back" to your app, you should use the InAppBrowser plugin to navigate to your website. This will allow you to return to your app after the user logs out from your website. You'll need to somehow communicate the logout from your website in the InAppBrowser WebView to your app in its WebView. You may be able to achieve this with cross window messaging.
You can't "exit" an app in iOS - the OS does not allow you to do this. The best you can do is use the resume event to detect when your app has been restored from the background, then manually reset your app to its initial state.

How to resume your app using calaba.sh

I'm using Calaba.sh to to ui testing of my iOS app. I want to be able to test tapping on a link in the app which takes the user to a web address in their browser. I then want to be able to resume the app. Is there a way to do this?
This is not possible in Calabash iOS.

iOS returning from safari (or another app)

My problem is the following: in my app, I need to switch to safari for a login; however, when the user is redirected to my app, I want a specific action to be executed. Is there a way to do that? ViewWillAppear doesn't work, since it's called only the first time the views shows up....
Thanks for the help :)
You could register your iOS app to handle URL scheme 'foo', then invoke or have a link pointing to 'foo://my_custom_launch_action' from your website. When your app launches, you may read the launch options and act accordingly.
I think the official Flickr app for iPhone implements this mechanism to authenticate users through Safari from outside the app.

Resources