How does android package manager know what to inst

2019-09-08 06:46发布

When you visit the market place web site on a desktop browser and log in with your account it knows about your devices and what apps do and do not work on it. Fairly understandable how they do this.

What is intriguing is the feature whereby you can click the install button on the web site and the app is then automatically downloaded and installed on the phone. Now that is magic! How does this push notification work?

Is it something that can only be done via the market place web site or is it a feature that can be used by third parties to trigger installations? My use case is to drastically simplify the use of a QR code to install an application. The QR code take the user to a mobile web page that has informative content (e.g. about a painting in a museum) and also has a button to allow the user to install the corresponding application that has the same but offline content. The app would installed without going via the market place and thus losing the user's immediate attention.

I expect that the answer is "you can't do that" but rather than live under that presumption I thought that I'd ask. Is there another way to achieve my use case?

2条回答
疯言疯语
2楼-- · 2019-09-08 07:18

There are certain security measures which prevent automatic installs from unknown sources.

Outside of Android Market, downloading & installing are two separate steps. The QR code which takes a user to a web page, that bit is easy: Just embed a URL in a QR code. When the user goes to the page, they can download the APK file as an attachment (just link to it somewhere on the page).

However, the user then needs to manually select the APK from their downloads section, and explicitly indicate they wish to install it (just a button click). The user also needs to enable downloading from "unknown sources" on their device. This can be enabled in the Settings App, usually in a security area. The feature may be disabled by certain carriers. Note that any "Market" type app or mechanism for downloading APK's which didn't come pre-installed on the device is going to count as an unknown source (websites are counted as unknown sources)- For instance, using the Amazon Market app requires a tick in that checkbox.

查看更多
老娘就宠你
3楼-- · 2019-09-08 07:25

In general much work was done to ensure any applications being installed require explicit action to be taken by the user(i.e. view the permissions and press the install button). This behavior that the Market service exhibits is one of the few things that sort of sidesteps this process but I would assume the logic behind it is that the user viewed the permissions and agreed to the install on the web front end so it would be redundant to make them do it again.

As far as I am aware the use case which you mentioned (user is browsing on PC and installs app to one of their devices from there) is the only situation where it works like this. I don't believe the market offers any way for 3rd parties to tie into this and distribute their applications in this manner (other than the market web front end).

So in short, no there isn't really any other good way to push applications like that.

Im sure you could set up something that behaves similarly but it would rely on something extra being done to or installed on the device and as such it wouldn't work on stock devices which means 90% or more of people wouldn't be able to use it.

I do agree with your motivation though, it seems like a trivial process to some of us to install an app from a QR, but the general public is not yet at a point where you can count on them get it it all done correctly and quickly enough that their attention is still focused on whatever it was, in your case the item in the museum.

查看更多
登录 后发表回答