拦截 INSTALL_REFERRER,然后转发到 Google AnalyticsReceiver [英] Intercept INSTALL_REFERRER and then forward on to Google AnalyticsReceiver
问题描述
我编写了一个安装接收器来确定何时通过市场安装了应用程序.但是,我还想将 INSTALL_REFERRER 广播传递到其他接收器,例如 Google Analytics AnalyticsReceiver
(如果它安装在应用程序中).重要的是,我不知道是否安装了其他接收器,因为其他开发者会在他们的应用中使用我的接收器.
I have written an install receiver to determine when an app has been installed via the Market. However, I also want to pass the INSTALL_REFERRER broadcast onto other receivers such as the Google Analytics AnalyticsReceiver
if it is installed within the app. Importantly, I do NOT know if other receivers are installed as my receiver will be used by other developers within their apps.
目前,我收到广播,完成后调用:
Currently, I receive the broadcast and when complete I call:
AnalyticsReceiverReceiver = new AnalyticsReceiver();
receiver.onReceive(context, intent);
问题是 AnalyticsReceiver
类可能不存在.
The issue is the AnalyticsReceiver
class may not be present.
如果我不确定应用程序是否使用 AnalyticsReceiver
,我该如何传递广播?
So how do I pass on the broadcast if I'm not sure whether the app uses the AnalyticsReceiver
?
或者 Android 本身会确保安装的每个接收器都能收到广播?
Or will Android itself make sure each receiver installed gets the broadcast?
非常感谢!
推荐答案
这并没有真正回答问题,但是 INSTALL_REFERRER
的唯一预期目标是 Google Analytics 库,因此有对广播中包含的数据(或与广播有关的任何内容)的零保证,因此您不应依赖它.
This doesn't really answer the question, but the only intended destination for INSTALL_REFERRER
is the Google Analytics library, and thus there are zero guarantees about the data contained in the broadcast (or anything about the broadcast for that matter), so you shouldn't rely on it.
顺便说一下,这里有一些相关的 S.O.问题:
On a side note, here are some related S.O. questions:
这篇关于拦截 INSTALL_REFERRER,然后转发到 Google AnalyticsReceiver的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!