禁用/ android系统编程启用移动数据 [英] Disable/Enabling mobile data programatically in android

查看:159
本文介绍了禁用/ android系统编程启用移动数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想启用/禁用移动数据。

首先,是有可能实现吗?

我是通过下面的链接去了

如何在Android上禁用移动数据

<一个href=\"http://stackoverflow.com/questions/11555366/enable-disable-data-connection-in-android-programmatically\">Enable/disable在Android的数据连接编程

但我没有得到正确的方式来实现这一点。

获取的InvocationTargetException并不能添加MODI​​FY_PHONE_STATE也在Android清单文件,因为它是唯一一个系统的权限。

和从论坛上,我才知道,那是后姜饼。pcated德$ P $

所以请谁能帮助我正确的一步我是如何实现这一点。

先谢谢了。


解决方案

  

我想启用/禁用移动数据。


  
  

首先,是有可能实现吗?


没有,那是不可能的第三方应用程序来实现。启用/禁用移动数据应通过系统设置应用程序的用户界面来完成。

你可以做的是提供一个指令来结束如何启用/禁用移动数据,并引导他们设置的应用程序的用户。

I am trying to enable/disable mobile data.

First, is it possible to implement this?

I am gone through the below link

How to disable Mobile Data on Android

Enable/disable data connection in android programmatically

But i am not getting the right way to implement this.

Getting InvocationTargetException and not able to add MODIFY_PHONE_STATE also in android manifest file as it is a system-only permission.

And from forum i came to know that it was deprecated after Gingerbread.

so please can anyone help me with right step how i need to implement this.

Thanks in advance.

解决方案

I am trying to enable/disable mobile data.

First, is it possible to implement this?

No, that's not possible to achieve by third-party apps. Enabling/disabling mobile data should be done through system Settings app UI.

What you can do is to provide an instruction to end user on how to enable/disable mobile data and direct them to Settings app.

这篇关于禁用/ android系统编程启用移动数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