Analyticsservice Not Registered in the App Manifest - Error

AnalyticsService not registered in the app manifest - error

I am not sure if acting on this warning will solve the issue you're having (i.e. not seeing any information in the Analytics admin site).

Anyway, here is what you should add to AndroidManifest.xml inside the application tag if you want to get rid of this warning:

 <!-- Optionally, register AnalyticsReceiver and AnalyticsService to support background
dispatching on non-Google Play devices -->
<receiver android:name="com.google.android.gms.analytics.AnalyticsReceiver"
android:enabled="true">
<intent-filter>
<action android:name="com.google.android.gms.analytics.ANALYTICS_DISPATCH" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>

<!-- Optionally, register CampaignTrackingReceiver and CampaignTrackingService to enable
installation campaign reporting -->
<receiver android:name="com.google.android.gms.analytics.CampaignTrackingReceiver"
android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
<service android:name="com.google.android.gms.analytics.CampaignTrackingService" />

You don't have to add all of this, just add what you need. In your case, you apparently just need to add the AnalyticsService service.

Source: https://developer.android.com/reference/com/google/android/gms/analytics/GoogleAnalytics.html

Android - AnalyticsReceiver is not registered or is disabled?

Make sure you have AnalyticService enable in Manifest

   <service android:name="com.google.android.gms.analytics.AnalyticsService"
android:enabled="true"
android:exported="false"/>

And you haven't specify the GA_PROPERTY_ID(Tracking ID) in analytics_global_config.xml

you can't track without an ID

Edit: Sample sharing

EventLogUtil.class

public class EventLogUtil {

private static final String TAG = EventLogUtil.class.getSimpleName();
private FirebaseAnalytics firebaseAnalytics;
private static EventLogUtil eventLogUtil;

/**
* Param names can be up to 40 characters long, may only contain alphanumeric characters and
* underscores ("_"), and must start with an alphabetic character. Param values can be up to
* 100 characters long. The "firebase_", "google_" and "ga_" prefixes are reserved and should
* not be used.
* https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics.Param
*/
private static final int FIRE_BASE_MAX_KEY_EVENT_LENGTH = 40;
private static final int FIRE_BASE_MAX_VALUE_EVENT_LENGTH = 100;
private static final int FIRE_BASE_MAX_USER_PROPERTY_LENGTH = 36;

private EventLogUtil() {
}

private EventLogUtil(Context context) {
if (firebaseAnalytics == null) {
firebaseAnalytics = FirebaseAnalytics.getInstance(context);
}
}

public static EventLogUtil getInstance(Context context) {
if (eventLogUtil == null) {
eventLogUtil = new EventLogUtil(context);
}
return eventLogUtil;
}

public void logEvent(String eventName,
Map<String, String> eventParams) {
CustomEvent customEvent = new CustomEvent(eventName);
Bundle params = new Bundle();
if (eventParams != null && !eventParams.isEmpty()) {
eventParams.put("time_stamp", getCurrentUTCTime("MM/dd/yyyy h:mm:ss a"));
for (Map.Entry<String, String> entry : eventParams.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
key = removeExceedingCharacters(key, FIRE_BASE_MAX_KEY_EVENT_LENGTH);
value = removeExceedingCharacters(value, FIRE_BASE_MAX_VALUE_EVENT_LENGTH);
customEvent.putCustomAttribute(key, value);
params.putString(key, value);
}
}
firebaseAnalytics.logEvent(eventName, params);
Answers.getInstance().logCustom(customEvent);
}

public void setUserProperties(User user) {
try {
String baseJid = "anyID";
firebaseAnalytics.setUserId(baseJid);
firebaseAnalytics.setUserProperty("UserJid",
removeExceedingCharacters(baseJid, FIRE_BASE_MAX_USER_PROPERTY_LENGTH));
firebaseAnalytics.setUserProperty("UserName",
removeExceedingCharacters(user.getFullName(), FIRE_BASE_MAX_USER_PROPERTY_LENGTH));
} catch (Exception e) {
LogUtils.d(TAG, e.getMessage());
}
}

public void setAnalyticsCollectionStatus(boolean status) {
firebaseAnalytics.setAnalyticsCollectionEnabled(status);
}

public void trackCurrentScreen(Activity activity, String screenName) {
firebaseAnalytics.setCurrentScreen(activity, screenName, null);
Answers.getInstance().logContentView(new ContentViewEvent()
.putContentName(screenName)
.putContentType("Screen View")
.putContentId("screen-activity"));
}

public void trackException(Exception e) {
FirebaseCrash.report(e);
}

public static String getCurrentUTCTime(String dateFormat) {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat(dateFormat);
simpleDateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
return simpleDateFormat.format(new Date());
}

public static String removeExceedingCharacters(final String string, final int maxLength) {
try {
if (string != null &&
!string.isEmpty() &&
string.length() > maxLength) {
return string.substring(0, maxLength);
}
} catch (Exception e) {
LogUtils.d(TAG, e.getMessage());
}
return string;
}
}

And for including fabric see this

call it like

HashMap<String, String> hashForAnalytics = new HashMap<>();
hashForAnalytics.put(SOAP_SERVICE_EVENT_FAILURE, FALSE_RESPONSE + " " + serviceName);
EventLogUtil.getInstance(context).logEvent(SOAP_SERVICE_EVENT, hashForAnalytics);

Google Analytics not communicating to server - AnalyticsReceiver is not registered or is disabled - error

According to the mail that I recently received from Google Analytics team,

What does “stopped processing” mean?

New data you send to the Google Analytics properties listed above will
not be serviced and will therefore, not appear on your reports. This
will appear as though you are no longer sending app data to Google
Analytics.

What will happen to my Google Analytics properties listed above?

  • Reporting access through our UI and API access will remain available for these properties’ historical data until January 31,
    2020.

  • After our service is fully turned down in February 2020, these legacy properties will no longer be accessible via our Google
    Analytics UI or API, and the associated data will be deleted from
    Google Analytics servers. In advance of this turndown, we recommend
    that you retrieve this historical data through report exports.

NOTE: Bottomline, it is advised to follow and use the Firebase Analytics for reports.

google analytics v4 integration to my android app

Try resolving the issue by adding the following line in the dependencies of the project-level build.gradle:

classpath 'com.google.gms:google-services:1.5.0'

Error in Manifest after copy-paste code from google samples

When your IDE encounters a build error in the manifest, it is probably opening the build-generated manifest file to display the error. Any edits to this file have no effect, as it will be overwritten during the next build. Make sure you edit instead the AndroidManifest.xml file located somewhere under your /src directory.



Related Topics



Leave a reply



Submit