0

com.google.android.gms.analytics.samples.mobileplayground has things like this in its AndroidManifest.xml:

<activity android:name=".EventFragment"
        android:label="@string/app_name"></activity>

Fragments in the manifest. That used to be a no-no, though it is being done now, apparently.
The Android docs are a vast maze of sometimes contradictory information, where can I get some reference (like this) - purpose, possibilities, limitations, etc?

[edit] Irritating that to disprove legit usage of Fragments in this way, we need someone of authority (google dev or someone very up-to-date on what they churn out), anyone else would just be guessing.

Community
  • 1
  • 1
kaay
  • 1,083
  • 1
  • 12
  • 31
  • That is so weird. On the other hand, the analytics documentation (especially for v4) is patchy at best, so I'm not sure I believe that Fragments in the manifest is really a thing... – stkent Jan 09 '15 at 14:28

1 Answers1

3

That's a confusing thing the sample does. It is technically invalid and accomplishes nothing as no part of the sample app tries to do a startActivity() for one of those and they are all non-exported because there's no <intent-filter> set for those entries. If they did have an intent filter set for them or something tries to activate it via an explicit Intent it would fail because that class is not an Activity. You cannot have a Fragment without a hosting Activity.

Larry Schiefer
  • 15,687
  • 2
  • 27
  • 33
  • So just to be clear: Frags in Manifest is utter nonsense in general, or just here? Maybe it's just a dirty trick to get [screenName tracking](https://developers.google.com/analytics/devguides/collection/android/v4/screens) to automatically work for Fragments? – kaay Jan 12 '15 at 07:35
  • That may be a little trickery the analytics auto screen tracking is using. I can't say for sure at this point. – Larry Schiefer Jan 12 '15 at 13:20