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

Native Development

Reply
Developer
Posts: 92
Registered: ‎08-01-2013
My Device: Z10, Q5, Q10

ApplicationInfo Version number

Hi all,

 

I'm trying to get the app version, in my qml file.

Following is the code i use :

 

attachedObjects: [

ApplicationInfo {
id: applicationInfo
}
]

 

and display it as :

 

Container {

leftPadding: 40

Label {
text: "Version: " + applicationInfo.version
textStyle.color: Color.create("#ff58595b")

}
}

 

i have given the following permissions in the bar file :

 

<permission system="true">run_native</permission>
<permission>read_device_identifying_information</permission>
<permission>access_internet</permission>
<permission>run_when_backgrounded</permission>
<permission>access_shared</permission>

 

and linked -lbb in the pro file.

 

yet i get the version as 0.0.0.0

 

i'm setting it to the following in the bar file.

 

Package Version : 1.0.4

Package  Build ID : 4

 

Is there anything i'm missing??

I tried to use PackageInfo class (it also has version method) also with the same result.

Tried to do this in CPP class withsame result again.

 

Please help!

 

 

Regards

Developer
Posts: 19
Registered: ‎06-10-2014
My Device: blackberry z10

Re: ApplicationInfo Version number

[ Edited ]

for the version

 

Label {
text: Application.applicationVersion
}

 

 

for the name

 

Label {
text:  Application.applicationName
}

 

Developer
Posts: 92
Registered: ‎08-01-2013
My Device: Z10, Q5, Q10

Re: ApplicationInfo Version number

What exactly is applicationVersion? is it some kind of method that you have defined?
Developer
Posts: 19
Registered: ‎06-10-2014
My Device: blackberry z10

Re: ApplicationInfo Version number

It is a standard property of the sdk

 

If you change your code to

 

Label {
text: "Version: " + Application.applicationVersion
textStyle.color: Color.create("#ff58595b")
}
}

 

it should get the version number of your bar-descriptor.xml

No need to change anything else

Developer
Posts: 92
Registered: ‎08-01-2013
My Device: Z10, Q5, Q10

Re: ApplicationInfo Version number

unknown member application version, error it gives me.

Developer
Posts: 19
Registered: ‎06-10-2014
My Device: blackberry z10

Re: ApplicationInfo Version number

Can you post your code?

Developer
Posts: 106
Registered: ‎10-19-2012
My Device: Playbook, BB10DevAlphaB

Re: ApplicationInfo Version number

Just tried it on my app and I get the correct version. Have you checked the source of your bar-descriptor.xml file that it is indeed correct in there ?
Developer
Posts: 92
Registered: ‎08-01-2013
My Device: Z10, Q5, Q10

Re: ApplicationInfo Version number

Yes it is.