Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Web and WebWorks Development

Reply
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Construct 2 + Webworks SDK 2.0

[ Edited ]

Now available as a KB:

http://supportforums.blackberry.com/t5/Web-and-WebWorks-Development/Porting-Your-Existing-Construct-...

 

 

 

Hello all, this is intended as an update to the information available here:

https://developer.blackberry.com/html5/documentation/gold/porting_construct_2_games_to_blackberry_10...

 

This will be converted to a KB soon and subsequently the information at the URL above will be updated. But for the time being I wanted to make this information available here as well.

 

If any errors are found or questions arise, please feel free to comment on this thread or contact eoros@blackberry.com directly.

 

The information within assumes familiarity with Construct 2; up to the point that you are able to develop your application and are now ready to export your project for various platforms.

 

BlackBerry 10 WebWorks SDK

 

You can download the most recent version of the BlackBerry 10 WebWorks SDK here:

https://developer.blackberry.com/html5/download/

 

This will enable a number of command-line (CLI) tools that you can leverage to register your code signing keys and make available the webworks command via CLI, enabling you to create new projects, deploy to devices, and build release versions of your application.

 

For those familiar with phonegapwebworks is another Cordova-based variation. The benefit of using the BlackBerry 10 WebWorks SDK directly is that your environment is automatically configured to build for BlackBerry 10 without the need for any additional configuration. Both Cordova and Phonegap are valid tools, though you will need to follow the corresponding platform guides to configure your development environment.

 

Code Signing Keys

 

If you have already registered your BlackBerry Code Signing keys, you do not need to take any action. In the future, BlackBerry Code Signing will be completely BBID-based, so if you have not yet made the transition you are encouraged to do so (though not required at this time.)

 

If you have not yet registered any BlackBerry Code Signing keys, you will need to do so.

 

In either case, instructions can be found here:

https://developer.blackberry.com/html5/documentation/beta/testing_and_signing_setup.html#kba13821044...

 

Exporting For BlackBerry 10

 

At this point, there are three assumptions. You have:

  1. Installed the BlackBerry 10 WebWorks SDK.
  2. Configured your BlackBerry 10 Code Signing keys.
  3. Developed your Construct 2 application.

Now, you are at the point of exporting your Construct 2 application for the BlackBerry 10 platform. To do so, we will need to begin in the command-line. On your PC, open a command-line terminal and navigate to the folder where you would like to create your project. For this example, we will be using c:\webworks.

 

C:\>cd webworks

C:\webworks>

 

From here, we want to create a new webworks project that will house our Construct 2 application. For this, we use the webworks create command. We'll then want to navigate into our newly created folder.

 

C:\webworks>webworks create C2Sample

C:\webworks>cd C2Sample

C:\webworks\C2Sample>

 

This will generate a pre-populated sample folder structure for your application. We'll want to navigate to the following sub-folder and delete everything except config.xml. Only config.xml should remain.

 

C:\webworks\C2Sample\www

 

Next, let's switch over to the Construct 2 IDEFrom the Construct 2 IDE, we'll want to click through the following.

 

File > Export Project... > Web (HTML5 Website)

 

The export option for Mobile (BlackBerry 10) refers to the legacy BlackBerry 10 WebWorks SDK 1.0.

 

In the Export Options dialog, for Export Files To, choose the www sub-folder of your WebWorks project; the same folder where we previously deleted the files.

 

C:\webworks\C2Sample\www

 

The remaining items can remain as they are. Do not enable Minify Script as it may interfere if you are using certain plugins. Once configured, click Next.

 

In the HTML Export Options dialog, you can choose which best fits your project. If you are unsure, choose Embed Style. Once configured, click Export.

 

This should generate your Construct 2 application within your BlackBerry 10 WebWorks project folder; specifically the www sub-folder.

 

Update config.xml

 

Before you can build your project, we will need to make a few changes to the config.xml file in our root www folder. Example:

  

C:\webworks\C2Sample\www\config.xml

  

You can open this file with any standard text editor. The default values that will need to be changed are highlighted in blue below. 

 

<?xml version='1.0' encoding='utf-8'?>
<widget id="webworks.default" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
    <name>WebWorks Application</name>
    <description>
        A sample Apache Cordova application that responds to the deviceready event.
    </description>
    <author email="dev@callback.apache.org" href="http://cordova.io">
        Apache Cordova Team
    </author>
    <content src="index.html" />
    <access origin="*" />
    <preference name="fullscreen" value="true" />
    <preference name="webviewbounce" value="true" />
</widget>

  

  • id: This should be unique to your application. A reverse-domain format similar to com.vendorName.applicationName is recommended.
  • version: Change this to the current release version of your application. For test builds, you can leave this as-is.
  • <name>: The application name that will be displayed on the device's homescreen.
  • <description>: A description for your application.
  • <author>: Your email, website, and name. Email and website are optional.

