Developer

Blackberry Development

Secure Multimedia Playback on Android with BlackBerry Dynamics

BlackBerry Dynamics allows you to secure data in transit using its secure connectivity.  It also provides solutions to secure your data secure while at rest using its secure file system and secure database.  But what about keeping your data secure while it’s in use?

In many scenarios, securing data in use isn’t much of a concern because that data is only briefly stored in RAM only available to your application. But what about large pieces of data, such as audio or video files that are read from flash memory?  If you were to attempt to use a URI in the Android MediaPlayer that points to a video file stored in the BlackBerry Dynamics file system, it will fail to play because the Android MediaPlayer is unable to understand the encrypted file.  Some developers have attempted to work around this issue by copying a media file outside of the BlackBerry Dynamics secure file system for playback, and then delete it when playback is complete.   While this does allow for playback of the file, it does not keep your media files secure.  While that temporary but unencrypted file exists on the regular file system, other applications could gain access to it.

The way to solve this problem, and keep your media files secure is to implement a solution that allows playback directly from the BlackBerry Dynamics secure file system. I’m going to show you a couple of ways this can be done.  One solution will involve creating a custom MediaDataSource that can read from the BlackBerry Dynamics secure file system and provide the Android MediaPlayer with the data it needs for playback.  The second will take a similar approach, but make use of the popular open source media player called ExoPlayer.

Choosing Between Android Media Player and ExoPlayer

If you are creating a new application targeting current versions of Android, the solution that uses MediaPlayer  and MediaDataSource is likely the approach to take.  MediaDataSource was added in API level 23, so it is a relatively new API.  If you need to support older versions of Android, refer to the solution below that uses ExoPlayer, which supports API level 16.  There are some additional elements to consider, which are well described in the Pros and Cons section of the ExoPlayer documentation.

Using Android Media Player

A complete working sample project that uses this solution is available on the BlackBerry Github site here: BDVideoPlayBack

The first step is to extend MediaDataSource and ensure we are using the BlackBerry Dynamics file system APIs.

import com.good.gd.file.File;
import com.good.gd.file.RandomAccessFile;


public class BDMediaDataSource extends MediaDataSource
{
    private RandomAccessFile randFile;
    private long size;
…

Next we create a constructor that accepts a String that contains the path and filename to the encrypted file. In this method, we open the file using the BlackBerry Dynamics file APIs.

public BDMediaDataSource(String fileName) throws IOException
{
    File file = new File(fileName);
    size = file.length();
    randFile = new RandomAccessFile(file, "r");
}

Next there are three methods of MediaDataSource that need to be overridden. The readAt method is used by the MediaPlayer to request a specific portion of the file.  Again, we use the BlackBerry Dynamics file APIs to read and return the requested portion of the file.

@Override
public int readAt(long position, byte[] buffer, int offset, int length) throws IOException
{

    if (randFile != null)
    {
        randFile.seek(position);

        return randFile.read(buffer, offset, length);
    }
    else
    {
        return -1;
    }
}

The next two methods are getSize and close. getSize returns the size of the file.  Note that this is the size of the unencrypted file, which is what is returned by the BlackBerry Dynamics file APIs.  The final method is close, which is called when the file should be closed.

@Override
public long getSize() throws IOException
{
    return size;
}

@Override
public void close() throws IOException
{
    if (randFile != null)
    {
        randFile.close();
        randFile = null;
    }
}

BDMediaDataSource is now ready to be used with MediaPlayer. The following code snippet demonstrates how that can be done.

MediaPlayer mp = new MediaPlayer();
BDMediaDataSource source = new BDMediaDataSource("file.mp4");
mp.setDataSource(source);
mp.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
    @Override
    public void onPrepared(MediaPlayer mp) {
        mp.start();
    }
});
mp.prepareAsync();

Using ExoPlayer

A complete working sample project that uses this solution is available on the BlackBerry Github site here: ExoPlayerVideoPlayBack

