Android Question Google Play Services - Where is it?

JohnC

Expert
Licensed User
Longtime User
I'm trying to add Google Analytics to an app (yes, I know firebase is also recommended, but google's analytics seems to offer some things firebase doesn't), and anyway I want to understand this whole play services thing...

So, I know at least that I need to have google play services to use analytics.

But, there seems to be conflicting info on how to include Google Play Services in your app:

1) The below thread from 2014 seems to indicate that if you are using B4A v6+ you no longer need to use the SDK manager to download the required file "google-play-services.jar".

https://www.b4x.com/android/forum/threads/google-play-services-installation-tips.45843/

So it gives me the impression that Google Play Services is managed by B4A 6+ in some way.

2) Then this 2016 thread seems to indicate that the required google play services for analytics can be loaded using this line of code:

B4X:
#AdditionalJar: com.google.android.gms:play-services-analytics

(on this page: https://www.b4x.com/android/forum/threads/firebase-the-old-analyticsv4-lib.68110/#post-431625)

So, I then think that this must be the new way to add play services to my app using B4A 6+.

3) But, then this thread from 2017 seems to indicate that the "User" needs to have a separate play services APK installed on their device:

https://www.b4x.com/android/forum/threads/check-and-install-google-play-services.84813/

So, can someone shed some light on what's going on?

A) Do I need google-play-services.jar?
B) If I set my minsdk to android 4.x, is it safe to assume that the user's device has play services on it?

Any help would be appreciated!
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
1) The below thread from 2014 seems to indicate that if you are using B4A v6+ you no longer need to use the SDK manager to download the required file "google-play-services.jar".

https://www.b4x.com/android/forum/threads/google-play-services-installation-tips.45843/
As it is clearly written in that tutorial, it is not relevant if you are using B4A v6+. No reason to ask any question about it.

A) Do I need google-play-services.jar?
No.

Then this 2016 thread seems to indicate that the required google play services for analytics can be loaded using this line of code:
2) Add that line to your code and it will work.

Google Analytics will probably work even if Google Play Services is not installed on the device. Your app never includes Google Play Services. The app only includes "wrappers" that work with the already installed google play services.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Your app never includes Google Play Services. The app only includes "wrappers" that work with the already installed google play services.

That bit of info was VERY helpful - now things make sense. Thank you!
 
Upvote 0
Top