Also, take note of the <access> element. If your application is loading resources from external locations, you will need to white-list those URLs. For more information on <access> and various config.xml elements, please check the following documentation.

https://developer.blackberry.com/html5/documentation/beta/modifying_your_config_file.html

 

Building and Deploying a Debug Version

 

To test your newly exported project on a BlackBerry 10 device:

  1. Switch your device to Development Mode by navigating: Settings > Security and Privacy > Development Mode > Development Mode: On.
  2. Connect your device to your PC via USB.
  3. Execute the webworks run command from the root folder of your WebWorks project, using the CLI.

  

C:\webworks\C2Sample>webworks run

  

You should be prompted for your Device Password, after which the WebWorks SDK will create and deploy a debug token, uninstall any previous versions of the application, and install the current project in debug mode; enabling Web Inspector automatically.

 

Building a Release Version

 

To release an application through the BlackBerry World storefront; it must be fully signed. To do so, execute the following command from the root folder of your WebWorks project, using the CLI.

 

C:\webworks\C2Sample>webworks build --release --keystorepass 123456 --buildId 25

Where 123456 should be replaced with your own Code Signing password, and the buildId should reflect the current version of your application. Most developers will begin at 1 and increment with each new release.

 

The buildId is combined with the version specified in your config.xml. For example, if your config.xml version is 1.0.0 and your buildId is 25, the full version of your application will be 1.0.0.25. When submitting to BlackBerry World, new releases must have a higher version than the previous release. You can achieve this by either increasing the version in config.xml, or by incrementing your buildId.

 

Note that 2.0.0.1 is a higher version number than 1.2.3.25.


Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
New Member
toonheart
Posts: 1
Registered: ‎12-11-2013
My Device: z10 Dev Alpha B
My Carrier: Vodafone

Re: Construct 2 + Webworks SDK 2.0

Hey Erik,


Thanks for the real prompt and fast write up.
You're great help!
--
Krish
Founder, Clan Leader, Toonheart Studios
www.TOONHEART.com | facebook or twitter - toonheart
"Baka - The World's Hungriest Frog" - COMING SOON
http://facebook.com/HungryBaka
Please use plain text.
Regular Contributor
Asmooh
Posts: 70
Registered: ‎10-27-2010
My Device: Z10 STL100-2
My Carrier: Comviq & Telia

Re: Construct 2 + Webworks SDK 2.0

I wanted to add that you can also use "webworkd build release -k yourkey -b builid"

Littlebit less to type, you can also skip the -k yourkey and you will get a prompt for typing your key

 

 

Please use plain text.
Contributor
mindon
Posts: 15
Registered: ‎11-01-2012
My Device: Blackberry 10
My Carrier: RIM

Re: Construct 2 + Webworks SDK 2.0

it seems the webworks command not working well behide a proxy ...

 

will the command webworks detect the env variable HTTP_PROXY or HTTPS_PROXY ?

Please use plain text.
BlackBerry Development Advisor
oros
Posts: 1,557
Registered: ‎04-12-2010
My Device: BlackBerry Z10
My Carrier: Bell

Re: Construct 2 + Webworks SDK 2.0

Hi mindon, if you haven't already, probably best to start a new thread in these forums on that topic to get the expert's eyes on it. I'm not sure off the top of my head, but will try to figure it out in the meantime.

Erik Oros | @WaterlooErik | eoros@blackberry.com | Developer Issue Tracker

If a reply has answered your question, please click Accept as Solution to help other visitors in the future.
Please use plain text.
New Developer
smsanthosh
Posts: 4
Registered: ‎02-06-2014
My Device: NA
My Carrier: NA

Re: Construct 2 + Webworks SDK 2.0

Thank you for posting

Please use plain text.
New Developer
smsanthosh
Posts: 4
Registered: ‎02-06-2014
My Device: NA
My Carrier: NA

Re: Construct 2 + Webworks SDK 2.0

Great post...

Please use plain text.
New Developer
como28
Posts: 45
Registered: ‎04-11-2014
My Device: Z10
My Carrier: Indosat

Re: Construct 2 + Webworks SDK 2.0

good topic :smileyhappy: thanks to gave me other suggestion :smileyhappy:

Please use plain text.
New Developer
beingshahul
Posts: 26
Registered: ‎07-02-2013
My Device: BBZ10
My Carrier: BSNL

Re: Construct 2 + Webworks SDK 2.0

Thanks a lot fot his post, really useful for developers like us. :smileyhappy:

Please use plain text.
New Contributor
TheWyrm
Posts: 6
Registered: ‎06-04-2014
My Device: PlayBook
My Carrier: 447908919000

Re: Construct 2 + Webworks SDK 2.0

Has this process changed with the latest updates?

Please use plain text.