OTA更新设备所有者Android应用程序(Kiosk模式) [英] OTA updates for Device Owner Android Application(Kiosk mode)
问题描述
我能够让我的应用程序,通过NFC设备所有者的应用程序所提到的此处。现在我想更新我的应用程序在空中,但我无法找到一个方法不生根
I am able to make my app, the device owner app through NFC as mentioned here. Now I want to update my app over the air, but I couldn't find a method without rooting.
谷歌正在为企业发展的应用程序提供了许多选项提到此处,但无处提供了一种更新通过OTA的应用程序。
Google is providing many options for enterprises to develop apps as mentioned here, but nowhere providing a way to update the application through OTA.
寻找一个解决方案。
推荐答案
这只是纯粹的炒作,因为我从来没有尝试使用安装程序包API自己:
This is just pure speculation as I've never tried to use the package installer API myself:
您可以尝试(使用 PackageManager.setInstallerPackageName()
)为您的设备拥有者的应用程序设置一个安装包。该安装包将需要一个单独的APK具有相同的证书作为设备所有者APK签名。
You could try to set an installer package for your device owner app (using PackageManager.setInstallerPackageName()
). This installer package would need to be a separate APK signed with the same certificate as the device owner APK.
getPackageManager().setInstallerPackage("<device.owner.package.name>", "<installer.package.name>");
从您的安装APK,然后你可以用 PackageInstaller
来prepare更新:
From your installer APK, you could then use PackageInstaller
to prepare an update:
PackageInstaller pi = getPackageManager().getPackageInstaller();
int sessId = pi.createSession(new PackageInstaller.SessionParams(PackageInstaller.SessionParams.MODE_FULL_INSTALL));
PackageInstaller.Session session = pi.openSession(sessId);
OutputStream out = session.openWrite("app");
// .. write updated APK file to out
session.fsync(out);
session.commit(...);
session.close();
我不知道这悄无声息,虽然安装的更新(如该工作在所有我本来期望的方式)。
I'm not sure if this silently installs your update though (or if that works at all in the way I would have expected).
这篇关于OTA更新设备所有者Android应用程序(Kiosk模式)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!