The solution that uses ExoPlayer has a very similar design to what was done using Android Player above. For ExoPlayer, we extend DataSource, which is used to provide data that will be played back and use the BlackBerry Dynamics file system APIs to read the securely stored media files.  An empty constructor is also defined.

import com.good.gd.file.GDFileSystem;
import com.good.gd.file.FileInputStream;

public final class BDDataSource implements DataSource
{

    private FileInputStream inputStream;
    private boolean fileOpen;
    private Uri filePath;
    private long bytesRemaining = 0;

public BDDataSource() {}

Next we override the open method, which passes in the file to be opened. In this method, we initialize FileInputStream that will be used to read the data.

@Override
public long open(DataSpec dataSpec) throws IOException
{
    filePath = dataSpec.uri;
    //Trim "file:///" that's prefixed to the start of the URI.
    inputStream = GDFileSystem.openFileInput(filePath.toString().substring(8));

    if ( inputStream != null )
    {
        fileOpen = true;
        bytesRemaining =  inputStream.available();
    }

    return bytesRemaining;
}

The next method to override is the read method, where we use the FileInputStream initialized in the open method to read the file at the desired position.

@Override
public int read(byte[] buffer, int offset, int readLength) throws IOException {
    if (bytesRemaining == 0)
    {
        return -1;
    }
    else
    {
        int bytesRead = 0;
        bytesRead = inputStream.read(buffer, offset, readLength);

        if (bytesRead > 0) {
            bytesRemaining -= bytesRead;
        }

        return bytesRead;
    }
}

The getUri method is also overridden and returns the path to the file in the BlackBerry Dynamics file system.

@Override
public Uri getUri() {
    return filePath;
}

The final method overridden is the close method, that closes the FileInputStream and underlying file when playback ends.

@Override
public void close() throws IOException {
    filePath = null;
    if (inputStream != null)
    {
        try
        {
            inputStream.close();
        }
        catch (IOException e)
        {
            throw new IOException(e);
        }
        finally
        {
            inputStream = null;
            if (fileOpen)
            {
                fileOpen = false;
            }
        }
    }
}

The code sample below shows how BDDataSource could be used as a DataSource by ExoPlayer.

SimpleExoPlayer player;

// 1. Create a default TrackSelector
BandwidthMeter bandwidthMeter = new DefaultBandwidthMeter();
TrackSelection.Factory videoTrackSelectionFactory =
        new AdaptiveVideoTrackSelection.Factory(bandwidthMeter);
TrackSelector trackSelector =
        new DefaultTrackSelector(videoTrackSelectionFactory);

// 2. Create a default LoadControl
LoadControl loadControl = new DefaultLoadControl();

// 3. Create the player
player = ExoPlayerFactory.newSimpleInstance(v.getContext(), trackSelector, loadControl);

// Bind the player to the view.
simpleExoPlayerView.setPlayer(player);

// Produces DataSource instances through which media data is loaded.
DataSource.Factory dataSourceFactory = new BDDataSourceFactory();

// Produces Extractor instances for parsing the media data.
ExtractorsFactory extractorsFactory = new DefaultExtractorsFactory();

// This is the MediaSource representing the media to be played.
Uri uri = Uri.fromFile(new File("file.mp4"));

MediaSource videoSource = new ExtractorMediaSource(uri,
        dataSourceFactory, extractorsFactory, null, null);

// Prepare the player with the source.
player.prepare(videoSource);

Wrapping Up

Both samples provide similar solutions that you can use from Android API level 16 through to current versions of Android. Give them a try and make sure your data is secure when in transit, at rest and in use.

 

Need Development Help? The BlackBerry Developer Community Forum has your Answer…Join the conversation, engage with peers, share ideas, and get your app development questions answered. Developer Community Forum


Source: Developer Blackberry

Updated Samples: BlackBerry UEM 12.6 Web Services

BlackBerry Web Services for BlackBerry Unified Endpoint Management (UEM) allows administrators and developers to securely perform automated tasks via C#/Java/PowerShell/REST calls, instead of interacting directly with the UEM administration console. These calls allow you to streamline the organization and management of your UEM domain and the users/devices within it.

With the recent release of BlackBerry Unified Endpoint Management 12.6 (which was formerly known as BES), the capabilities of the BlackBerry UEM Web Services offering has been expanded to include additional functions and improved usability for developers leveraging RESTful calls. BlackBerry UEM Web Services are a collection of REST APIs that you can use to create applications to manage your organization’s environment. You can use the BlackBerry UEM Web Services to automate many of the tasks that administrators typically perform using the management console. For example, you can create an application that automates the process of adding user accounts to the domain.

If you’re new to BlackBerry UEM Web Services or interested in leveraging its functionality, complete product documentation and development guides can be found at: https://help.blackberry.com/en/blackberry-web-services-for-blackberry-uem/12.6/

Additionally, the API Reference can be found at: https://developer.blackberry.com/files/bws/reference/bes12/

The updated sample applications demonstrating how to use BlackBerry UEM Web Services are available within the BlackBerry GitHub repository at github.com/blackberry/BWS-Samples.

 

Need Development Help? The BlackBerry Developer Community Forum has your Answer…Join the conversation, engage with peers, share ideas, and get your app development questions answered. Developer Community Forum


Source: Developer Blackberry

Your workforce wants to be mobile – and with good reason

Research conducted in 2016 by Forbes Insights (Link to PDF) shows that when employees have access to enterprise mobile apps, great things happen.  Productivity increases with employees completing tasks from any location.  Collaboration with customers improves, boosting sales and loyalty.  And profitability improves as employees are more productive and customers stay loyal.

So, why doesn’t every organization have the mobile app advantage?  The research found that security and compliance, legacy systems and lack of resources where the key impediments to mobilizing workforces.

The BlackBerry Application Platform helps you address all three challenges.  BlackBerry understands enterprise needs so as a developer you’ll be building your solutions with hardened enterprise grade components many of which have NIAP certifications.  We understand that building the right mobility solution is important but so is building it quickly.  Our platform can do the heavy lifting while you focus on delivering business value.

Learn more on how to get the app advantage by registering for the Enterprise Apps Newsletter or, or discover through our marketplace secure feature-rich solutions with our full catalogue of enterprise apps that are ready to go.


Source: Developer Blackberry

LIVE Enterprise Developer Webcast: Secure Multimedia Playback for Android Apps with BlackBerry Dynamics

Join us! for the this LIVE BlackBerry Enterprise Developer Webcast to learn how to keep all of your media content data secure while it’s at Rest and in Use.

Learn how you can play audio and video files stored in the BlackBerry Dynamics secure file system without the need of copying to a temporary, intermediate unsecure location.

In this Webcast we will demonstrate and walk through the code you can replicate for two different examples in which this can be done:

1:  Uses a custom MediaDataSource for playback using the Android MediaPlayer.

2:  Uses the popular open source ExoPlayer media player with a custom ExoPlayer DataSource.

WHEN: April 27, 2017 at 11:00 AM ET

Register for this Webcast HERE.

 

Need Development Help? The BlackBerry Developer Community Forum has your Answer…Join the conversation, engage with peers, share product ideas, and get your app development questions answered. This free BlackBerry Developer Program resource allows you to be part of a Developer Community that is at the center of all the information you’ll need to stay connected with the World’s leading Secure Development Platform for Enterprise. Read more about the Developer Community on our blog, and we encourage you to follow the Developer Community forum and join the conversations happening right now.


Source: Developer Blackberry

How to Implement a Managed App Configuration for iOS via BlackBerry UEM

Setting up the Application Configuration for a managed iOS app enables IT admin of a MDM Server such as UEM, to send properties to the app. For UEM this gives the Administrator the ability to push down enterprise data or configurations as custom and/or default variables. A managed iOS application accesses the information using the UserDefaults class. This lets IT admin configure apps remotely for their enterprise users and app developers. Instead of users configuring the app manually after they install the app. On UEM, you can check the list of default variables here and custom variables here.

Default variables are preconfigured on the server such as %AccessKeyExpiry%, which tells the app date and time that an access key expires.

When information is not available by default variables you can use Custom Variables. For example, if the admin wants to specify a VPN password in the app, which is different for every use, he can use a Custom Variable.

Note – Default variables are set per app but Custom Variables are set per user.

Here are example use cases. It is common for enterprise applications to require a username and Application Server address. The admin can send the username and application server address to a UEM managed iOS app using the default variables. The administrator can also configure customizable values, which are set per user. These fields are required for one time setup of the application, so the user does not have to call IT to get their username and specific server information, reducing stress on the Help Desk or IT department.

Here are the steps to configure UEM for the iOS Managed App Configuration

