That's right, but the "hey, but this app can!" game doesn't really
work in this case...

kris

On Tue, Jul 31, 2012 at 8:56 PM, CJ <joven.ch...@gmail.com> wrote:
> Hi, I understand. There are many popular app that automate system task with
> big user base.
> APNDroid, JuiceDefender, Motorola SmartAction etc so many. So likely there
> is no answer other than using what APNDroid is using and it is likely going
> to be future version proof.
>
>
> On Wednesday, 1 August 2012 02:59:45 UTC+8, Kristopher Micinski wrote:
>>
>> This goes in the category of "apps modifying the system."
>>
>> Your app shouldn't be able to modify the system.  While this sounds
>> funny, it's true.  Sure, you can write such apps and hack around
>> things below 2.3.3, but do you really expect your app will really be
>> used for that long, then?
>>
>> kris
>>
>> On Tue, Jul 31, 2012 at 12:38 PM, CJ wrote:
>> > The permission needed is <uses-permission
>> > android:name="android.permission.CHANGE_NETWORK_STATE"/>
>> > Android 2.3 and above can do that with the code I supply. I am asking a
>> > question how to do it for version below 2.3.
>> >
>> > Many apps are doing it, the most popular one I mentioned was
>> > JuiceDefender:
>> >
>> > http://maketecheasier.com/increase-phones-battery-life-with-juicedefender-android/2011/02/25
>> >
>> > On Wednesday, 1 August 2012 00:28:33 UTC+8, Robert Greenwalt wrote:
>> >>
>> >> How to do the permission?  That's not your issue - the platform needs
>> >> to
>> >> do it.
>> >>
>> >> How to turn data on/off?  It looks like you'll need a mix of methods.
>> >> You're using undocumented methods from the past and present and they
>> >> may
>> >> change in the future.  You can do different things dependent on the
>> >> version
>> >> of the platform.
>> >>
>> >>
>> >> On Tue, Jul 31, 2012 at 9:18 AM, wrote:
>> >>>
>> >>> Yes, the next qns is how to do it...
>> >>>
>> >>> On Wed, Aug 1, 2012 at 12:14 AM, Robert Greenwalt
>> >>> <rgreenw...@google.com>
>> >>> wrote:
>> >>>>
>> >>>> If the app is granted permission by the user it would be ok.  And
>> >>>> apps
>> >>>> that do intelligent things in this area may be useful and welcome.
>> >>>> Without
>> >>>> permission limits though, yeah this could be a problem.
>> >>>>
>> >>>>
>> >>>> On Tue, Jul 31, 2012 at 9:04 AM, Nick Kralevich <n...@google.com>
>> >>>> wrote:
>> >>>>>
>> >>>>>
>> >>>>> Hmm....  From the platform's point of view, this sounds like a
>> >>>>> denial
>> >>>>> of service attack against other applications on the device. One
>> >>>>> application
>> >>>>> shouldn't be able to interfere with another application's network
>> >>>>> connectivity without the user being involved.
>> >>>>>
>> >>>>> -- Nick
>> >>>>>
>> >>>>>
>> >>>>> On Tue, Jul 31, 2012 at 8:26 AM, CJ wrote:
>> >>>>>>
>> >>>>>> Hi, I am working on a app to automate some setting eg. to perform
>> >>>>>> certain action such as disable mobile data when battery is low or
>> >>>>>> night mode
>> >>>>>> etc.
>> >>>>>> There are app in the market that able to disable/enable mobile data
>> >>>>>> connection like SmartAction and a few more. I also dislike the
>> >>>>>> alter APN
>> >>>>>> method so I am looking for better alternatives.
>> >>>>>>
>> >>>>>> On Tuesday, 31 July 2012 23:14:41 UTC+8, Robert Greenwalt wrote:
>> >>>>>>>
>> >>>>>>> Apps won't be able to alter the APN database after Honeycomb or
>> >>>>>>> perhaps ICS.  The User can disable data from settings.  Why does
>> >>>>>>> an
>> >>>>>>> application need to disable data?
>> >>>>>>>
>> >>>>>>>
>> >>>>>>> On Tue, Jul 31, 2012 at 8:03 AM, CJ wrote:
>> >>>>>>>
>> >>>>>>>> Hi,
>> >>>>>>>>
>> >>>>>>>> I have been googling for a while able the best or right way to
>> >>>>>>>> disable/enable mobile network.
>> >>>>>>>>
>> >>>>>>>> I tried the following code which is all over Stackoverflow and is
>> >>>>>>>> working fine for gingerbread and higher:
>> >>>>>>>>
>> >>>>>>>> private void setMobileDataEnabled(Context context, boolean
>> >>>>>>>> enabled)
>> >>>>>>>> throws Exception {
>> >>>>>>>> final ConnectivityManager conman = (ConnectivityManager) context
>> >>>>>>>> .getSystemService(Context.CONNECTIVITY_SERVICE);
>> >>>>>>>> final Class<?> conmanClass =
>> >>>>>>>> Class.forName(conman.getClass().getName());
>> >>>>>>>> final Field iConnectivityManagerField = conmanClass
>> >>>>>>>> .getDeclaredField("mService");
>> >>>>>>>> iConnectivityManagerField.setAccessible(true);
>> >>>>>>>> final Object iConnectivityManager = iConnectivityManagerField
>> >>>>>>>> .get(conman);
>> >>>>>>>> final Class<?> iConnectivityManagerClass = Class
>> >>>>>>>> .forName(iConnectivityManager.getClass().getName());
>> >>>>>>>> final Method setMobileDataEnabledMethod =
>> >>>>>>>> iConnectivityManagerClass
>> >>>>>>>> .getDeclaredMethod("setMobileDataEnabled", Boolean.TYPE);
>> >>>>>>>> setMobileDataEnabledMethod.setAccessible(true);
>> >>>>>>>>
>> >>>>>>>> setMobileDataEnabledMethod.invoke(iConnectivityManager, enabled);
>> >>>>>>>> }
>> >>>>>>>>
>> >>>>>>>> Somehow I didn't find a way to do the same thing for Android 2.2
>> >>>>>>>> and
>> >>>>>>>> below. Many mentioned to change the APN name to something invalid
>> >>>>>>>> like what
>> >>>>>>>> app APNDroid did but is that the only way?
>> >>>>>>>>
>> >>>>>>>> --
>> >>>>>>>> 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
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>>
>> >>>>> --
>> >>>>> Nick Kralevich | Android Security | n...@google.com | 650.214.4037
>> >>>>>
>> >>>>> --
>> >>>>> 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
>> >>>
>> >>>
>> >>> --
>> >>> 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
>
> --
> 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

Reply via email to