App restarts instead of resuming when relaunching from app icon after home button is pressed in signed apk

1.6k Views Asked by At

I have an activity in which a form is to be filled by the user.In this activity I am saving data in onPause method and show it back when activity resumes.This works perfectly when i test it in debug mode but when i run signed apk after pressing home button and relaunching the app by clicking app icon the launcher activity is shown.

I have tried following in Manifest inside formActivity as stated in the following SO questions

  1. android:launchMode="singleTask"
  2. android:finishOnTaskLaunch="false"

Ques 1 Ques 2

but nothing changed.

It seems like onResume never gets called when app icon is pressed after home button.

My onPause and onResume methods :

@Override
    protected void onPause() {

        super.onPause();
        saveFormData(); //function where i save form data 
    }



@Override
    protected void onResume() {

        if (!isActivityCalledFirsTime) {

            showSavedFormData(); // function where i show saved data

        }
        isActivityCalledFirsTime = false;
        super.onResume();
    }

Problem :

1) Why onResume is not called on relaunching the app by clicking app icon ?

2) Is there any other method other than onResume which i can use for signed apk ?

Note : Application behaves normally when launched from recent apps after pressing home button

0

There are 0 best solutions below