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
Regular Contributor
pepe_ugalde
Posts: 63
Registered: ‎09-10-2012
My Device: Developer
My Carrier: AMX
Accepted Solution

Exit app and open another

Hello guys

 

In my app I read the SIM card. If the app has no permission to read the SIM, it displays a dialogue which tells the user that permissions must be given. The dialogue has 2 options: "Go to settings" and "Exit".

 

This is my code

 

void TestApp::processSIMPermissionAlert(bb::system::SystemUiResult::Type value) {
	
	if (value == SystemUiResult::ConfirmButtonSelection) {
		//go to security settings
		char* dummy = 0;
		int success = navigator_invoke("settings://security", &dummy);
		if (success == BPS_FAILURE) qDebug() << "INVOKE FAIL: " << dummy;
	}
	Application::exit(0);
}

 The problem is that when the user presses "Go to settings", the app closes and at the same time the settings app opens but is all black and messy. You have to minimize it for it to work again.

 

Is there any other way of opening another app and closing the current one?

 

Thanks

Pepe

 

Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: Exit app and open another

Not sure what "all black and messy" means, but if you're saying that the Settings app doesn't display itself properly, then it's probably a bug and you should file a ticket in Jira to report it.

Then ignore, since there's no reason (yet) to spend lots of time trying to work around critical bugs that ought to be fixed by launch (if they're reported).

There's also a chance that the navigator_invoke() call will be replaceable with something more specific to the Invocation Framework, but we're still waiting on them to document the ways in which we can use that to interact with system apps. For example, it would be a good idea if we could have our apps open the settings right at the permissions for our own apps, rather than requiring the user to find them in the list.

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
Regular Contributor
pepe_ugalde
Posts: 63
Registered: ‎09-10-2012
My Device: Developer
My Carrier: AMX

Re: Exit app and open another

Awwwright. I'll file a bug. Meanwhile I'll leave only the "Exit" button.

 

Pepe

Please use plain text.
Developer
fracobx19
Posts: 29
Registered: ‎11-17-2013
My Device: Blackberry Simulator 10.2
My Carrier: Telcel

Re: Exit app and open another

I see that after the if statement you close the application. Did you tryied to put that line inside an else statement. Because if you let the things like in the post your app of course will close no matter which button is pressed.

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

Re: Exit app and open another

I believe that is the intent..

 

One button just closes the app, the other one closes the app and launches the settings.


fracobx19 wrote:

I see that after the if statement you close the application. Did you tryied to put that line inside an else statement. Because if you let the things like in the post your app of course will close no matter which button is pressed.






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.
Developer
greenmr
Posts: 862
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: Exit app and open another

I realize this thread has been marked solved, but looking at the code I wonder if the problem with settings isn't the way it is invoked. I use other invocation methods and haven't used navigator_invoke(), but I wonder if it works the same way as what I am familiar with. With other methods you often have to wait until the invocation is properly armed before using it. I suspect that navigator_invoke() is asynchronous... that is to say that the function returns immediately while the actual invocation takes a bit longer to process.

 

If this is so then it is possible the app is exiting and releasing memory and objects before the invocation has finished executing. I would suggest the OP temporarily comment out the exit() to see if the settings invocation works properly if the app isn't shut down. If so, then you would need to find a way to delay the exit until the invocation has executed properly.

 

Using Cascades invocation you would probably do your exit from the armed() signal handler since this signal tells you the invocation has done it's setup and you can proceed. 


pepe_ugalde wrote:

Hello guys

 

In my app I read the SIM card. If the app has no permission to read the SIM, it displays a dialogue which tells the user that permissions must be given. The dialogue has 2 options: "Go to settings" and "Exit".

 

This is my code

 

void TestApp::processSIMPermissionAlert(bb::system::SystemUiResult::Type value) {
	
	if (value == SystemUiResult::ConfirmButtonSelection) {
		//go to security settings
		char* dummy = 0;
		int success = navigator_invoke("settings://security", &dummy);
		if (success == BPS_FAILURE) qDebug() << "INVOKE FAIL: " << dummy;
	}
	Application::exit(0);
}

 The problem is that when the user presses "Go to settings", the app closes and at the same time the settings app opens but is all black and messy. You have to minimize it for it to work again.

 

Is there any other way of opening another app and closing the current one?

 

Thanks

Pepe

 






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.
Please use plain text.