There are plenty of Blackberry devices available. Some devices are touch enabled phones.
Since the BlackBerry phone models are different from each other, do I need to have a separate build for each device?
If not, what is the procedure for developing a BlackBerry app for different BlackBerry devices?
If you don't want to use updated feature of the updated OS,then its fine.You can create single code for each device.
But if you want to use the latest feature like touch event etc.then you have to implement code for both-touch and non-touch ,create .cod file for each and define path for each in application.alx file.
As given below.
<application id="bgapp1">
<name >
</name>
<description >
</description>
<version >
1.0.0
</version>
<vendor >
BlackBerry Developer
</vendor>
<copyright >
Copyright (c) 2011 BlackBerry Developer
</copyright>
<fileset Java="1.54" _blackberryVersion="[4.5.0,4.5.1)">
<directory >
4.5.0
</directory>
<files >
bgapp1.cod
</files>
</fileset>
<fileset Java="1.54" _blackberryVersion="[4.6.0,4.6.1)">
<directory >
4.6.0
</directory>
<files >
bgapp1.cod
</files>
</fileset>
<fileset Java="1.54" _blackberryVersion="[4.6.1,4.6.2)">
<directory >
4.6.1
</directory>
<files >
bgapp1.cod
</files>
</fileset>
<fileset Java="1.54" _blackberryVersion="[4.7.0,4.7.1)">
<directory >
4.7.0
</directory>
<files >
bgapp1.cod
</files>
</fileset>
<fileset Java="1.54" _blackberryVersion="[5.0.0)">
<directory >
5.0.0
</directory>
<files >
bgapp1.cod
</files>
</fileset>
<fileset Java="1.54" _blackberryVersion="[6.0.0)">
<directory >
6.0.0
</directory>
<files >
bgapp1.cod
</files>
</fileset>
</application>
There are several factors that you have to consider due to the differences between BlackBerry devices. Here are a few factors to consider;
-Operating System (e.g. 4.6, 5.0, 6.0): There may be features in newer OSs that you might want to take advantage of that are not available on an older OS. You can wrap code in pre-processor directives or have separate files wherever your code base deviates in this respect. BB OS 4.7 introduced touch screen capabilities.
-Screen Resolution: You might need to modify your layout, images you use such as background graphics or other UI elements based on the available screen real estate. Some popular resolutions are 320x240, 480x360, devices yet to release are expected to be 800x480.
The typical development procedure involves you setting up a separate build for each device configuration (resolution and os combination, as several devices share the same configuration). You can use Ant and BB-Ant-Tools for that.
If you're just starting BB development, I recommend that you invest your efforts in BB 5.0+, if not 6.0 as a minimum. For most people, this is good advice (tried and true on my part).
Related
We are using Wix script for installation through Jenkins. Ours is 64-bit OS. If executed through command prompt Windows\system32 desktop folder is dispalyed as C:\Users\XXXXX\Desktop\ which will do the installation properly. But if we run through Jenkins Desktop folder is C:\Windows\SysWOW64\config\systemprofile\Desktop\ . In later case installation and shortcut creation is improper. How to overcome this ?? What might be the reason?? Thank you in advance for any help. Here is the WIX SCRIPT
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" UpgradeCode="PUT-GUID-HERE" Version="1.0.0.0"
Language="1033" Name="Product" Manufacturer="ABC">
<Package InstallerVersion="200" Compressed="yes"
Comments="Windows Installer Package"/>
<Media Id="1" Cabinet="product.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="APPLICATIONROOTDIRECTORY" Name="Product">
<Component Id="XYZ" Guid="*">
<File Id="XYZ.exe" Source="D:\Repo\Solution\XYZ\bin\Debug\XYZ.exe">
</File>
</Component>
</Directory>
</Directory>
<Directory Id="DesktopFolder" Name="XYZ">
<Component Id="ApplicationShortcuts" Guid="*">
<Shortcut Id="ApplicationShortcut1" Name="XYZ"
Description="Product Shortcut"
Target="[APPLICATIONROOTDIRECTORY]XYZ.exe"
WorkingDirectory="APPLICATIONROOTDIRECTORY"/>
<RegistryValue Root="HKCU" Key="Software\[Manufacturer]\XYZ"
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
<RemoveFolder Id="DesktopFolder" On="uninstall"/>
</Component>
</Directory>
</Directory>
<Feature Id="DefaultFeature" Level="1">
<ComponentRef Id="XYZ"/>
<ComponentRef Id="ApplicationShortcuts"/>
</Feature>
<UIRef Id="WixUI_Mondo" />
<UIRef Id="WixUI_ErrorProgressText" />
</Product>
</Wix>
It seems Jenkins is running as SYSTEM account. If you want to run Jenkins as user XXXXX so that the installation goes fine as it went while running as user XXXXX, then just try running Jenkins with the same user. To do that, go to Run > type services.msc > select Jenkins > (Right-click and select) Properties > Click on Log On tab > Select This account
Now enter the user name with which you want to run Jenkins and its password. Now restart Jenkins. You can now give a try to your WiX script.
This is a follow-up to: BlackBerry - use own JAR file in own project & BlackBerry - Ant build script for more complex apps. This problem has now been solved below.
Aim
I want to:
use Ant (bb-ant-tools) to build my library into a JAR file
include that JAR file in a project
use Ant to build that project into a COD that will run on the device (without external COD files).
The important part is to use Ant to do the final stage of the build.
All posts I have found for this problem use Eclipse for that final build stage (details at BlackBerry - use own JAR file in own project).
Progress
I can build the library project into a JAR using Ant.
In Eclipse, I can add that JAR file to a project, and build it as desired (single COD, no external dependencies). It will run on the device.
In Ant, I can also make a build that relies on an extra COD library to contain the runtime code - this is close to what I need.
Problem
I can build the final project with Ant. But the resulting COD file does not include any runtime code from my library.
Many posts I have read show how this can be done using extra COD files for the library. I would like to avoid this.
How can I include a JAR into my project without external dependencies, using Ant? I believe this is possible because I can do it using Eclipse.
Workaround
My current workaround is to include my SDK / library project as source code (as per esaj's answer below), rather than as a JAR file. This has some disadvantages over the JAR approach, but I have a build that runs on the device successfully.
(I hope its OK to cross-reference this question with the following long list of links?)
StackOverflow links:
Continuous Integration server for blackberry development? (and certificate signing) (I haven't had time to go through this one, but I think it looks promising)
Blackberry: Verificattion error when using Library project as External Jar
https://stackoverflow.com/questions/6134940/how-to-use-external-library-jar-file-in-blackberry
Blackberry 5.0 - Add reference to a Java Library Project
How to add external jar or zip file in the Blackberry project
Blackberry Apps - Importing a code-signed jar into an application project
How to add library project with the current development project in blackberry
This one gives other links - quite useful:
Handling dependencies in blackberry development
These not so useful:
In Blackberry, can we create common library that can be used by different applications?
BlackBerry Facebook SDK jar file
Adding and Testing Compatibility of External Jar to Blackberry Project
How to attach Jar in Blackberry
BlackBerry RIMAPPSA2 signing key required -- why?
Is there a list of classes, methods and API which will trigger RIMAPPSA2 permission when signing Blackberry application?
RIM:
javac -target parameter used by the rapc.exe tool
Add a .jar file dependency
Other jar added in BB project - using BB ant tools
Tutorial: How To Use 3rd Party Libraries in your Applications
Have you tried pointing to the library in the src section under rapc?
E.g.:
<rapc ...>
<src>
<fileset dir="${buildDirectory}">
<include name="src/**/*.rrh" />
<include name="src/**/*.rrc" />
<include name="src/**/*.java" />
<include name="res/**/*.*" />
<!-- Libraries -->
<include name="lib/**/*.*" />
</fileset>
</src>
</rapc>
I had a similar problem last year, I had created a "framework" that was used as a base for multiple BB-applications, but run into problems with multiple CODs (I don't remember exactly what, something like the device refused to install multiple applications that had same external cods, if the external CODs weren't installed separately first, and then the applications). As the applications could be installed separately (one person might install only app A, another might install only app B, and yet another might install both A and B), the whole framework needed to be included in all the apps using it. I cooked up this Ant-script using bb-ant-tools (hopefully I didn't break anything removing some stuff specific to our apps and obfuscating package names etc):
<?xml version="1.0" encoding="UTF-8"?>
<project name="${description}" default="build" basedir=".">
<taskdef resource="bb-ant-defs.xml" classpath="lib/bb-ant-tools.jar" />
<!-- rapc and sigtool require the jde.home property to be set -->
<!-- NOTE: You may need to copy the signature files from Eclipse\plugins\net.rim.ejde\vmTools to the components\bin -dir
if the keys were installed using the Eclipse-plugin -->
<property name="jdehome" value="C:\BB\Eclipse\plugins\net.rim.ejde.componentpack5.0.0_5.0.0.25\components" />
<!-- Framework source locations, these must be set correctly -->
<property name="frameworkRes.dir" value="C:\BB\workspace\BB_Framework\res" />
<property name="frameworkSrc.dir" value="C:\BB\workspace\BB_Framework\src\com\whatever\frame" />
<!-- Locations for simulator, binaries, jde home, don't touch these -->
<property name="simulator" value="${jdehome}\simulator" />
<property name="bin" value="${jdehome}\bin" />
<property name="jde.home" location="${jdehome}" />
<!-- directory of simulator to copy files to -->
<property name="simulator.home" location="${simulator}" />
<property name="src.dir" location="src" />
<property name="build.dir" location="build" />
<property name="temp.dir" location="C:\tempsrc" />
<!-- Project specific -->
<!-- Application title -->
<property name="app.title" value="Application Name" />
<property name="app.version" value="1.0.0" />
<!-- Value to prepend before frame-class packages -->
<property name="frame.prefix" value="appname" />
<!-- Name of the COD to produce -->
<property name="cod.name" value="Appname" />
<target name="build">
<mkdir dir="${build.dir}" />
<delete dir="${temp.dir}" />
<mkdir dir="${temp.dir}" />
<mkdir dir="${temp.dir}\${frame.prefix}" />
<copy toDir="${temp.dir}">
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
</copy>
<copy toDir="${temp.dir}\${frame.prefix}">
<fileset dir="${frameworkSrc.dir}">
<include name="**/*.java" />
</fileset>
</copy>
<copy toDir="${temp.dir}\res">
<fileset dir="${frameworkRes.dir}">
<include name="**/*" />
</fileset>
</copy>
<copy toDir="${temp.dir}\res">
<fileset dir="res">
<include name="**/*" />
</fileset>
</copy>
<!-- This replaces the package names for classes copied from under framework-directory to ${frame.prefix} -directory -->
<replace dir="${temp.dir}" value="${frame.prefix}">
<include name="**/*.java"/>
<replacetoken>com.whatever.frame</replacetoken>
</replace>
<rapc output="${cod.name}" srcdir="${temp.dir}" destdir="${build.dir}">
<jdp title="${app.title}"
version="${app.version}"
vendor="Your Company"
icon="../res/img/icon.png"
/>
</rapc>
</target>
<target name="sign">
<sigtool codfile="${build.dir}/${cod.name}.cod" />
</target>
<target name="clean">
<delete dir="${build.dir}" />
</target>
<target name="load-simulator" depends="build">
<copy todir="${simulator.home}">
<fileset dir="${build.dir}" includes="*.cod,*.cso,*.debug,*.jad,*.jar" />
</copy>
</target>
</project>
What this does, is copy all the java-files and resources from your current project and then from the framework-project to a temporary directory, replacing package names on the way for the frame-work files (as they're put into a separately named directory), this has to do with the fact that the devices also refused to install multiple applications that had same classes under same packages (namely, the framework classes, for your case this might not be necessary). After the copying and replacing is done, the application is built to target build-directory using rapc. There are separate tasks for signing, cleaning and loading the app to a simulator. Hope this helps.
I try to submit app in app world,
when I try to submit app with this .alx file it says that is not good
what is wrong?
<loader version="1.0">
<application id="AppTest">
<name >
AppTest
</name>
<description >
AppTest
</description>
<version >
1.5
</version>
<vendor >
Vendor
</vendor>
<copyright >
Copyright (c) 2011 Vendor
</copyright>
<fileset Java="1.54" _blackberryVersion="[5.0.0)">
<directory >
5.0.0
</directory>
<files >
AppTest.cod
</files>
</fileset>
</application>
you can submit app to the appworld by just submitting the signed .cod file so just try to submit using .cod file.
I have used the Heat tool to generate a wxs file based on a folder whose contents I want to install. This gives me a large file like this:
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Fragment>
<DirectoryRef Id="TARGETDIR">
<Directory Id="dir1FC8A0605F7DF8B33E3EECB0A1270FA2" Name="DirectoryName" />
</DirectoryRef>
</Fragment>
<Fragment>
<ComponentGroup Id="ComponentGroupId">
<Component Id="cmp1FB67A60B41F3170889B7E5739A23560" Directory="dir1FC8A0605F7DF8B33E3EECB0A1270FA2" Guid="{2DC3B790-D29C-4090-B4CF-5C27687C6ABE}">
<File Id="filF1E1262E52254B1846C7CB2393126A6F" KeyPath="yes" Source="PathToFile" />
</Component>
</ComponentGroup>
</Fragment>
</Wix>
In my main Wix file, Product.wxs, I have a feature that references the above ComponentGroup that was created by Heat. The feature looks something like this:
<Feature Id="FeatureId" Title="FeatureTitle" Level="1" AllowAdvertise="no" Absent="disallow" Description="Feature description.">
<ComponentGroupRef Id="ComponentGroupId" />
</Feature>
This is working but when I run my installer, the files within the component group are placed in the root of the C drive (i.e. C:\DirectoryName) but I would like them to go into Program Files (e.g. C:\Program Files\DirectoryName).
Any ideas?
Thanks,
Alan
You can pass the Id of the directory you want to reference to heat with the -dr argument like
heat -dr AutogeneratedComponentsDir
Or DirectoryRefId attribute if you are using the HeatDirectory task in msbuild.
Then just define the location of that directory in your main Product.wxs.
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLDIR" Name="YourProduct">
<Directory Id="AutogeneratedComponentsDir"/>
</Directory>
</Directory>
</Directory>
I still don't know how to add the installdir into the PATH of the Windows System Variables after I went through the WIX tutorial.
I tried to use
Environment Id='UpdatePath' Action='create' Name='PATH' System='yes' Value='[INSTALLDIR]'
But there was no change in the Path after I installed the program. I can hardly find sample code of WIX anywhere.
Please help me, thanks a lot!
You should be able to use:
<Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="yes" Part="last" Action="set" System="yes" />
This should add a new entry to the environment path, set to [INSTALLDIR].
Another thing to note is, Environment need to be placed inside a component with directory, e.g.
<DirectoryRef Id="TARGETDIR">
<Component Id="Path" Guid="{xxx-xxx-xxx-xxx}">
<Environment Id="PATH" Name="PATH" Value="[INSTALLDIR]" Permanent="no" Part="last" Action="set" System="no" />
</Component>
</DirectoryRef>
Details of Wix Element described at Environment Element
Had the same exact problem, this have worked for me:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLFOLDER" Name="DataBaseds_Service_Installer" />
</Directory>
</Directory>
<ComponentGroup Id="Components" Directory="INSTALLFOLDER">
...some components
</ComponentGroup>
<DirectoryRef Id="TARGETDIR">
<Component Id="MYSQL_PASSWORD" Guid="..."
<Environment Id=HERE YOU CAN ADD THIS :)/>
</Component>
</DirectoryRef>