编程方式检查OTA的Android系统更新 [英] Programatically check for Android OTA system updates
问题描述
如果你去设置 - >关于电话 - >检查更新检查开始,看看是否theres任何系统更新准备好您的手机。
我如何做这个动作编程?此外,我想在这里找到在Android源$ C $ C发生这种情况,所以我可以完全看到它,并更好地理解它。有没有人有什么建议?
据我所知,目前还没有已知的广播,意图或API以编程方式做到这一点。
和它依赖于ROM中,和制造商。
索尼例如使用服务,当在WiFi被激活时,在索尼公司的服务器的任何更新和它通知服务检查。
但是,当谈到AOSP源代码,我不认为会发生。
中的系统更新的是包/应用程序/设置/ src目录/ COM /安卓/设置发现/ DeviceInfoSettings.java
<最近的点/ P>
Protip :grep的字符串系统更新的 RES /值
目录中和工作backwords,并找出该字符串变量标识符用!
修改
下面是一个例子广播接收器:
公共类SystemUpdateClass扩展的BroadcastReceiver {
@覆盖
公共无效的onReceive(上下文的背景下,意图意图){
如果(intent.getAction()。等于(android.settings.SYSTEM_UPDATE_SETTINGS)){
Toast.makeText(背景下,
是啊!收到系统更新广播,
Toast.LENGTH_SHORT).show();
}
}
}
下面是一个例子code,从一个活动的的onCreate
:
SystemUpdateClass sysUpdate =新SystemUpdateClass();
IntentFilter的过滤器=新的IntentFilter();
filter.addAction(android.settings.SYSTEM_UPDATE_SETTINGS);
registerReceiver(sysUpdate,过滤器);
现在,会发生什么是您的应用程序应该接收广播,除非我弄错了广播是一个系统签名的应用程序......然而,剩下的就是作为一个练习:)
If you go to Settings->About Phone->Check for updates a check is initiated to see if theres any system updates ready for your phone.
How can I do this action programmatically? Further, I am trying to locate where in the Android source code this happens so I can see it fully and understand it better. Does anyone have any suggestions?
As far as I know, there is no known broadcast, intent or API to do this programmatically.
And it depends on the ROM, and manufacturer.
Sony for example uses a service which, when the wifi is activated, the service checks on Sony's servers for any updates and informs of it.
But when talking about AOSP source, that I do not think happens.
The nearest point of System update is found in packages/apps/Settings/src/com/android/settings/DeviceInfoSettings.java
Protip: grep the string "System update" within the res/values
directory and work backwords and find out where that string variable identifier is used!
Edit:
Here's an example broadcast receiver:
public class SystemUpdateClass extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent){
if (intent.getAction().equals("android.settings.SYSTEM_UPDATE_SETTINGS")){
Toast.makeText(context,
"Yup! Received a system update broadcast",
Toast.LENGTH_SHORT).show();
}
}
}
Here's an example code, from within a activity's onCreate
:
SystemUpdateClass sysUpdate = new SystemUpdateClass();
IntentFilter filter = new IntentFilter();
filter.addAction("android.settings.SYSTEM_UPDATE_SETTINGS");
registerReceiver(sysUpdate, filter);
Now, what should happen is your app should receive the broadcast, unless I am mistaken that the broadcast is only for system-signed apps... however the rest is left as an exercise :)
这篇关于编程方式检查OTA的Android系统更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!