安装应用程序位于从NFC一个GooglePlay应用程序、NFC、GooglePlay

2023-09-07 01:09:22 作者:巴掌手瞬凉i

与棒棒堂的工作,我有一个的设备所有者的是与NFC在规定的时间安装的应用程序。 我现在需要的是处理自动更新我的应用程序,从谷歌播放依靠标准的Andr​​oid应用程序更新系统上...

到目前为止,我可以想像2的方法来完成这件事,但不知道如何处理其中任何一个:

在我NFC安装常数的附加PROVISIONING设备管理软件包 下载位置的直接从Play商店,而不是我自己的开发服务器上的URL安装应用程序。 但是 这需要不断地处理一个apk文件的URL,我没有发现任何 得到的apk从Play商店安装官方直接的方法吗? (因为它会 是一家集生产应用程序在未来,我不感兴趣的黑客) 在继续安装从开发服务器的APK,但允许应用程序 与它的小兄弟位于Play商店自行更新 使用相同的包名。 要说它的另一种方式:?这是否可以从自定义位置安装V1的apk,然后把V2的PlayStore ......,让神奇的应验

我会很高兴听到的​​话,任何人都可以分享这样的程序方面的经验。感谢您的阅读! 修改 @Stephan Branczyk的建议后,我可以做一些更多的测试,这里是我做过什么,结果:

1 - 在NFC配置我更换了APK URL以     SNEP://my.app.packagename没有运气;它只是给出了一个错误     没有太多的解释。

2 - 我用这样的PlayStore链接替换这个网址:      https://play.google.com/store/apps/details ?ID = my.app.packagename 但     它提供了一个校验和错误,我是否在本地使用校验     计算机,或在GooglePlay的apk细节给出的校验和。它看起来不那么远的目标,但我不能使它工作。

3 - 最后,我回来了我的第一个解决方案,自托管的apk     版本1 ......但这次我试图把在PlayStore一个较新     完全相同的包名的应用程序的第2版......这使我     奇怪的事情:

在第一个我的应用程序没有任何地方在当地PlayStore应用程序的出现, 但是当我在谷歌播放寻找它,它显示了绿 安装的徽章,并建议我做一个更新...所以没有一 然后,这第一手动更新后,应用程序是在V2,美观大方,和 好:它的出现也列在我的PlayStore 乐观,我上传的应用程序的V3 ......如果只是为了看我的 PlayStore会自动更新我的应用程序(如是否所有的 其他的),但遗憾的是没有运气:即使我的应用程序中仍列 playstore,并提出了更新按钮...它从来没有 通过自身的更新,因为它应该;我还需要手动在其上单击。

这难道不是一种奇怪的行为?如果一些有关于它的想法,我真的需要能够依靠Play商店的功能,但到目前为止没有运气,我不能相信设备 - 使用的应用程序分布不符合PlayStore兼容?

以防万一,仅供参考下面是我使用的那种配置code:

 尝试{
            属性P =新的属性();

            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 =新ByteArrayOutputStream();
            的OutputStream OUT =新的ObjectOutputStream(BOS);
            p.store(满分,);
            最后一个字节[]字节= bos.toByteArray();

            NdefMessage味精=新NdefMessage(NdefRecord.createMime(
                    DevicePolicyManager.MIME_TYPE_PROVISIONING_NFC,字节));
            返回味精;
        }赶上(例外五){
            抛出新的RuntimeException(E);
        }
 

解决方案

写你的包名作为的在标签AAR记录。

要确认此功能的工作原理,使用此应用写的标签。

Google Play应用商店或换新装 中国版将有独立账户

Working with Lollipop, I have a device-owner app that is installed with NFC at provision time. What I need now is to handle automatic updates for my App, from Google Play to rely on the standard Android App update system...

So far I can imagine 2 ways to get this done, but don't know how to handle any of them :

in my NFC install constant EXTRA PROVISIONING DEVICE ADMIN PACKAGE DOWNLOAD LOCATION install the App directly from the Play Store instead of the url on my own dev server. However this constant need to handle the url of an apk file, and I did not find any official way to get apk install direct from Play Store ? (as it will be a production App in the future I'm not interested in hacks) keep installing the apk from the dev server, but then allow the App to update itself with its little brother located on the Play Store with the same package name. To say it an other way: Would this be possible to install a v1 apk from a custom location, then put a v2 on the PlayStore... and let the magic come true ?

I'd be glad to hear if anyone could share experience about such procedures. Thanks for reading! EDIT after @Stephan Branczyk suggestion I could make some more testing, here is what I did and the results:

1 - In the NFC provisioning I replaced the apk url with snep://my.app.packagename without luck ; it just gives an error without much explanation.

2 - I replaced this url by such a PlayStore link : https://play.google.com/store/apps/details?id=my.app.packagename but it gives a checksum error whether I use the checksum locally computed, or the checksum given on the GooglePlay apk details. It looks not so far from the goal but I could not make it work.

3 - Finally I came back on my first solution, a self-hosted apk versioned 1... but this time I tried to put on the PlayStore a newer version 2 of the app with the exact same packagename... That led me to strange things:

At first my App did not appear anywhere in the local PlayStore App, but when I searched for it in Google Play, it showed up with the green "installed" badge, and it proposed me to make an update... So did I. Then, after this first manual update, the App is in v2, nice, and better: it appears well listed in my PlayStore. Optimistically, I uploaded a v3 of the App... just to see if my PlayStore would automatically update my app (as is does for all the other ones), but sadly no luck : even if my app is still listed in the playstore, and proposing the "update" button... it never updates by itself as it should ; I still need to click on it manually.

Isn't it a strange behavior ? If some have ideas about it, I would really need to be able to rely on the Play Store functionalities but so far no luck, and I cannot believe that Device-Owner app distribution is not compatible with PlayStore ?

Just in case, FYI here is the kind of provisioning code I'm using:

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);
        }

解决方案

Write your package name as an AAR record in the tag.

To confirm that this functionality works, use this app to write the tag with.