Got error return code 7005 While running my Game on Huawei device - huawei-mobile-services

I am trying to integrate some of HMS Game engine features to optimize my Game performance, but I got an error return code is 7005. Below is my code. Could someone tell me what went wrong?
public class GameSummaryActivity extends BaseActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_gamesummary);
ButterKnife.bind(this);
}
#OnClick(R.id.btn_get_local_gamesummary)
public void getLocalGameSummary() {
GameSummaryClient client = Games.getGameSummaryClient(this);
Task<GameSummary> task = client.getLocalGameSummary();
task.addOnSuccessListener(new OnSuccessListener<GameSummary>() {
#Override
public void onSuccess(GameSummary gameSummary) {
showLog("achievementCount:" + gameSummary.getAchievementCount());
showLog("appId:" + gameSummary.getAppId());
showLog("descInfo:" + gameSummary.getDescInfo());
showLog("gameName:" + gameSummary.getGameName());
showLog("gameHdImgUri:" + gameSummary.getGameHdImgUri());
showLog("gameIconUri:" + gameSummary.getGameIconUri());
showLog("rankingCount:" + gameSummary.getRankingCount());
showLog("firstKind:" + gameSummary.getFirstKind());
showLog("secondKind:" + gameSummary.getSecondKind());
}
}).addOnFailureListener(new OnFailureListener() {
#Override
public void onFailure(Exception e) {
if (e instanceof ApiException) {
String result = "rtnCode:" + ((ApiException) e).getStatusCode();
showLog(result);
}
}
});
}

Result code 7005 indicates that a request parameter, such as appid or cpid, is incorrect. Perform the following check:
• If you are using Android Studio, ensure that the agconnect-services.json file is stored in your app's root directory of your project.
• If you are using Eclipse, ensure that you have integrated the HMS Core Game Service SDK correctly by instructions in our documents.

Related

Flutter app not receiving message from Android through MethodChannel

Problem
I have an Android app that I am developing using mainly Flutter that is dependent on a .jar file being ran in the background. In main.dart there are 2 MethodChannel objects, one for sending commands to Java and one for receiving messages from Java. My flutter channel handling methods from Java is written as such:
_ui_channel.setMethodCallHandler(uiHandler);
Future<void> uiHandler(MethodCall call) async {
switch (call.method){
case "INPUT_ACCOUNT":
print("Success!");
break;
default:
print("This was called by " + call.method);
break;
}
}
and in the Java side
MethodChannel out_channel= new MethodChannel(Objects.requireNonNull(getFlutterEngine()).getDartExecutor().getBinaryMessenger(), OUT_CHANNEL);
private void inputAccount(MethodChannel out_channel) {
new Handler(Looper.getMainLooper()).post(() -> {
out_channel.invokeMethod("INPUT_ACCOUNT", "", new MethodChannel.Result() {
#Override
public void success(Object result) {
}
#Override
public void error(String errorCode, String errorMessage, Object errorDetails) {
Log.e("input", errorCode + "\n" + errorMessage);
}
#Override
public void notImplemented() {
}
});
});
I have verified that the Java code gets to the invokeMethod() call and that the channels are the same between the 2 sides. From what I've read online, this should be correct but Dart never receives the "INPUT_ACCOUNT" message and prints the "Success" message I've posted. Is there maybe something I'm missing in the AndroidManifest.xml?

How to check version number and open app in App(iTunes)Store (iOS)?

I need to check current version of Installed Application. If it is not same app should navigate to app page in app store.
I am using latest version plugin for this. Its working fine with Android but not with iOS
Setings.appVersion = await CrossLatestVersion.Current.GetLatestVersionNumber();
if (Setings.appVersion == "1.0.1")
{
MainPage = new NavigationPage(new Login());
}
else
{
//lblBuildNumber.Text = DependencyService.Get<IAppVersionAndBuild>().GetBuildNumber();
MainPage = new NavigationPage(new UpdateAppPopup());
}
async void Handle_Clicked(object sender, System.EventArgs e)
{
await CrossLatestVersion.Current.OpenAppInStore("com.KIH.Consultant");
}
with this code it should navigate to app page in app store or playstore
its wokring with fine with playstore, but not working in appstore(ios)
1) Create One Interface Inside Your Main Project
public interface IAppService
{
string GetVersion();
}
2) Then Implement it inside your droid project
public class AppService : IAppService
{
public string GetVersion() {
var context = Android.App.Application.Context;
var info = context.PackageManager.GetPackageInfo(context.PackageName,
Android.Content.PM.PackageInfoFlags.MatchAll);
return info.VersionName;
}
3) Then Implement it inside your ios project
public class AppService : IAppService
{
public string GetVersion()
{
return NSBundle.MainBundle.InfoDictionary["CFBundleShortVersionString"].ToString();
}
}
4) Now you can use it like this
string v = Get<IAppService>().GetVersion();
use Xamarin.Essentials to get the current version string and version code for the app.
// Application Version (1.0.0)
var version = AppInfo.VersionString;
// Application Build Number (1)
var build = AppInfo.BuildString;