  • To use Default variables –
  1. Login to UEM. Go to Apps and click (add an app) to add a new App. Select the Internal apps icon to upload your managed app’s ipa file.
  2. After you have uploaded the app, Click the App and then Settings and go to App Configuration.

3. Click + and then Configure manually.

4. Click + and then set as String.

5. Add the desired key and the value from the default variables. Enter the App configuration name and click Save. Save again to save the configurations.

  • To use Custom variables –
  1. Login to UEM. Go to Settings, then General settings and then Custom Variables. Add the variable label to a variable name and then Save.

 2. Now, go to Users and open the desired user and then click  and go to Custom variables. Add the value of the custom variable and then Save.

3. Go to apps and select the app and change the app configuration as you did with the Default variables but instead of the default variable just add the custom variable.

Here is how to access the variables in Swift –

Here is what the app looks like:

Note – UEM Application Configuration is different from BlackBerry Dynamics app policy as UEM Application Configuration needs a MDM managed device.

Debugging Tip – Make sure the app is pushed down from the UEM Server the first time and never change the Bundle Identifier but you can rebuild the app on the device to keep accessing the variables on the UEM Server. If changes are made to the variables on the UEM server, either wait for the configurations to be pushed down to the device or upload the ipa again to the UEM server push down the app.

Happy Coding!

 

Need Development Help? The BlackBerry Developer Community Forum has your Answer…Join the conversation, engage with peers, share product ideas, and get your app development questions answered. Developer Community Forum


Source: Developer Blackberry

BlackBerry Developer Summit Europe

Watch the Developer Summit Europe video HERE!

At the BlackBerry Developer Summit Europe, in London on March 14, developers from our customers and partners participated in hands-on coding session with our top engineers who were eager to help.  Developers from across Europe, as well as from India and Israel, took advantage of all the experts with many conversations happening in the training session and experts lounge.

We listened to developer feedback from our New York Summit and created Beginner and Advanced tracks to cover all our SDKs to leverage the expanded platform including the BlackBerry Dynamics SDK, BBM Enterprise SDK, and Workspaces SDK. Virtually every aspect of the platform was covered, including App Configuration, Secure Storage and Communication, Enterprise Server Authentication, Application Policies, Inter-App Communication, BlackBerry Enterprise Mobility Server Services (BEMS), Launcher User Interface and Wearables. The content was well received with much excitement around the BBM Enterprise SDK. With an early access SDK, developers were able to create real examples.

We saw a thriving ecosystem, with both our enterprise customers and partners eager to learn and get a first-hand experience with the platform.  In surveying attendees at the end of the event, developers scored the overall event 5.2 out of a scale of 6. Additionally, when asked “What is the likelihood that you recommend a future BlackBerry Summit to a colleague?” attendees scored this 5.3 out of 6, with half of the respondents giving the highest possible score. Overall, terrific results from our first European Developer Summit.

We’re continuing the journey with our developer community.  Join our developer program to get the tools, resources and support need to build transformative enterprise applications at http://developer.blackberry.com/enterprise .  Our experts and the community is ready to help in our community support forums.


Source: Developer Blackberry

Why do BlackBerry Dynamics Apps Matter?

 

Business Benefits

BlackBerry Dynamics is architected to give IT fine-grained control of applications. IT admins provide entitlement and provisioning of apps to users which can be revoked at any time. IT compliance policies determine which device models, operating systems and operating system versions are permitted in the corporate environment. Security policies set required password characteristics, idle timeout values and data leakage prevention controls. Custom per application policies can be provided by developers and used by admins. Detection of jailbroken or rooted devices is built into the SDK library. Security enforcement is available to the admin with the ability to lock or wipe applications.

Corporate assets accessed by mobile devices are protected. Data and applications are protected while in use by the BlackBerry Dynamics APIs. Data at rest within an app and in transit between the app and company repositories is encrypted. If a device is lost or stolen, the applications and data can be effectively removed.

