yandexmobile / metrica-plugin-unity

Unity plugin for Yandex AppMetrica SDK
38 stars 18 forks source link

Appmetrica does not send any data to server #10

Closed rganeyev closed 7 years ago

rganeyev commented 7 years ago

I integrated Appmetrica according to the documentation.

In the android game, nothing is being sent to the server. It looks like I did not send any data, a fresh empty project without any user. I double checked API key, it is correct.

YandexAppMetricaAndroid class is being initialized, metricaClass inside it is not null.

Here what I have in the adb logcat:

04-29 01:54:59.524: I/AppMetrica(20634): Initializing of Metrica, Release type, Version 2.62, API Level 52, Dated 30.12.2016.

04-29 01:54:59.638: W/ActivityManager(1329): Unable to start service Intent { act=com.yandex.metrica.IMetricaService dat=metrica://com.smmpartizan.airborneracer flg=0x20 pkg=com.smmpartizan.airborneracer (has extras) } U=0: not found
bamx23 commented 7 years ago

Looks like there is a problem in your AndroidManifest.xml. Did you add lines related to AppMetrica? Example is available in Assets/AppMetrica/Plugins/Android/AndroidManifest.xml

rganeyev commented 7 years ago

Here is my final AndroidManifest.xml (got from decompiled apk). AndroidManifest.xml

<receiver android:enabled="true" android:exported="true" android:name="com.yandex.metrica.MetricaEventHandler">
            <intent-filter>
                <action android:name="com.android.vending.INSTALL_REFERRER"/>
            </intent-filter>
        </receiver>
        <service android:name="com.androidnative.features.notifications.LocalNotificationService"/>
        <service android:enabled="true" android:exported="true" android:name="com.yandex.metrica.MetricaService" android:process=":Metrica">
            <intent-filter>
                <action android:name="com.yandex.metrica.IMetricaService"/>
                <category android:name="android.intent.category.DEFAULT"/>
            </intent-filter>
            <meta-data android:name="metrica:api:level" android:value="52"/>
        </service>

As you see, needed service and receiver are declared in the manifest. Is it ok? Any thoughts?

AlexeiVitenko commented 7 years ago

I can't find <data> section in your MetricaService intent filter. Look at this line: https://github.com/yandexmobile/metrica-plugin-unity/blob/master/YandexMetricaPluginSample/Assets/AppMetrica/Plugins/Android/AndroidManifest.xml#L33 So, system can't find service, that can handle data with scheme "metrica". dat=metrica://com.smmpartizan.airborneracer

rganeyev commented 7 years ago

Yep, that was a problem. Everything works like a charm.

Thank you!

AlexeiVitenko commented 7 years ago

I'm glad to hear it. You're welcome!