BBOS (pre BB10) Launching App through Intents (Like Android) - url

I would like to know if I can develop an application in BB OS (4 - 7) with similar functions to Android/iOs where ;
I would be able to register the app to listen for specific URL's.
I can launch the app via URL.
I can parse data from the URL and use in the app.
For instance in Android I can use Intent Filters like this
<intent-filter>
<action android:name="android.intent.action.VIEW"></action>
<category android:name="android.intent.category.DEFAULT"></category>
<category android:name="android.intent.category.BROWSABLE"></category>
<data android:scheme="http"
android:host="myapp.com"
android:pathPrefix="/launchapp/" />
</intent-filter>
to launch the app upon laoding a url such as
i can then parse the two numbers after launchapp/ and use them within the application.
Anyone experienced with BB OS know if this is possible?

I am not aware about documented listeners to intercept opened URLs. But there is GlobalEvent mechanism. Almost every step doing on pre-BB10 OS fires one or more global events. Some of them are documented, some not.
There are documented GUID's listed: http://www.blackberry.com/developers/docs/7.0.0api/index-files/index-7.html (look for G letter, and scroll down for GUID_xxxx constants).
To catch undocumented GUIDs, implement a background application, that uses GlobalEventListener. Then open a page in browser and log all global event guids and objects which come along with guids to eventOccurred call. And you can find out, which global event guids are related to url-open event. It will help to create URL interception mechanism. And this part should be a native application (written on Java).
It is possible to launch application via url, but it should be WebWorks application. Not a native one. Check this link: http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Launch-BlackBerry-WebWorks-app-via-URL-with-parameters/td-p/1674663
When your webworks application has done its part of work, it can fire GlobalEvent and your native app will wait for it to intercept it and work further.

There are some ways of doing this on BBOS depending on what exactly you want.
Create a browser plugin using the net.rim.device.api.browser.plugin API. Here you create a BrowserContentProvider and attach it to the BB browser for handling a particular mime type. This mime type must be unique to you that is not being handled by the native browser (say x-vnd-whatever/myapplauncher) . When the browser access your url, say http://myapp.com/launchapp/233, serve a file with the number 233 and the registered mime type. The browser will download the file, see its mime type and then pass the file content to your plugin for handling. Your plugin will read the app id - 233 and then do whatever you want with it. BlackBerry App World uses this method to allow developers to launch their app in app world from a url.
Create a HttpFilter. Using this, you can make connections to a given domain pass through your code. Here you will register your filter for your domain myapp.com and whenever someone tries to access any myapp.com, the browser will call your filter to handle the request. Again BlackBerry App World does this for access to http://appworld.blackberry.com domain. [There is a HttpFilterDemo in the samples to help you]
Use the StringPattern API. Almost all native text fields support it. So if there is a text field with text written that matches a particular pattern it will become underlined and clicking on it will show your custom actions in the Menu. [There is a StringPatternDemo in the samples to help you]
If your app is in App World and you just want to launch it, use the URL http://appworld.blackberry.com/webstore/content/xxxx where xxxx is your app's content id.
Moreover, there is no use trying anything with Global Events. Since OS 4.5, the global event broadcast mechanism has been partitioned in such a way that the system events are only delivered to system applications and not to their party apps and vise versa.
Hope this helps.

Related

How to open my iOS App with custom URL scheme in Swift 3?

I need to open my particular UIViewController when the following link is clicked on the Safari browser:
http://my.sampledomain.com/en/customer/account/resetpassword/?id=24&token=8fbf662617d14c10f4a11f716c1b2285
When this link is clicked on the browser, I need to open my application on a particular screen and retrieve the data from this url. For example:
id = 24
token = 8fbf662617d14c10f4a11f716c1b2285
...and pass it to that particular UIViewController.
How can i do that?
What you are describing is called Deep Linking. It's a very common app feature to implement — most apps have it — and conceptually, it seems like an easy thing to build. However, it's complicated to get right, and there are a lot of edge cases.
You basically need to accomplish two things:
If the app is installed: open the app and route users to the correct content inside it.
If the app is NOT installed: forward users to the App Store so they can download it. Ideally, also route users to the correct content inside the app after downloading (this is known as 'deferred deep linking').
While not required, you'll also probably want to track all of this activity so you can see what is working.
If the app is installed
Your existing custom URI scheme fits into this category. However, Apple has decided that custom URI schemes are not a good technology, and deprecated them with iOS 9 in favor of Universal Links.
Apple is right about this. Custom URI schemes have a number of problems, but these are the biggest:
There is no fallback if the app isn't installed. In fact, you get an error.
They often aren't recognized as links the user can click.
To work around these, it used to be possible to use a regular http:// link, and then insert a redirect on the destination page to forward the user to your custom URI scheme, thereby opening the app. If that redirect failed, you could then redirect users to the App Store instead, seamlessly. This is the part Apple broke in iOS 9 to drive adoption of Universal Links.
Universal Links are a better user experience, because they are http:// links by default and avoid nasty errors. However, they are hard to set up and still don't work everywhere.
To ensure your users end up inside the app when they have it installed, you need to support both Universal Links and a custom URI scheme, and even then there are a lot of edge cases like Facebook and Twitter which require special handling.
If the app is NOT installed
In this case, the user will end up on your http:// fallback URL. At this point, you have two options:
Immediately forward the user directly to the App Store.
Send the user to your mobile website (and then use something like a smart banner to give them the option of going to the App Store).
Most large brands prefer the second option. Smaller apps often go with the first approach, especially if they don't have a website.
To forward the user to the App Store, you can use a Javascript redirect like this:
<script type="text/javascript">
window.onload = function() {
window.location = "https://itunes.apple.com/app/id1121012049";
};
</script>
Until recently, it was possible to use a HTTP redirect for better speed, but Apple changed some behavior in Safari with iOS 10.3, so this no longer works as well.
Deferred deep linking
Unfortunately there's no native way to accomplish this last piece on either iOS or Android. To make this work, you need a remote server to close the loop. You can build this yourself, but you really shouldn't for a lot of reasons, not the least of which being you have more important things to do.
Bottom line
Deep linking is very complicated. Most apps today don't attempt to set it up by building an in-house system. Free hosted deep link services like Branch.io (full disclosure: they're so awesome I work with them) and Firebase Dynamic Links can handle all of this for you, and ensure you are always up to date with the latest standards and edge cases.
See here for a video overview an employee at Branch made of everything you need to know about this.

