我是一名游戏设计师和unity3d开发人员,具有平均的Android开发知识,基本上在游戏中工作,客户想要整合某些服务(voluum,heyZapp和Tapjoy),他们每个都需要以下接收器清单文件:
Voluum:
<receiver android:exported="true" android:name="com.voluum.sdk.VoluumForwardingBroadcastReceiver">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
HeyZap:
<receiver android:name="com.heyzap.sdk.ads.PackageAddedReceiver">
<intent-filter>
<data android:scheme="package" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
</intent-filter>
</receiver>
TapJoy:
<receiver android:name="com.tapjoy.InstallReferrerReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
在整合TapJoy,Voluum&amp;即使有两个接收器,HeyZap服务也能正常工作,但在添加TapJoy后,tapJoy工具不断显示此错误:
配置了多个InstallReferrerReceiver。请检查 资产/插件/ AndroidManifest.xml中
我认为这是因为Voluum&amp; TapJoy有相同的意图过滤器吗?有这个问题的解决方法吗?
在其中一个tapJoy documentation page中,他们通过这个清单示例专门强调了这个问题:
<receiver android:name="com.tapjoy.InstallReferrerReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER"/>
</intent-filter>
<meta-data android:name="OtherReceiver1" android:value="com.example.OtherReceiver1"/>
<meta-data android:name="OtherReceiver2" android:value="com.example.OtherReceiver2"/>
</receiver>
所以我试着按照他们的所作所为并合并了TapJoy&amp;像这样的志愿接收者:
<receiver android:name="com.tapjoy.InstallReferrerReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
<meta-data android:exported="true" android:name="voluum" android:value="com.voluum.sdk.VoluumForwardingBroadcastReceiver" />
</receiver>
编辑:以下引用已修复
但是现在我甚至无法安装游戏,首先是图标没有显示, 相反,有默认的Android包图标,当我尝试 安装游戏它显示此错误:
解析包
时出现问题
现在我在初始化Voluum SDK时遇到错误:
最后,万一你需要它,这里是整个清单文件:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="preferExternal" android:theme="@android:style/Theme.NoTitleBar" package="com.publisherCompany.lines" android:versionName="1.0" android:versionCode="1">
<uses-permission android:name="com.android.vending.BILLING" />
<supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
<application android:icon="@drawable/app_icon" android:label="@string/app_name" android:debuggable="true" android:name="com.soomla.SoomlaApp">
<activity android:name="com.unity3d.player.UnityPlayerActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="portrait">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
<meta-data android:name="unityplayer.UnityActivity" android:value="true" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
<activity android:name="com.unity3d.player.UnityPlayerNativeActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="portrait">
<meta-data android:name="android.app.lib_name" android:value="unity" />
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</activity>
<activity android:name=".Main" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:label="@string/app_name">
</activity>
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
<activity android:name="com.unity3d.player.UnityPlayerProxyActivity" android:launchMode="singleTask" android:label="@string/app_name" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:screenOrientation="landscape">
</activity>
<!-- Google Play -->
<!-- -->
<!-- -->
<meta-data android:name="billing.service" android:value="google.GooglePlayIabService" />
<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
<!-- End Google Play -->
<!-- -->
<!-- -->
<!-- -->
<!-- -->
<!-- voluum
<receiver android:exported="true" android:name="com.voluum.sdk.VoluumForwardingBroadcastReceiver">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>-->
<!-- End voluum -->
<!-- -->
<!-- -->
<!-- HeyZap -->
<!-- adClony -->
<activity android:name="com.jirbo.adcolony.AdColonyOverlay" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.jirbo.adcolony.AdColonyFullscreen" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
<activity android:name="com.jirbo.adcolony.AdColonyBrowser" android:configChanges="keyboardHidden|orientation|screenSize" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" />
<!-- End adClony -->
<!-- chartboost -->
<activity android:name="com.chartboost.sdk.CBImpressionActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" android:excludeFromRecents="true" />
<!-- End chartboost -->
<!-- Applovin -->
<meta-data android:name="applovin.sdk.key" android:value="sbF7fJhkR0VfbTLbqNDyeid0pi2bTuxKUBR8U8sw8LZkvwKkHTfxFHy3_-eTtaoLmDUFLL9UhkDadXJw5-sKGo" />
<activity android:name="com.applovin.adview.AppLovinInterstitialActivity" />
<activity android:name="com.applovin.adview.AppLovinConfirmationActivity" />
<!-- End Applovin -->
<activity android:name="com.heyzap.sdk.ads.HeyzapInterstitialActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
<activity android:name="com.heyzap.sdk.ads.HeyzapVideoActivity" android:configChanges="keyboardHidden|orientation|screenSize|smallestScreenSize" />
<activity android:name="com.heyzap.sdk.ads.HeyzapProxyActivity" />
<!--<activity android:name="com.heyzap.sdk.ads.VASTActivity" />-->
<receiver android:name="com.heyzap.sdk.ads.PackageAddedReceiver">
<intent-filter>
<data android:scheme="package" />
<action android:name="android.intent.action.PACKAGE_ADDED" />
</intent-filter>
</receiver>
<!-- End HeyZap -->
<!-- -->
<!-- -->
<!-- Others -->
<activity android:name="com.mobilefuel.sdk.AdInterstitialActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:label="AD" android:exported="false" />
<activity android:name="com.facebook.unity.FBUnityLoginActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.unity.FBUnityDialogsActivity" android:configChanges="fontScale|keyboard|keyboardHidden|locale|mnc|mcc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|uiMode|touchscreen" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.LoginActivity" android:configChanges="keyboardHidden|orientation" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen">
</activity>
<activity android:name="com.facebook.unity.FBUnityDeepLinkingActivity" android:exported="true">
</activity>
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="\ 503591776472556" />
<!--End Others -->
<!-- TapJoy activities -->
<activity android:name="com.soomla.store.billing.google.GooglePlayIabService$IabActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.tapjoy.TJAdUnitActivity" android:configChanges="orientation|keyboardHidden|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" android:hardwareAccelerated="true" />
<activity android:name="com.tapjoy.mraid.view.Browser" android:configChanges="orientation|keyboardHidden|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<activity android:name="com.tapjoy.mraid.view.ActionHandler" android:configChanges="orientation|keyboardHidden|screenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar.Fullscreen" />
<meta-data android:name="com.tapjoy.appstore" android:value="Google" />
<receiver android:name="com.tapjoy.InstallReferrerReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
<meta-data android:exported="true" android:name="Voluum" android:value="com.voluum.sdk.VoluumForwardingBroadcastReceiver" />
</receiver>
<!--End TapJoy activities -->
</application>
<uses-feature android:glEsVersion="0x00020000" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="21" />
</manifest>
编辑从Voluum接收器中删除此行
<action android:name="com.android.vending.INSTALL_REFERRER" />
允许我安装游戏并使新的sdk(tapjoy)正常工作,但现在根本没有调用Voluum
谢谢大家,祝你有个美好的一天
答案 0 :(得分:1)
设计一个普通的接收器,它可以根据需要触发所有其他接收器。
public class ManyInstallTrackersReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
InstallReferrerReceiver mixpanelReferrerTracking = new InstallReferrerReceiver();
mixpanelReferrerTracking.onReceive(context, intent);
// Now you can pass the same intent on to other services,
// or process it yourself
}
}
然后,在您的AndroidManifest.xml中,无论您想要什么,都可以引用此类而不是Voluum,Tapjoy,Blabla:
<receiver
android:name="my_great_package.ManyInstallTrackersReceiver"
android:exported="true">
<intent-filter>
<action
android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>