 BlackBerry Dynamics is sufficiently flexible to handle all user models. Bring Your Own Device, Corporate Owned Personally Enabled and Choose Your Own Device are all supported. To enable these models, management is done at the application level.

Development Benefits

 Platform built-ins of BlackBerry Dynamics reduce the development cost of securing apps. User identification and authentication are implemented in the SDK library requiring no programmer coding. The BlackBerry Dynamics infrastructure provides a secure tunnel to enterprise resources behind the firewall. No VPN is needed. The infrastructure components including the Network Operating Center and servers are hidden from the developer. The servers are designed with high availability and disaster recovery capabilities.

The BlackBerry APIs are designed for ease of development and security. They are similar to their native counterparts implementing secure, encrypted versions of familiar functionality: file system, database, core data (iOS only), HTTP/S and sockets. The encryption is FIPS 140-2 compliant and includes TLS and AES. The APIs are designed to be swappable with the native APIs or require little to no changes of the code.

These capabilities enable the developer to focus on the user experience and business processes with security and enterprise readiness provided by BlackBerry Dynamics. Reusable shared services allow apps to be built faster and cheaper with increased user stickiness. The Services framework simplifies app interactions in business workflows.

Visit our Developer Website to get started developing secure Apps with BlackBerry Dynamics.

Visit our Marketplace for Enterprise Software for ISV built Apps ready to go, developed using the BlackBerry Dynamics SDK.

 

Need Development Help? The BlackBerry Developer Community Forum has your Answer…Join the conversation, engage with peers, share product ideas, and get your app development questions answered. This free BlackBerry Developer Program resource allows you to be part of a Developer Community that is at the center of all the information you’ll need to stay connected with the World’s leading Secure Development Platform for Enterprise. Read more about the Developer Community on our blog, and we encourage you to follow the Developer Community Forum and join the conversations happening right now.


Source: Developer Blackberry

Join our Live Chat and Watch the Webcast for Creating secure, cross-platform, enterprise applications using the new BlackBerry Dynamics Plugins for Cordova

Join us for an Office Hour Q&A where you can follow up with your questions from this webcast. This will be held live in the Developer Community Forum this Wednesday April 5th starting at 11am until 12pm EDT. Our experts will be online to discuss this development topic.

Watch this webcast, where a member of the BlackBerry Solution Architect team guides you through an interactive journey on how to quickly secure your application using the new BlackBerry Dynamics Plugins for Cordova. We’ll be covering everything from Getting Started with the tools, setting up your environment, debugging, and most importantly working with the Plugins. Whether you’re new to BlackBerry Dynamics development, or a veteran, this coding demo will offer you an inside perspective on how to quickly and efficiently build apps using our Cordova Plugins.

Webcast: Creating secure, cross-platform, enterprise applications using the new BlackBerry Dynamics Plugins for Cordova

