This is a wrapper for the Google Play Services related to games. This library was tested successfully with the API 37 of Google Play Services.
List of features:
The library is provided with its Java source code and a few B4A modules:
		
		
	
	
		
	
This file should look like this:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
To set up a game in the Google Play developer console, please read this, then this.
To get details about a returned status code, please read this.
			
			List of features:
- Sign-in: supported;
 - Achievements: supported;
 - Leaderboards: supported;
 - Real-time multiplayer: supported (NEW!);
 - Turn-based multiplayer: supported;
 - Level and XP: supported;
 - Gifts and requests: supported;
 - Events and quests: not supported;
 - Saved games: supported;
 - Notifications: supported;
 - Player stats: supported;
 - Nearby connections: supported.
 
The library is provided with its Java source code and a few B4A modules:
- ClsConnection: manages the sign-in, sign-out and connection events;
 - CodConverter: converts your data map to and from the byte array needed for the Saved Games service (this module requires three extra libraries: JSON, ByteConverter and RandomAccessFile) in case you don't own the DataCollection library;
 - CodTurnBasedMatch: helper module for turn-based matches.
 
- download the Google Play services SDK and Android Support Repository with the Android SDK manager;
 - copy the GooglePlayGameServices library (Jar+Xml) to your additional B4A libraries folder.
 
- add this line in the project attributes of your Main module:
B4X:#AdditionalJar: com.google.android.gms:play-services-games - add also this line if you want to access the Nearby Connections API:
B4X:#AdditionalJar: com.google.android.gms:play-services-nearby - add these lines to your manifest:
B4X:AddApplicationText( <meta-data android:name="com.google.android.gms.games.APP_ID" android:value="@string/app_id" /> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />) - add also these lines to the manifest if you want to access the Nearby Connections API:
B4X:AddApplicationText( <meta-data android:name="com.google.android.gms.nearby.connection.SERVICE_ID" android:value="$PACKAGE$" />) - copy the games-ids.xml file generated by your Google Play developer console in the Objects\res\values folder.
 
This file should look like this:
			
				B4X:
			
		
		
		<?xml version="1.0" encoding="utf-8"?>
<!--
Google Play game services IDs.
Save this file as res/values/games-ids.xml in your project.
-->
<resources>
  <string name="app_id">01234567890</string>
  <string name="achievement_win_on_a_very_large_map">CgkIuqeG8-kOEAIQAQ</string>
  <string name="achievement_win_on_a_large_map">CgkIuqeG8-kOEAIQAg</string>
  <string name="achievement_win_on_a_medium_map">CgkIuqeG8-kOEAIQAw</string>
  <string name="achievement_win_on_a_small_map">CgkIuqeG8-kOEAIQBA</string>
  <string name="achievement_win_on_a_very_small_map">CgkIuqeG8-kOEAIQBQ</string>
  <string name="leaderboard_main_score">CgkIuqeG8-kOEAIQBw</string>
</resources>
	To set up a game in the Google Play developer console, please read this, then this.
To get details about a returned status code, please read this.
Attachments
			
				Last edited: