背景和头像缺失
This commit is contained in:
@@ -98,11 +98,6 @@
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.andmore.AndroidNature</nature>
|
||||
@@ -111,7 +106,6 @@
|
||||
<nature>org.eclipse.cdt.core.ccnature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
|
||||
<nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
</natures>
|
||||
<linkedResources>
|
||||
<link>
|
||||
@@ -132,7 +126,7 @@
|
||||
</linkedResources>
|
||||
<filteredResources>
|
||||
<filter>
|
||||
<id>1770360450750</id>
|
||||
<id>1772285387277</id>
|
||||
<name></name>
|
||||
<type>30</type>
|
||||
<matcher>
|
||||
|
||||
@@ -5,18 +5,19 @@
|
||||
android:versionName="1.0.16"
|
||||
android:installLocation="auto">
|
||||
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="34"/>
|
||||
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="35"/>
|
||||
<uses-feature android:glEsVersion="0x00020000" />
|
||||
|
||||
<!-- Android 11+ 包可见性声明,允许与微信交互 -->
|
||||
<!-- Android 11+ 包可见性:允许查询微信是否安装 -->
|
||||
<queries>
|
||||
<package android:name="com.tencent.mm" />
|
||||
</queries>
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/icon"
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:requestLegacyExternalStorage="true">
|
||||
android:networkSecurityConfig="@xml/network_security_config"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:usesCleartextTraffic="true">
|
||||
|
||||
<!-- Tell Cocos2dxActivity the name of our .so -->
|
||||
<meta-data android:name="android.app.lib_name"
|
||||
@@ -71,7 +72,7 @@
|
||||
</activity>
|
||||
|
||||
<meta-data android:name="TencentMapSDK" android:value="43CBZ-XFWW5-IDEIY-QV4ZR-PBOZK-5SBDL" />
|
||||
<service android:name="com.pg.core.sdk.lib.YayaService"/>
|
||||
<service android:name="com.pg.core.sdk.lib.YayaService" android:exported="false"/>
|
||||
</application>
|
||||
|
||||
<supports-screens android:anyDensity="true"
|
||||
|
||||
@@ -1,21 +1,11 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
######################################################################
|
||||
# TencentLocation - only available for 32-bit ABIs
|
||||
ifneq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := libtencentloc
|
||||
LOCAL_SRC_FILES := ../../libs/TencentLocation/$(TARGET_ARCH_ABI)/libtencentloc.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
endif
|
||||
#######################################################################
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
$(call import-add-path,$(LOCAL_PATH)/../..)
|
||||
|
||||
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d)
|
||||
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/external)
|
||||
$(call import-add-path,$(LOCAL_PATH)/../../../cocos2d/cocos)
|
||||
$(call import-add-path,$(LOCAL_PATH)/../../../../cocos2d)
|
||||
$(call import-add-path,$(LOCAL_PATH)/../../../../cocos2d/external)
|
||||
$(call import-add-path,$(LOCAL_PATH)/../../../../cocos2d/cocos)
|
||||
|
||||
LOCAL_MODULE := cocos2dcpp_shared
|
||||
LOCAL_SHARED_LIBRARIES += libYvImSdk
|
||||
@@ -81,10 +71,6 @@ LOCAL_LDFLAGS := -Wl,--allow-multiple-definition
|
||||
LOCAL_STATIC_LIBRARIES := cocos2dx_static
|
||||
LOCAL_STATIC_LIBRARIES += android_support
|
||||
|
||||
ifneq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||
LOCAL_STATIC_LIBRARIES += libtencentloc
|
||||
endif
|
||||
|
||||
# _COCOS_LIB_ANDROID_BEGIN
|
||||
# _COCOS_LIB_ANDROID_END
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
APP_STL := gnustl_static
|
||||
|
||||
APP_ABI := armeabi-v7a arm64-v8a
|
||||
APP_PLATFORM := android-21
|
||||
#TARGET_CPU_API := armeabi-v7a
|
||||
#APP_ABI := armeabi-v7a
|
||||
#APP_PLATFORM := android-14
|
||||
|
||||
APP_CFLAGS += -Wno-error=format-security
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char
|
||||
APP_CFLAGS += -Wno-error=format-security -mno-unaligned-access
|
||||
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -std=c++11 -fsigned-char -mno-unaligned-access
|
||||
APP_LDFLAGS := -latomic
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
# This file is automatically generated by Android Tools.
|
||||
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
|
||||
#
|
||||
# This file must *NOT* be checked into Version Control Systems,
|
||||
## This file must *NOT* be checked into Version Control Systems,
|
||||
# as it contains information specific to your local configuration.
|
||||
|
||||
# location of the SDK. This is only used by Ant
|
||||
#
|
||||
# Location of the SDK. This is only used by Gradle.
|
||||
# For customization when using a Version Control System, please read the
|
||||
# header note.
|
||||
sdk.dir=D:\\Android\\sdk
|
||||
#Sat Feb 28 10:52:30 CST 2026
|
||||
sdk.dir=D\:\\Android\\sdk
|
||||
|
||||
@@ -11,4 +11,4 @@
|
||||
target=android-28
|
||||
|
||||
android.library=false
|
||||
android.library.reference.1=../../cocos2d/cocos/platform/android/java
|
||||
android.library.reference.1=../../../cocos2d/cocos/platform/android/java
|
||||
|
||||
@@ -30,9 +30,14 @@ package com.jxkh.queyi;
|
||||
import org.cocos2dx.lib.Cocos2dxActivity;
|
||||
import org.cocos2dx.lib.Cocos2dxGLSurfaceView;
|
||||
|
||||
import android.Manifest;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.net.Uri;
|
||||
import android.os.*;
|
||||
import android.provider.Settings;
|
||||
import android.util.Log;
|
||||
|
||||
import com.jxkh.queyi.common.MainActivityHolder;
|
||||
@@ -43,6 +48,9 @@ import com.tencent.map.geolocation.TencentLocationManager;
|
||||
import com.tencent.map.geolocation.TencentLocationRequest;
|
||||
|
||||
public class AppActivity extends Cocos2dxActivity implements TencentLocationListener {
|
||||
private static final int REQUEST_LOCATION_PERMISSION = 1001;
|
||||
private static final int REQUEST_PHONE_STATE_PERMISSION = 1002;
|
||||
private static final int REQUEST_APP_SETTINGS = 1003;
|
||||
private Handler mHandler;
|
||||
private HandlerThread mThread;
|
||||
|
||||
@@ -85,6 +93,18 @@ public class AppActivity extends Cocos2dxActivity implements TencentLocationList
|
||||
mLocationManager = TencentLocationManager.getInstance(this);
|
||||
// 设置坐标系为 gcj-02, 缺省坐标为 gcj-02, 所以通常不必进行如下调用
|
||||
mLocationManager.setCoordinateType(TencentLocationManager.COORDINATE_TYPE_GCJ02);
|
||||
|
||||
// 启动时先请求设备信息权限(防作弊必需)
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (checkSelfPermission(Manifest.permission.READ_PHONE_STATE) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(new String[]{
|
||||
Manifest.permission.READ_PHONE_STATE
|
||||
}, REQUEST_PHONE_STATE_PERMISSION);
|
||||
} else {
|
||||
// 设备权限已有,继续请求定位权限
|
||||
requestLocationPermissionIfNeeded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -125,7 +145,21 @@ public class AppActivity extends Cocos2dxActivity implements TencentLocationList
|
||||
|
||||
// 响应点击"开始"
|
||||
public void startLocation() {
|
||||
// Android 6.0+ 需要运行时权限
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
|
||||
|| checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(new String[]{
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
}, REQUEST_LOCATION_PERMISSION);
|
||||
return;
|
||||
}
|
||||
}
|
||||
doStartLocation();
|
||||
}
|
||||
|
||||
private void doStartLocation() {
|
||||
// 创建定位请求
|
||||
final TencentLocationRequest request = TencentLocationRequest.create();
|
||||
|
||||
@@ -144,6 +178,128 @@ public class AppActivity extends Cocos2dxActivity implements TencentLocationList
|
||||
updateLocationStatus("开始定位: " + request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
if (requestCode == REQUEST_PHONE_STATE_PERMISSION) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
// 设备信息权限已授予,继续请求定位权限
|
||||
requestLocationPermissionIfNeeded();
|
||||
} else {
|
||||
// 检查是否选了"不再询问"
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M
|
||||
&& !shouldShowRequestPermissionRationale(Manifest.permission.READ_PHONE_STATE)) {
|
||||
// 用户选了"不再询问",引导去设置页
|
||||
showGoSettingsDialog();
|
||||
} else {
|
||||
// 用户只是拒绝了,弹窗解释后重新请求
|
||||
showPhoneStateRequiredDialog();
|
||||
}
|
||||
}
|
||||
} else if (requestCode == REQUEST_LOCATION_PERMISSION) {
|
||||
if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
doStartLocation();
|
||||
} else {
|
||||
Log.w("AppActivity", "Location permission denied");
|
||||
Native.strLocation = "{ret:false, reason: \"PERMISSION_DENIED\" }";
|
||||
Cocos2dxGLSurfaceView.getInstance().queueEvent(new Runnable() {
|
||||
public void run() {
|
||||
Native.onLocationChanged(Native.strLocation);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void requestLocationPermissionIfNeeded() {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED
|
||||
|| checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
||||
requestPermissions(new String[]{
|
||||
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
||||
}, REQUEST_LOCATION_PERMISSION);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showPhoneStateRequiredDialog() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AlertDialog.Builder(AppActivity.this)
|
||||
.setTitle("权限申请")
|
||||
.setMessage("为保障游戏公平性和防止作弊,需要获取设备信息。请授予该权限后继续使用。")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("授予权限", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
requestPermissions(new String[]{
|
||||
Manifest.permission.READ_PHONE_STATE
|
||||
}, REQUEST_PHONE_STATE_PERMISSION);
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton("退出游戏", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void showGoSettingsDialog() {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new AlertDialog.Builder(AppActivity.this)
|
||||
.setTitle("权限申请")
|
||||
.setMessage("设备信息权限是游戏运行的必要条件(防作弊)。请前往系统设置手动开启该权限。")
|
||||
.setCancelable(false)
|
||||
.setPositiveButton("前往设置", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
||||
intent.setData(Uri.parse("package:" + getPackageName()));
|
||||
startActivityForResult(intent, REQUEST_APP_SETTINGS);
|
||||
}
|
||||
})
|
||||
.setNegativeButton("退出游戏", new DialogInterface.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
dialog.dismiss();
|
||||
finish();
|
||||
}
|
||||
})
|
||||
.show();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
|
||||
super.onActivityResult(requestCode, resultCode, data);
|
||||
if (requestCode == REQUEST_APP_SETTINGS) {
|
||||
// 从设置页返回,重新检查权限
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (checkSelfPermission(Manifest.permission.READ_PHONE_STATE) == PackageManager.PERMISSION_GRANTED) {
|
||||
requestLocationPermissionIfNeeded();
|
||||
} else {
|
||||
// 仍未授权,再次提示
|
||||
showGoSettingsDialog();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void clearStatus() {
|
||||
}
|
||||
|
||||
|
||||
@@ -216,4 +216,14 @@ public class Native extends Cocos2dxHelper
|
||||
public static double distanceBetween(double aLatitude, double aLongitude, double bLatitude, double bLongitude) {
|
||||
return TencentLocationUtils.distanceBetween(aLatitude, aLongitude, bLatitude, bLongitude);
|
||||
}
|
||||
|
||||
// GBK byte array -> Java String (internally UTF-16), JNI GetStringUTFChars returns UTF-8
|
||||
public static String convertGbkToUtf8(byte[] gbkBytes) {
|
||||
try {
|
||||
return new String(gbkBytes, "GBK");
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -126,8 +126,9 @@ public class WXEntryActivity extends Activity implements IWXAPIEventHandler{
|
||||
SendAuth.Req req = new SendAuth.Req();
|
||||
req.scope = "snsapi_userinfo";
|
||||
req.state = "carjob_wx_login";
|
||||
WXEntryActivity.api.sendReq(req);
|
||||
Log.d(Tag,"reqLogin!!!!");
|
||||
boolean result = WXEntryActivity.api.sendReq(req);
|
||||
Log.d(Tag,"reqLogin result: " + result); // 添加日志
|
||||
Log.d(Tag,"isWXAppInstalled: " + api.isWXAppInstalled()); // 检查微信是否安装
|
||||
}
|
||||
public void reqShareImg(String ImgPath,int nType)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user