  • Installation & Configuration of the tools
  • Integrating the BlackBerry Dynamics Plugins
  • Testing & Deploying
  • Key Development Resources

Watch the Recorded Webcast HERE

 

Need Development Help? The BlackBerry Developer Community Forum has your Answer…

Join the conversation, engage with peers, share product ideas, and get your app development questions answered. This free BlackBerry Developer Program resource allows you to be part of a Developer Community that is at the center of all the information you’ll need to stay connected with the World’s leading Secure Development Platform for Enterprise. Read more about the Developer Community on our blog, and we encourage you to follow the Developer Community forum and join the conversations happening right now.


Source: Developer Blackberry

Developer Support Forums Moving

Although we’re moving the BlackBerry 10 and BBOS developer support forums, we’re keeping all the great content created over the years!

We’ll keep all the support forum posts, responses and the knowledge base articles.  Our goal is to make this an easy transition for our developer community.

Starting April 1, 2017, you will no longer be able to log into the old support forums.  On Monday April 3, 2017, the new support forums will be available on the same underlying technology supporting our enterprise developers.

We will update this blog post on Monday with the details on how to access the developer support forums.


Source: Developer Blackberry

BlackBerry Dynamics for iOS: Two Targets in One Xcode Project

When you integrate your existing app with the BlackBerry Dynamics SDK, you will need to create a separate version of your app with the BlackBerry Dynamics SDK. Depending on the complexity of your app, there are two routes you can consider for the source code management.

