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
Contributor
tnavabothu
Posts: 48
Registered: ‎08-07-2013
My Device: z10
My Carrier: blackberry
Accepted Solution

How to get the version of the app

hi

      i found that we can get the current app version by using the ApplicationInfo.but the thing is when i try to implement it it is throwing make file errors.can any one know how to do this in a better way.

 

thanking you.

Please use plain text.
Developer
BBSJdev
Posts: 5,948
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: How to get the version of the app

[ Edited ]

Yes fix the errors. :smileywink:

 

Did you include -lbb in your .pro file.

 

  LIBS += -lbb

 

If you did then post the errors you are gettng.

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Contributor
tnavabothu
Posts: 48
Registered: ‎08-07-2013
My Device: z10
My Carrier: blackberry

Re: How to get the version of the app

[ Edited ]

Thanks for the replay

yes i had added -lbb to .pro file

some how i manged not to get the make file errors. after doing this everything is fine at the building time,but when i run the app it is crashed. i didn't find any error log in the device log. i tried  cleaning the log and again run the app to find out the error.i'm unable to get any error message.

Please use plain text.
Developer
BBSJdev
Posts: 5,948
Registered: ‎07-05-2012
My Device: Playbook, Z10 LE, Dev Alpha C
My Carrier: Orange

Re: How to get the version of the app

Crashes are usually down to an illegal memory access, such as an uninitialized pointer or index going out of range.

 

Try setting some break points and stepping through.

 


If you've been helped click on Like Button, if you've been saved buy the app. :smileyhappy:

Developer of stokLocker, Sympatico and Super Sentences.
Please use plain text.
Developer
greenmr
Posts: 862
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: How to get the version of the app

In addition to the suggestion by 


tnavabothu wrote:

Thanks for the replay

yes i had added -lbb to .pro file

some how i manged not to get the make file errors. after doing this everything is fine at the building time,but when i run the app it is crashed. i didn't find any error log in the device log. i tried  cleaning the log and again run the app to find out the error.i'm unable to get any error message.




Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.
Developer
10soft
Posts: 33
Registered: ‎12-05-2013
My Device: Z10
My Carrier: 123456789

Re: How to get the version of the app

If it's crashed before it gets into the main screen of your app, it seems like the constructor hasn't finished due to null pointer issue. You can try printing into console where is the last code line it reaches then you will know what is right and what is wrong with your code.
Please use plain text.
Regular Contributor
cmr1990
Posts: 59
Registered: ‎10-16-2013
My Device: Z10
My Carrier: vodaphone

Re: How to get the version of the app

This did work for me : 

 

#include <bb/ApplicationInfo>

 

using namespace std;
using namespace bb::smileytongue:latform;
using namespace bb::device;

 

 LIBS += -lbb /* in the pro file */

 

bb::ApplicationInfo appInfo;
QString version = "" ;
version = appInfo.version() ;
// Display or perform actions with the version.

 

Hope it helps!

Please use plain text.
Contributor
tnavabothu
Posts: 48
Registered: ‎08-07-2013
My Device: z10
My Carrier: blackberry

Re: How to get the version of the app

yes you are right .

 

      i had already done that.:smileyhappy:

QString get_appversion=bb::ApplicationInfo().version();

 

Please use plain text.
Developer
greenmr
Posts: 862
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: How to get the version of the app

Unless I'm missing something, your code will not work since version() is not listed as a static function, and so you must create an instance of ApplicationInfo before calling the version() function, the way cmr1990 did it. Even if version WAS a static function, your syntax for calling it would be wrong, and you should have coded:

 

QString get_appversion = bb::ApplicationInfo::version();

...but as I said, since version() is not declared as static you can't use it this way.

 


tnavabothu wrote:

yes you are right .

 

      i had already done that.:smileyhappy:

QString get_appversion=bb::ApplicationInfo().version();

 






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.
Developer
Zmey
Posts: 1,507
Registered: ‎12-18-2012
My Device: PlayBook, Z10, DAC

Re: How to get the version of the app

This syntax is correct:
QString get_appversion=bb::ApplicationInfo().version();

bb::ApplicationInfo() creates a nameless temporary object.

Andrey Fidrya, @zmeyc on twitter
Please use plain text.