Wednesday, March 28, 2012

Re: [android-developers] Re: How I disable GPS when i exit Application

Follow the proper application/activity lifecycle. Let the user decide (by pressing the Back button), or call finish() in your activity.

If you properly stop listening to the GPS, and were the only listener, the GPS icon will disappear after a few seconds.

On Wednesday, March 28, 2012 4:58:08 AM UTC-4, Ankit Kasliwal wrote:
so can you tell me the process

On Wed, Mar 28, 2012 at 2:25 PM, Johan Appelgren <johan.appelgren@gmail.com> wrote:
It is still the wrong thing to do. Just because the API allows you to do something wrong doesn't mean you have to do it. 


On Wednesday, March 28, 2012 10:41:04 AM UTC+2, Ankit Kasliwal wrote:
Johan i use that command the it's working properly.

On Wed, Mar 28, 2012 at 12:39 PM, Johan Appelgren wrote:
Afaik you should never use android.os.Process.killProcess or ActivityManager.killBackgroundProcesses.


On Wednesday, March 28, 2012 7:50:40 AM UTC+2, Ankit Kasliwal wrote:
Hello,
         I have problem in my application when i press exit i try to close all my activity but GPS running so how i disable GPS status and close my application (because when i go to Application manager it's show mw my application running and force close button enable)

my code to close all activity are..


android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);

killThisPackageIfRunning(HomePage.this,getApplication().getPackageName());
finish();

public static void killThisPackageIfRunning(final Context context, String packageName){
        ActivityManager activityManager = (ActivityManager)context.getSystemService(Context.ACTIVITY_SERVICE);
        activityManager.killBackgroundProcesses(packageName);
    }

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en



--

Thanks and Regards,

Ankit Kasliwal
kasliwalankit2000@gmail.com
+91-9300-940-136

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment