When working with Lollipop, I have a device owner application that is installed with NFC at the time of provision.
Now I need to process automatic updates for my application from Google Play in order to rely on the standard Android application update system ...
So far I can imagine two ways to do this, but I don’t know how to handle them:
- in my NFC installation installation ADMIN PACKAGE ADDITIONAL DEVICE DOWNLOAD LOCATION install the application directly from the Play Store instead of the URL on my own server-dev.
However, this constant should handle the url of the apk file, and I did not find any official way to install apk directly from the Play Store? (since this will be an App product in the future, I'm not interested in hacks) - continue installing apk from the dev server, but then allow the application to update itself with your little brother located in the Play Store with the same package name.
We can talk about this: is it possible to install v1 apk from a user location, and then place v2 on the PlayStore ... and let the magic come true?
I would be happy to hear if anyone can share the experience of such procedures. Thanks for reading!
EDIT after @ Stephan Branczyk's suggestion, I could do some more tests, here is what I did and the results:1 - In NFC initialization, I replaced the apk URL with snep: //my.app.packagename with no luck; he just gives an error without much explanation.
2 - I replaced this URL with such a link in the PlayStore: https://play.google.com/store/apps/details?id=my.app.packagename , but it gives a checksum, regardless of whether I use checksum locally calculated or checksum specified in GooglePlay apk data. It doesn’t look so far from the goal, but I couldn’t get it to work.
3 - , - apk versioned 1... PlayStore 2 packagename... :
- PlayStore,
Google Play,
"" , ... .
- , , v2, nice
: PlayStore.
- , v3 ... ,
PlayStore (
), , , :
playstore ""...
, ; .
? - , Play Store, , , Device-Owner PlayStore?
, FYI - , :
try {
Properties p = new Properties();
p.setProperty(
DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME,
"my.app.packagename");
p.setProperty(
DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION,
"http://www.example.com/myDeviceOwnerApp.apk");
p.setProperty(
DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM,
"U55o3fO0cXQtUoQCbQEO9c_gKrs");
ByteArrayOutputStream bos = new ByteArrayOutputStream();
OutputStream out = new ObjectOutputStream(bos);
p.store(out, "");
final byte[] bytes = bos.toByteArray();
NdefMessage msg = new NdefMessage(NdefRecord.createMime(
DevicePolicyManager.MIME_TYPE_PROVISIONING_NFC, bytes));
return msg;
} catch (Exception e) {
throw new RuntimeException(e);
}