How to share a link from the app using other applications

I want to share a link from my app using other applications installed on my iPhone such as Gmail, Facebook, DropBox, WhatsApp etc. In android there is a straight way to do so, just fire an intent and it automatically shows the installed apps through which we can share whatever we want. Is there any such way in iPhone ?
Thanks!
On iOS , app is more separated from each other. The only way to pass data from one app to other is using the URL mechanism. As one example, an app register url scheme "open-me://",you invoked openURL with "open-me://my-link" then that app will launched. That app will define the detail of the URL so it could understand the content.Continue with the example we are using, the text you passed could be either "open-me://A?data=my-link" or "open-me://A?message=my-link". So there are no general solution for all apps.Typically third party app will provide a SDK to make these things easy.
If you don't mind using a kind of large third party library, ShareKit is a good choice. It supports quite some apps.
If you want to know more about this topic,for example sharing files between app. You could start from reading the class reference of UIDocumentInteractionController.This UI component will show a list of app installed on your device which support the URL scheme.

forcing a file to open in predefined application in iOS

I am trying a simple web app which downloads files from internet and saves on iPad. Theses files are of .pdf,.xls,.doc, etc format. Now, I want to assign a default application to open a specific file type. (Say Adode reader for pdf file, Some image viewer app for image files etc). I dont want my app/os to decide which app the file should open in. Instead, if assigned app doesnt exists then it should give me a message that no such app found. Is it possible to do?
With a web app you cannot do such things.
If you go native, you can use Custom URL Schemes (see http://developer.apple.com/library/ios/#DOCUMENTATION/iPhone/Conceptual/iPhoneOSProgrammingGuide/AdvancedAppTricks/AdvancedAppTricks.html)
But with Custom URL Schemes, you only are able to pass a view parameters. If you want more, UIPasteboard is recommended.
Apps are sandboxed. You cannot access other apps, nor their data!!!
But on native apps you can pass over data with pasteboard, call a custom url handler, pass a few parameters to cause the other apps to process your data.
Often App developers, like camera+ offer a documentation for the usage of their custom url schemes (Camera+ URL Schemes API)

Possible to launch an iOS app from a web link

My app bounces the user out of the app into safari to do some web things (toying with using a webview but there are other concerns regarding layout, usage, re-launching the app, server errors, etc.). When they are done I would like a link on the final web page that lets them re-launch the app. I think this should be possible through a protocol implementation of some sort (such as href="myAppProtocol://relaunch") but I don't know how to go about implementing it properly.
[UPDATE] (can't answer my own question yet so editing here)
Stumbled across this just after posting (hours of looking and this is always how it comes together...) http://mobileorchard.com/apple-approved-iphone-inter-process-communication/
Using a URL type handler in your plist (as I suspected) you can declare that your app handles urls of that type (say "myAppProtocol"). iOS then launches your app and hands it the URL when it's touched in safari. What you do from there is up to you, I just need to launch so I don't take it any further, but you could grab the URL and parse it out for further passed information etc.
I guess you found the answer already, but have a look at the docs as well: Using URL Schemes to Communicate with Apps.

On blackberry : making a phonecall within an app on user action without J2ME?

Is there a way of making a phonecall within an application using Browser application development ? (for example using a link with a protocol similar to 'mailto:user#example.com' but that would make phonecalls instead of sending mails.)
If not, is it possible to make phonecalls using the Rapid application development ?
If this an app hosted in a browser, Blackberry respects WAP conventions for encoding a phone number.
Here's an example snipppit for displaying a number that is callable via a Blackberry device:
<a href='wtai://wp/mc;5551231367' title='Call'>555.123.1367</a>
I've been using this approch for some time now and it works for me. When the user clicks the link, a dialog from the OS pops up and asks if you would like to call this number.
Additional Information
I also recommend checking out Blackberry's additional resources on development. Since the current browser is still in the stone age compared to iPhone/Android it's worth seeing what's possible.
http://na.blackberry.com/eng/support/docs/subcategories/?userType=21&category=BlackBerry+Browser

Resources