Using Socket.io with Service in Android

I am developing an android app with node.js running on the backend. In the android app, I have multiple activities. I am opening a socket connection using Socket.io from the first activity. But the problem is that I don't know how to use that connection over multiple activities. I don't know how to implement this using Service. It would be great if you could answer with some code reference.
Thanks in Advance
socket.io has a chat app example implemented in android link below:
https://github.com/nkzawa/socket.io-android-chat
any way, for using socket.io in android, i think best way is using it inside a service something like this:
public class ChatService extends Service {
public void connectSocket() {
try {
IO.Options options = new IO.Options();
socket = IO.socket("http://192.168.1.1:8080", options);
socket.on(Socket.EVENT_CONNECT, new Emitter.Listener() {
#Override
public void call(Object... args) {
}
}).on(Socket.EVENT_DISCONNECT, new Emitter.Listener() {
#Override
public void call(Object... args) {
}
}).on("error", new Emitter.Listener() {
#Override
public void call(Object... args) {
}
});
socket.connect();
} catch (Exception ignored) {
}
}
#Override
public void onDestroy() {
socket.disconnect();
super.onDestroy();
}
}

SupportMapFragmentManagers getMapAsync() does not trigger onMapReady(GoogleMap map)

I have a
public abstract class MyMapFragment implements OnMapReadyCallback
{
//
public GoogleMap googleMap;
SupportMapFragment mapFragment;
#IdRes
public abstract int getSupportMapFragId();
#Override
public void onViewCreated(View view, #Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
// http://stackoverflow.com/a/36592000/5102206
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
// Do something for lollipop and above versions
mapFragment = (SupportMapFragment) getChildFragmentManager().findFragmentById(getSupportMapFragId());
} else {
// do something for phones running an SDK before lollipop
mapFragment = (SupportMapFragment) getFragmentManager().findFragmentById(getSupportMapFragId());
}
mapFragment.getMapAsync(this);
}
//..
#Override
public void onMapReady(GoogleMap map) {
this.googleMap = map;
}
}
According to my breakpoints onViewCreated() is called, but onMapReady() is not called (breakpoint on this.googleMap = map not triggered)
On Android 5, 6 and 7 it works fine so far and I can see the Map..
On Android 4.X (API 16 - API 19) devices my app starts up, but then it seem to freeze there... I see a white blank screen.
On Android 4.X OS devices:
1. With getFragmentManager(), the mapFragment object is null after the else condition.
2. With getChildFragmentMenager() the mapfragment seem to be valid and non-null, but onMapReady not triggered.
What am I missing here?
Note: You cannot inflate a layout into a fragment when that layout includes a . Nested fragments are only supported when added to a fragment dynamically
If you want to inflate a map in a fragment you can either do it in xml or do it in java code like this:
#Override
public void onViewCreated(View view, #Nullable Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
FragmentManager fm = getChildFragmentManager();
SupportMapFragment mapFragment = (SupportMapFragment) fm.findFragmentByTag("mapFragment");
if (mapFragment == null) {
mapFragment = new SupportMapFragment();
FragmentTransaction ft = fm.beginTransaction();
ft.add(R.id.mapFragmentContainer, mapFragment, "mapFragment");
ft.commit();
fm.executePendingTransactions();
}
mapFragment.getMapAsync(callback);
}
And also the simple container
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="#+id/mapFragmentContainer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
</LinearLayout>
Also, you don't need to implement the onMapReadyCallback in the class definition. Instead of callback you create a new OnMapReadyCallback() right there:
MapView.getMapAsync(new OnMapReadyCallback() {
#Override
public void onMapReady(GoogleMap mMap) {
googleMap = mMap;
}
});
You also need these
MapView mMapView;
private GoogleMap googleMap;
I hope this helps somehow !
There was an issue with a blocking thread from RxJava on main thread. So it was not an Google Maps issue.
I don't quite understand why you are nesting fragments, specially because it can cause performance issues.
If you take a look at Google Samples, the Google Maps examples uses an Activity and SupportMapFragment:
public class MapsActivityCurrentPlace extends AppCompatActivity
implements OnMapReadyCallback, ConnectionCallbacks,
OnConnectionFailedListener {
#Override
public void onMapReady(GoogleMap map) {
mMap = map;
// Use a custom info window adapter to handle multiple lines of text in the
// info window contents.
mMap.setInfoWindowAdapter(new GoogleMap.InfoWindowAdapter() {
#Override
// Return null here, so that getInfoContents() is called next.
public View getInfoWindow(Marker arg0) {
return null;
}
#Override
public View getInfoContents(Marker marker) {
// Inflate the layouts for the info window, title and snippet.
View infoWindow = getLayoutInflater().inflate(R.layout.custom_info_contents,
(FrameLayout)findViewById(R.id.map), false);
TextView title = ((TextView) infoWindow.findViewById(R.id.title));
title.setText(marker.getTitle());
TextView snippet = ((TextView) infoWindow.findViewById(R.id.snippet));
snippet.setText(marker.getSnippet());
return infoWindow;
}
});
// Turn on the My Location layer and the related control on the map.
updateLocationUI();
// Get the current location of the device and set the position of the map.
getDeviceLocation();
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (savedInstanceState != null) {
mLastKnownLocation = savedInstanceState.getParcelable(KEY_LOCATION);
mCameraPosition = savedInstanceState.getParcelable(KEY_CAMERA_POSITION);
}
setContentView(R.layout.activity_maps);
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */,
this /* OnConnectionFailedListener */)
.addConnectionCallbacks(this)
.addApi(LocationServices.API)
.addApi(Places.GEO_DATA_API)
.addApi(Places.PLACE_DETECTION_API)
.build();
mGoogleApiClient.connect();
}
#Override
public void onConnected(Bundle connectionHint) {
SupportMapFragment mapFragment =
(SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map);
mapFragment.getMapAsync(this);
}
#Override
public void onConnectionFailed(#NonNull ConnectionResult result) {
Log.d(TAG, result.getErrorMessage());
}
#Override
public void onConnectionSuspended(int cause) {
Log.d(TAG, "Play services connection suspended");
}
}

