Android 11: Permission dialog is not modal anymore. Is this by design? - android-permissions

Pre Android 11, when the permission dialog comes up, you have to tap either allow or deny. You can't tap outside the dialog box. With Android 11, you can tap outside of the box, and if you do, it acts like a deny, which is probably not what the user expects. Is this by design or is this a bug? Current C# code is below. Should this change for Android 11?
Currently, I do something like this, and in pre-Android 11, the permission dialog is modal.
if (permissionCheck == Permission.Denied)
{ ActivityCompat.RequestPermissions(this, new String[] { etc., etc. }
else
{ initialize location stuff }
Then my OnRequestPermissionsResult will check the result and do the right thing.

Related

Ionic content not updating after callback from external plugin

As part of the functionality of the app we are developing, when an android alarm is fired, a dialog box is to appear with an "Accept" or "Reject" button. Selecting reject does nothing, but selecting "Accept" triggers a callback from the plugin, which I have passed a function into. This function causes the ionic app to navigate to the root page of the app.
The issue I am having is, when I then navigate to another page after that where the user selects a value, and this value is displayed back to them and a button is enabled, the value display is not updating, and the button is not becoming enabled. Nothing seems to be updating.
What I have found is that pressing the back button on my android device will cause the page to update, which is not ideal.
This functionality works without the callback from the plugin.
What is happening here? And how do I fix it?
Passing the function into the plugin.
alarms_plugin.onAlarmRecieved = (alarmId) =>{
this.events.publish('alarmRecieved', alarmId);
}
Plugin-side functions
alarmRecieved: function(alarmId){
alarms_plugin.onAlarmRecieved(alarmId);
}
onAlarmRecieved: null
Navigating to root page on alarmRecieved
this.events.subscribe('alarmRecieved', (alarmId) =>{
if(alarmId != 'TIMEOUT')
this.nav.setRoot(HomePage);
});
Fix found by surrounding the this.nav.setRoot(HomePage) in this.zone.run(..).
Supposedly calling navigation within a subscription event causes issues like I was having.

How to make my flutter app return the user to the OS home screen?

I'm working on an app that will have a lock screen, but I'm having some issues getting it to behave correctly. Right now I'm using the didChangeAppLifecycleState to navigate to the lock screen when the user suspends/resumes the app. I'm also using the WillPopScope to intercept and deny the back button. The problem with this approach is that pressing the back button and having nothing happen doesn't feel super intuitive. Ideally, I'd like the back button to take the user out of the app and back to their OS home screen when they're on the lock screen. I also want to do this in a way that the user's route history is maintained for when they successfully unlock the app.
Is there any way to accomplish what I'm trying to do, or should I just accept that the back button won't do anything on the lock screen?
You can create an identifier in your LockScreen state and check for the identifier in onWillPop and if the user is pressing the back button from the lock screen, exit the app.
String identifier = "lockscreen";
bool onWillPop() {
if (identifier == "lockscreen") {
SystemNavigator.pop();
SystemChannels.platform.invokeMethod('SystemNavigator.pop'); //preferred.*
return true;
}
}
SystemNavigator.pop(): On iOS, calls to this method are ignored because Apple's human interface guidelines state that applications should not exit themselves.

Enable browser action for an event in Google chrome

I am writing a chrome extension for capturing the URL. This is the code for my js file.
chrome.tabs.getSelected(null, function(tab) {
myFunction(tab.url);
});
function myFunction(tablink) {
alert(tablink);
}
Now i can get the URL alert for the page by explicitly clicking on the browser action. I need it to popup the alert whenever i click on any tab in my browser.
Could you please let me know how to proceed with this?
PS: I am sure i have to use some kind of event listener.
chrome.tabs.getSelected is deprecated since Chrome 33. Use chrome.tabs.query instead if needed.
Base on your need to make popup the alert whenever you click on any tab in your browser. You can use chrome.tabs.onActivated.addListener.
The code I created is as below and it works with me. It popup the alert of current page's url whenever you click on any tab in your browser.
chrome.tabs.onActivated.addListener(function(activeInfo) {
//alert("popup");
chrome.tabs.get(activeInfo.tabId, function(tab){
alert(tab.url);
});
});
Also keep in mind to add "permissions": ["tabs"], in your manifest file since it requires access to the url. See here:https://developer.chrome.com/extensions/tabs

webDialog "CURRENT GOALS" header but no button to authorize or cancel

I am new to Facebook SDK. I am adding the Facebook login in my Android app using Facebook SDK 3.0.1. A Facebook webDialog pop-up for login. Today I found a strange behaviour that is different from that yesterday.
After entering an account name and password and press Login button in the webDialog, it finally shows "CURRENT GOALS" in the header requesting add friends, enter locations, etc. The body shows "(YOUR_APP) would like to access your public profile and friend list". But there is no more button to authorize or cancel. From the Eclipse LogCat, the current session state from Session.StatusCallback() is OPENING. As a result, user cannot complete the login process.
So how do I pass the dialog to complete the login process successfully? If I press the upper-left corner close button or back button, the dialog closes. The session state would become CLOSED_LOGIN_FAILED.
Yesterday, when the same account login, the webDalog finally show "You have already authorized (YOURAPP)" and a Cancel and OK buttons exist. If user press OK, the dialog closes, and Session.StatusCallback() calls out session state becomes OPENED. Thus user complete the login process successfully.
I just found and posted a workaround at: current goals hides facebook ok button during Facebook authorization in a web view
In the FaceBookSDK I modified com/facebook/widget/WebDialog.java, so that once the web dialog was loaded it would look for the block that contains "Current Goals" and hide it (if it exists). Once you do that, the buttons are visible again (at least they were for me).
In com/facebook/widget/WebDialog.java:
private class DialogWebViewClient extends WebViewClient {
// ... other methods ...
#Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
if (!isDetached) {
spinner.dismiss();
}
/*
* Once web view is fully loaded, set the contentFrameLayout background to be transparent
* and make visible the 'x' image.
*/
contentFrameLayout.setBackgroundColor(Color.TRANSPARENT);
webView.setVisibility(View.VISIBLE);
crossImageView.setVisibility(View.VISIBLE);
// I don't know how to highlight in the code block
// So I just add this extra long comment to make it obvious
// Add a javascript call to hide that element, if it exists
webView.loadUrl("javascript:try{ document.getElementById('nux-missions-bar').style.display='none'; } catch (e) {}");
// End changes
}

What events can I catch when the user leaves a GXT grid?

I have a web app that uses GXT (version 1.2.2) grids extensively. I'd like to warn the user if they make changes but don't save.
When I use the grid in a popup dialog, the only way for the user to leave is via a button (either Close or OK). If I add a SelectionListener to the Close button, I can do my "isDirty()" check and warn the user.
If I am not using a dialog, the restriction for leaving the page isn't there. The user can click on a side menu, select a different tab, hit a refresh or next page button that we have on each page. I could listen for an event on everyone of those, but is there an easier way? Something like a "before unload" event that gets fired?
Window.addCloseListener
Or in GWT 1.6:
Window.addCloseHandler
You cannot prevent the window from closing, but you can prompt the user to click cancel which will leave the page open. You can also perform a last-chance save operation after the user chooses to confirm the window close, but before your page is unloaded.
Try this:
Window.addListener(Events.Close,
new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
//Do something
}
});
or
Window.addListener(Events.Detach,
new Listener<ComponentEvent>() {
public void handleEvent(ComponentEvent be) {
//Do something
}
});