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

2012-03-28 Thread Ankit Kasliwal
thanks!!

On Wed, Mar 28, 2012 at 11:31 AM, Farhan Tariq  wrote:

> If you are calling location updates from gps in your activity, you can
> stop listening to location updates on onPause() method. In onResume(), you
> can start listening to it back again.
>
> If you are requesting location updates from a service, you should stop the
> service in the onPause() method of the activity, and handle it accordingly
> in onResume.
>
> On Wed, Mar 28, 2012 at 10:50 AM, Ankit Kasliwal <
> kasliwalankit2...@gmail.com> 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);
>> }
>>
>>
>>
>>
>>
>> --
>>
>> Thanks and Regards,
>>
>> Ankit Kasliwal
>> kasliwalankit2...@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+unsubscr...@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+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en




-- 

Thanks and Regards,

Ankit Kasliwal
kasliwalankit2...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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

2012-03-27 Thread Farhan Tariq
If you are calling location updates from gps in your activity, you can stop
listening to location updates on onPause() method. In onResume(), you can
start listening to it back again.

If you are requesting location updates from a service, you should stop the
service in the onPause() method of the activity, and handle it accordingly
in onResume.

On Wed, Mar 28, 2012 at 10:50 AM, Ankit Kasliwal <
kasliwalankit2...@gmail.com> 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);
> }
>
>
>
>
>
> --
>
> Thanks and Regards,
>
> Ankit Kasliwal
> kasliwalankit2...@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+unsubscr...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

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

2012-03-27 Thread Ankit Kasliwal
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);
}





-- 

Thanks and Regards,

Ankit Kasliwal
kasliwalankit2...@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+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en