How to open a url in Blackberry Access from an Android app

970 views Asked by At

I have successfully opened the blackberry access from our IOS app using the url scheme access://open? , but it seems to be not working on Android. Our application is not integrated with blackberry sdk .

2

There are 2 answers

1
Rango On BEST ANSWER

For anyone who needs it you can open the blackberry access from your app using the blackberry access appid com.good.gdgma.

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setData(Uri.parse(urlString));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    intent.setPackage("com.good.gdgma");
    try {
        getApplicationContext().startActivity(intent);
    }
    catch(ActivityNotFoundException ex) {
        showNotInstalledDialog(App.BLACKBERRY_ACCESS);
    }
1
MSohm On

There is a setting the in application configuration policy for BlackBerry Access that enables or disables this feature. It's called "Allow external apps to open HTTP/HTTPS URLs through BlackBerry Access" and is set for the app config for BlackBerry Access within BlackBerry UEM. This setting applies to all non BlackBerry Dynamics methods of opening BlackBerry Access.

If you were to integrate with the BlackBerry Dynamics SDK the recommended method is to use the BlackBerry Dynamics Shared Services framework to call the Open HTTP URL Service. It's available for both iOS and Android. Here's some Android sample code to use it.

Here's a code snippet that does just that:

private static final String SERVICE_ID = "com.good.gdservice.open-url.http";
private static final String SERVICE_VERSION = "1.0.0.0";
private static final String ACCESS_ENTITLEMENT_ID = "com.good.gdgma";
private static final String HTTP_OPEN_URL_SERVICE_METHOD_NAME = "open";

....

//Get the service providers for the Open HTTP URL service.

List<GDServiceProvider> providers = GDAndroid.getInstance().getServiceProvidersFor(SERVICE_ID, SERVICE_VERSION,
        GDServiceType.GD_SERVICE_TYPE_APPLICATION);

//Ensure an provider of the Open HTTP URL service was found.
if(providers == null || providers.size() == 0)
{
    //No providers found.
    showError("No Open HTTP URL were found.");
}
else
{
    boolean foundAccess = false;
    String yourURL = "www.whereEverYouWantToGo.com";
    for (int count = 0; count < providers.size(); count++)
    {
        GDServiceProvider provider = providers.get(count);

        //Ensure BlackBerry Access was found.
        if (provider.getIdentifier().equalsIgnoreCase(ACCESS_ENTITLEMENT_ID))
        {
            foundAccess = true;

            String address = providers.get(count).getAddress();
            Map<String, Object> params = new HashMap<>();
            params.put("url", yourURL);

            try
            {
                //Launch BlackBerry Access.
                GDServiceClient.sendTo(address, SERVICE_ID, SERVICE_VERSION,
                        HTTP_OPEN_URL_SERVICE_METHOD_NAME, params, null,
                        GDICCForegroundOptions.PreferPeerInForeground);
            } catch (GDServiceException e)
            {

                showError(e.toString());
            }
        }
    }

    if (!foundAccess)
    {
        showError("BlackBerry Access not found.");
    }
}