Rg.plugins.popup: Doesn't show popup if application is paused and then resumed

Created on 3 Jan 2018  Â·  19Comments  Â·  Source: rotorgames/Rg.Plugins.Popup

Using the latest pre-released version: 1.1.3.73-pre

If I run my application on Android,
then pressed back button -> application goes to paused mode
after that I resume back and cannot show any popup windows anymore.

It simply never returned from await _navigation.PushPopupAsync(page);
(_The only difference from the examples I can see is that we use FormsAppCompatActivity,
NOT FormsApplicationActivity, not sure if it can be a problem_)

Then if I tap back button, nothing is happening. Tap it again (second time), get exception:

01-03 17:05:11.009 I/MonoDroid(11178): System.InvalidOperationException: Sequence contains no elements
01-03 17:05:11.009 I/MonoDroid(11178):   at System.Linq.Enumerable.Last[TSource] (System.Collections.Generic.IEnumerable`1[T] source) [0x00010] in <65f4a23934a3468fae9abe3139b55169>:0 
01-03 17:05:11.009 I/MonoDroid(11178):   at Xamarin.Forms.Platform.Android.AppCompat.Platform.HandleBackPressed (System.Object sender, System.EventArgs e) [0x0000a] in D:\agent\_work\1\s\Xamarin.Forms.Platform.Android\AppCompat\Platform.cs:281 
01-03 17:05:11.009 I/MonoDroid(11178):   at (wrapper delegate-invoke) <Module>:invoke_bool_object_EventArgs (object,System.EventArgs)
01-03 17:05:11.009 I/MonoDroid(11178):   at Xamarin.Forms.Platform.Android.FormsAppCompatActivity.OnBackPressed () [0x00000] in D:\agent\_work\1\s\Xamarin.Forms.Platform.Android\AppCompat\FormsAppCompatActivity.cs:63 
01-03 17:05:11.009 I/MonoDroid(11178):   at Android.App.Activity.n_OnBackPressed (System.IntPtr jnienv, System.IntPtr native__this) [0x00008] in <c8cab2efd85f442389020057942eca89>:0 
01-03 17:05:11.009 I/MonoDroid(11178):   at (wrapper dynamic-method) System.Object:fe9499a8-27c1-4801-821e-2260ccec42ec (intptr,intptr)
01-03 17:05:11.018 I/System.out(11178): (HTTPLog)-Static: isSBSettingEnabled false
bug need-review

All 19 comments

@wattsdeveloper Hi. Did you init this plugin in the OnCreate method?

@rotorgames yes

protected override void OnCreate(Bundle bundle)
{
      Popup.Init(this, bundle);
      Forms.Init(this, bundle);
}

@wattsdeveloper Did you show a popup before back button tapping?

@wattsdeveloper P.S. Can you create a project where you have reproduced this problem for an example?

@rotorgames no, just running the app and press back button. After resume - yes, I clicked to show the popup, but nothing is happening and on second click I get exception.

I can try of course to reproduce it on empty project.

@wattsdeveloper If you can do it that it will be super.

@rotorgames btw, when after I click to show the popup after resuming and press back button for the first time I can see that PopupNavigation.Instance.PopupStack still contains my popup page,
on second back button press it is empty.

Update : P.S. figure out that this how it should be :)

@wattsdeveloper I understood a source of the problem but I can't reproduce it in the demo project. So I ask you to create an empty project with this problem.

@rotorgames thank you for your response. It seems that I found issues in our code :/ and now it seems to be working as expected :)

@wattsdeveloper Nice to hear it. Can I close this issue?

Getting same problem @wattsdeveloper can i know how you solve this problem

yes, can you please share your solution?

Showing Popup using following code in page code behind
await PopupNavigation.Instance.PushAsync(new PopUpPage());

Pop page using following code in PopUpPage() viewmodel
await PopupNavigation.Instance.PopAsync(false);
Messenger.Default.Send("Pop", "Popnewitem");

it works well but after pause and resume app popup pop successfully but it halt exceution of below lines.

Tried debug on PopAsync(false) it halt debugging and not execute next lines.

@swapnil591 @wattsdeveloper I have changed some code recently so you can have some problem with it. I have added code which remove each popup pages from PopupStack when the Init method is invoked. I had to do it because Xamarin.Android doesn't remove static fields from memory when an application is sleeping because of it the PopupStack is not cleaned and you can see old pages which there are not in the display but there are in the PopupStack after an application has been resumed.

Is there any way to display such popup after resume or will in future release or need to reduce plugin to back 1.0.4 .

@swapnil591 I think that it must work. You should be able to open a new page after an application resuming. I will review it and will fix it soon

@wattsdeveloper @swapnil591 Do you have this problem with the last beta builds?

No . Problem solved thank you.

On 30-Jan-2018 5:44 PM, "Kirill" notifications@github.com wrote:

@wattsdeveloper https://github.com/wattsdeveloper @swapnil591
https://github.com/swapnil591 Do you have this problem with the last
beta builds?

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/rotorgames/Rg.Plugins.Popup/issues/213#issuecomment-361575515,
or mute the thread
https://github.com/notifications/unsubscribe-auth/APzszlYuFlT6WxCTu7ORSJpBujbA0EeZks5tPweYgaJpZM4RR2Ff
.

@swapnil591 You are welcome.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tranb3r picture tranb3r  Â·  6Comments

genilsonmm picture genilsonmm  Â·  3Comments

masiri201 picture masiri201  Â·  3Comments

mshenoy83 picture mshenoy83  Â·  4Comments

Nessitro picture Nessitro  Â·  5Comments