How to Display Image while App is in background

AnkitGAnkitG INMember ✭✭

Hi,

I would like to do below thing.

  1. Open app
  2. Do some actions
  3. Click on Home button
  4. App will be running in background
  5. User clicked the recent apps button in android (in iOS, click home button twice )
  6. Display list of apps running in background

in 6th point I need to show an image overlay for my app instead of showing a view which user was working before app being sent to background.
Any way to do this from xamarin forms or it need to do in native both android and ios ?
Please help me to find the solution.

Thanks.
Ankit.

Answers

  • Gigex42Gigex42 USMember ✭✭✭
    edited November 2

    I think the OS saves the last view the app was opened and shows it in the recent app view.

    So when you app goes to sleep in the OnSleep method in the app.xaml.cs you maybe can show an overlay picture and when resuming hide it again.

    Maybe this works.

  • AnkitGAnkitG INMember ✭✭

    @Gigex42 ,
    Thanks for the reply, can you have any example or demo with you which help me.

  • Gigex42Gigex42 USMember ✭✭✭

    I dont have any example code.

    Try creating a new page.
    Now in your onsleep method you can navigate to that page.
    MainPage.Navigation.PushAsync(new yourpage);

  • AnkitGAnkitG INMember ✭✭

    @Gigex42 ,
    Ok no problem, however i not want to use page, i just want to show image while App goes to background and when it comes to foreground it will hide.

Sign In or Register to comment.