2

I wanna know can we close the application(Adobe reader for Pdf,DocumentsToGo for PPt) which are used to open implicit intent after activity result, for example:

 File file = ClassName.this.getFileStreamPath(fileName);
            file.setReadable(true, false);
            Uri path = Uri.fromFile(file);
            contId = contentId[position];
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setDataAndType(path, "application/pdf");
            try {
                startTime = System.currentTimeMillis();
                startActivityForResult(intent, 6002);

            } catch (ActivityNotFoundException e) {
                Toast.makeText(Introduction.this,
                        "No Application Available to View PDF",
                        Toast.LENGTH_SHORT).show();}

is used to view pdf when i press back button i get the onactivityResult but after that if i'll minimize my application , the adobe reader continues to open in background I can see adobe with that opened file in task manager . Sorry if my question is not clear. Answers will be appreciated.

protected void onActivityResult(int requestCode, int resultCode, Intent data) {

        super.onActivityResult(requestCode, resultCode, data);

        if (requestCode == 6002) {
            endTime = System.currentTimeMillis();
            duration = endTime - startTime;
            durationString = "" + duration;
            save();
            finish();
        }
}
Shubham
  • 1,442
  • 3
  • 16
  • 34
  • In other words, you want to kill Adobe PDF reader's process from your app? That's not possible. – ozbek Feb 21 '14 at 10:05

2 Answers2

0

when I exit the application

There is no "exit the application" in Android.

I can see adobe in application manager

I do not know what you think the "application manager" is. However, it is perfectly normal for application processes to run even after they have left the foreground. Android does this for efficiency, in case the user elects to return to that app right away, so it does not have to waste time and battery setting up another process. Android will terminate the background process when it needs to, in order to free up system RAM for other processes.

Hence, there is nothing that you need to do.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I mean to say when my application exits. and you will find application manager i.e. task manager in each tab. – Shubham Aug 16 '13 at 14:16
0

There's no way to kill another application without root access(and for very good reasons).

But you could try adding the exclude from recents flag to the intent. That might make it a little more quiet in terms of the user being able to see it.

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(path, "application/pdf");
intent.addFlag(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS);
Tristan Burnside
  • 2,546
  • 1
  • 16
  • 23