  1. Manage two separate source repositories/branches, one with the BlackBerry Dynamics APIs and another one without.
  2. Create two different targets of an iOS project and build two different IPAs.

I have a simple trick how to achieve the second option above and would like to demonstrate in the following steps. Setting up two targets in a project is useful when creating two IPAs from one project.

After following the steps, you will be able to create two different targets of a project, one with BlackBerry Dynamics SDK integrated and other without BlackBerry Dynamics SDK.

  1. Duplicate the target.

2. Change the Bundle Identifier of the duplicated target.

 

3. For Objective-C

a. Go to Build Settings and search for Preprocessor Macros.

b. Add the value DEVELOPMENT=0 in Debug and Release in the original target and DEVELOPMENT=1 in Debug and Release in the duplicated target.

4. For Swift

a. Go to Build Settings and search Swift Complier.

b. Add the value –DDEVELOPMENT to Other Swift Flags to only one of the targets and not both.

 

5. You can change some additional Build Settings, Info settings.

6. This is how to detect which target is build.

7. You can add new files to a specific target.

That’s it for now… Happy Coding!

 

Need Development Help? The BlackBerry Developer Community Forum has your Answer…

Join the conversation, engage with peers, share product ideas, and get your app development questions answered. This free BlackBerry Developer Program resource allows you to be part of a Developer Community that is at the center of all the information you’ll need to stay connected with the World’s leading Secure Development Platform for Enterprise. Read more about the Developer Community on our blog, and we encourage you to follow the Developer Community forum and join the conversations happening right now.

 


Source: Developer Blackberry

These events allow to you to share time with other replica watches sale watch lovers as well as learn about what the brands are up to. In the process, you'll get treated to rolex replica sale fabulous dinners, meet celebrities, receive gifts, and feel like a valued customer who the brands really want to rolex replica sale have a relationship with. Depending on where you live and the brands you like to purchase from, these events can be quite frequent, and also really fun. Their value should not be underestimated, and again, if you don't purchase rolex replica sale watches in an "official manner" you'll never be included. Personally, I have to say that while I don't like spending more money than I need to, the value of these above unexpected benefits, in many instances, can make up for the discounts replica watches available at gray market retailers when you want to buy a new watch. In a sense, each time you rolex replica sale purchase a high-end timepiece, you are designating yourself as part of a elite group of replica watches sale people who have the appreciation and resources for luxury items.