Parse query always returns an empty list

I have the following problem:
I have two Android apps: In one app I add data to Mongo DB via Parse and in the other app I want to retrieve the information added from the first app.
The problem is that in the second app everytime I try to query the DB, I get an empty list. I`ve checked with the API KEY, with the keys from the Mongo DB, and everything seems ok in my app.
Here is the code for the second app to retrieve information in a RecyclerView
public class ParseDb extends Application {
#Override
public void onCreate() {
super.onCreate();
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId(API_KEY)
.server("http://injuriesandsuspensions.herokuapp.com/parse/")
.build()
);
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// Optionally enable public read access.
defaultACL.setPublicReadAccess(true);
ParseACL.setDefaultACL(defaultACL, true);
}
public class MainActivity extends Activity {
private List<AboutTeams> aboutTeamsList = new ArrayList<AboutTeams>();
private RecyclerView recyclerView;
private GamesAdapter gamesAdapter;
public void retrieveGamesFromDatabase(){
ParseQuery<ParseObject> query = ParseQuery.getQuery("InjuriesAndSuspensions");
query.whereEqualTo("score", "none");
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> gamesList, ParseException e) {
if (e == null) {
Log.d("score", "Retrieved " + gamesList.size() + " scores");
for(int i = 0; i < gamesList.size(); i++){
AboutTeams aboutTeams = new AboutTeams();
aboutTeams.setId(String.valueOf(gamesList.get(i).getObjectId()));
aboutTeams.setScore(String.valueOf(gamesList.get(i).get("score")));
aboutTeams.setHomeTeam(String.valueOf(gamesList.get(i).get("homeTeam")));
aboutTeams.setHomeTeamMissing(String.valueOf(gamesList.get(i).get("homeTeamMissingPlayers")));
aboutTeams.setAwayTeam(String.valueOf(gamesList.get(i).get("awayTeam")));
aboutTeams.setAwayTeamMissing(String.valueOf(gamesList.get(i).get("awayTeamMissingPlayers")));
aboutTeams.setDate(String.valueOf(gamesList.get(i).get("gameDate")));
Log.d("About Teams " , aboutTeams.toString());
aboutTeamsList.add(aboutTeams);
gamesAdapter.notifyDataSetChanged();
}
} else {
Log.d("score", "Error: " + e.getMessage());
}
}
});
}
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_listview);
recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
gamesAdapter = new GamesAdapter(aboutTeamsList);
RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(getApplicationContext());
recyclerView.setLayoutManager(mLayoutManager);
recyclerView.setItemAnimator(new DefaultItemAnimator());
recyclerView.setAdapter(gamesAdapter);
retrieveGamesFromDatabase();
}
Please help as I`ve been struggling with this thing for almost 3 days.
When I was adding info to the Collection DB,the ParseObject I was using didn`t have this line added where I was initializing Parse in my application:
defaultACL.setPublicReadAccess(true);
Complete code on how to initialize Parse:
public class AddToDB extends Application {
#Override
public void onCreate() {
super.onCreate();
// Enable Local Datastore.
Parse.enableLocalDatastore(this);
// Add your initialization code here
Parse.initialize(new Parse.Configuration.Builder(getApplicationContext())
.applicationId(API_KEY)
.server(SERVER_URL)
.build()
);
ParseUser.enableAutomaticUser();
ParseACL defaultACL = new ParseACL();
// Optionally enable public read access.
**defaultACL.setPublicReadAccess(true);**
ParseACL.setDefaultACL(defaultACL, true);
}
}