Search code examples
androidbroadcastreceiver

Android BroadcastReceiver in external library?


currently I'm playing around with Android-SDK. The BroadcastReceiver is really interesting, because I can get referrer-information from the Googly Play-store. BroadcastReceiver with com.android.vending.INSTALL_REFERRER works perfectly fine if I'm using it in one project. But I want to write a small library to include in my projects and my implementation of the BroadcastReceiver (de.sm.android.reftest.RefReceiver) should be part of it. So I have two projects:

  1. ReferralTest, my main project (in project-properties: android.library.reference.1=../SDKTest)
  2. SDKTest, my library-project (in project-properties: android.library=true), containing de.sm.android.reftest.RefReceiver

My AndroidManifest.xml-file of my main project contains:

    <receiver android:name="de.sm.android.reftest.RefReceiver" android:exported="true">
        <intent-filter>
            <action android:name="com.android.vending.INSTALL_REFERRER" />
        </intent-filter>
    </receiver>

And this is not working. I'm not sure if it is not working in general (I don't think so) or if I'm to stupid (this is probably the problem).

Any help is appreciated.

Thanks in advance, Sascha


Solution

  • OK, I found the answer ... my implementation is correct, but my test with am broadcast was not ... This link was pretty helpful: How to test android referral tracking?