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


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Connect to lowMemory signal

[ Edited ]

I'm having issues connecting to this signal. The documentation hasn't helped me resolve my issue. Here's what I have.

 

My SLOT is never called. However, I receive memory warnings from the console, as the debugger seems to automatically print them, ie:

 

Process 145588425 received low memory signal, priority = 2
Process 145588425 received low memory signal, priority = 2

I don't receive an error that either my SIGNAL or SLOT does not exist, which is usually the issue when I have problems with SLOTS not being called.

 

app.hpp

#include <bb/MemoryInfo>
#include <bb/LowMemoryWarningLevel>

public slots:
	//Memory
	void onLowMemory(bb::LowMemoryWarningLevel::Type);

app.cpp

App::App() {
	//CONNECT TO MEMORY WARNINGS
	bb::MemoryInfo memoryInfo;
	QObject::connect(&memoryInfo, SIGNAL( lowMemory(bb::LowMemoryWarningLevel::Type) ),
		this, SLOT( onLowMemory(bb::LowMemoryWarningLevel::Type) ));
}

void App::onLowMemory(bb::LowMemoryWarningLevel::Type level) {
	qDebug() << "Low memory";
    if (level == bb::LowMemoryWarningLevel::LowPriority) {
    	qDebug() << "Low priority memory warning.";
    	//releaseLowPriorityMemory();
    } else if (level == bb::LowMemoryWarningLevel::HighPriority) {
    	qDebug() << "High priority memory warning.";
        //releaseHighPriorityMemory();
    }
}

 

Probably worth noting the application compiles and runs, so I have incldued -lbb in the .pro, and seem to have covered all the preconditions.

----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!
Highlighted
Developer
Posts: 656
Registered: ‎02-03-2010
My Device: Z10 LE
My Carrier: Rogers

Re: Connect to lowMemory signal

Only difference I see from this sample is that you have 'this' for slot and they have &testObject. 

 

  bb::Application app(argc, argv);
    bb::MemoryInfo memoryInfo;
    TestObject testObject;
 
    QObject::connect(&memoryInfo, SIGNAL( lowMemory(bb::LowMemoryWarningLevel::Type) ),
                     &testObject, SLOT( onLowMemory(bb::LowMemoryWarningLevel::Type) ));

 


Steven Kader at JaredCo
   Follow me on Twitter    |     Mipixi.com :  Web App for Photo Sharing
Developer
Posts: 206
Registered: ‎05-15-2012
My Device: None
My Carrier: Telus

Re: Connect to lowMemory signal

Yeah, I have no idea why they're doing that. Maybe you HAVE to handle the warning in another object, for some reason. I guess I could try that.
----------------------
Check out my app, Alien Flow for reddit

And of course, like my post if you found it helpful or informative!