告诉我如何在 Unity3D 中获取 install referrer。我制作了一个 android 插件,在其中创建了一个从广播接收器继承的类。而在onreceive方法中,我发送数据,但是没有调用onreceive方法。接收器已添加到插件 Manifest 和 Unity manifest.Manifest:
<receiver
android:name="com.ahg.and.InstallReferrerReceiver"
android:exported="true"
android:permission="android.permission.INSTALL_PACKAGES">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
广播接收器:
public class InstallReferrerReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String referrer = intent.getStringExtra("referrer");
UnityPlayer.UnitySendMessage("Loader", "GetReferrer",referrer);
}
}
请告诉我,为什么不叫broadcastreceiver?