DonFrag
(DonFrag)
1
hi i am trying to implement this using a UPL
public int AndroidThunkJava_GetPlayerLeaderBoardPosition()
{
if(googleClient==null)
return -2;
String leaderboardId="CgkI0suKm7APEAIQBQ";
Games.Leaderboards.loadCurrentPlayerLeaderboardScore(googleClient, leaderboardId, LeaderboardVariant.TIME_SPAN_WEEKLY, LeaderboardVariant.COLLECTION_PUBLIC).setResultCallback(new ResultCallback<Leaderboards.LoadPlayerScoreResult>() {
@Override
public void onResult(Leaderboards.LoadPlayerScoreResult loadPlayerScoreResult) {
if (loadPlayerScoreResult != null && loadPlayerScoreResult.getScore() != null) {
return loadPlayerScoreResult.getScore().getRank();
}
}
});
return -1;
}
so i want to get the ranking number on leaderboard for the player. But everytime i try to compile i get
package Leaderboards does not exist
Y:\src\com\epicgames\ue4\GameActivity.java:82: error: cannot find symbol
UATHelper: Packaging (Android (All)): UnrealBuildTool: [javac] import com.google.android.gms.games.leaderboard;
so i dont know what library add and where
i tried this on UPL
<gameActivityImportAdditions>
<insert>
import com.google.android.gms.*;
com.google.android.gms.games.leaderboard
import com.google.android.gms.games.snapshot.*;
</insert>
</gameActivityImportAdditions>
but show a missing symbol error on games.leaderboard
so the dics say something about gradle but unreal is not using it
so how can i achieve it?
I’m assuming the com.google.android.gms.games.leaderboard line in the UPL is a typo? You left out the import and ; at the end.
We use the Google Play Games C++ library instead of Java.
DonFrag
(DonFrag)
3
it is a typo as you can see on the build i have the corrected version
the problem is that com.google.android.gms.games.leaderboard requires BasegameUtils
and that is a set of java files that lives on github (google play services examples)
so if you are using C++ version for leaderboards, could you guide me how can I get Ranking position of the player in the google leaderboard?
DonFrag
(DonFrag)
5
sorry i fixed my last post
DonFrag
(DonFrag)
6
Really? the staff just came here to say “it’s a typo?”
Ok, you’ll need to download the library from https://github.com/playgameservices/android-basic-samples/tree/master/BasicSamples/libraries/BaseGameUtils. Make a directory BaseGamesUtils you can copy with UPL prebuildCopies step. Put the contents of src/main in this directory and rename java to src. Add a project.properties file with:
target=android-19
android.library=true
have UPL add this to your manifest in androidManifestUpdates:
<application>
<meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="true" />
</application>
with this:
<setElement result="forward" value="meta-data"/>
<addAttribute tag="$forward" name="android:name" value="unityplayer.ForwardNativeEventsToDalvik"/>
<addAttribute tag="$forward" name="android:value" value="true"/>
<addElement tag="application" name="forward"/>
4.17 will have experimental Gradle support which makes this easier.
DonFrag
(DonFrag)
8
cool thanks i am going to try it!