version:2.2.6
update: fix:在线状态更新 add:增加清除极光别名过多
This commit is contained in:
44
app/src/main/jni/jgy.cpp
Normal file
44
app/src/main/jni/jgy.cpp
Normal file
@@ -0,0 +1,44 @@
|
||||
#include <jni.h>
|
||||
#include <string>
|
||||
#include <sys/system_properties.h>
|
||||
// 日志打印
|
||||
#include <android/log.h>
|
||||
|
||||
#define LOG_TAG "TAG_LOG"
|
||||
#define LOGI(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
|
||||
|
||||
extern "C"
|
||||
JNIEXPORT jstring JNICALL
|
||||
Java_com_mjsheng_myappstore_utils_JGYUtils_getAuthorization(JNIEnv *env, jobject thiz) {
|
||||
// TODO: implement getAuthorization()
|
||||
std::string hello;
|
||||
|
||||
// 1. 获取 SDK 版本号 , 存储于 C 字符串 sdk_verison_str 中
|
||||
char sdk[128] = "0";
|
||||
|
||||
// 获取版本号方法
|
||||
__system_property_get("ro.build.version.sdk", sdk);
|
||||
//将版本号转为 int 值
|
||||
int sdk_verison = atoi(sdk);
|
||||
jclass cls = env->FindClass("com/mjsheng/myappstore/BuildConfig");
|
||||
jfieldID jfieldId_text = env->GetStaticFieldID(cls, "FLAVOR", "Ljava/lang/String;");
|
||||
jstring text = (jstring) env->GetStaticObjectField(cls, jfieldId_text);
|
||||
const char *char_name = env->GetStringUTFChars(text, JNI_FALSE);
|
||||
std::string s = char_name;
|
||||
if (s.compare("newly") == 0) {
|
||||
LOGI("newly");
|
||||
hello = "Basic MjBmNzBiYmViNzhiYWQyM2VkZGQwOGQwOjU0ZWRjYzczYzU4NWRkOGIyMjJlZjY4MA==";
|
||||
} else if (s.compare("MTKnewly") == 0) {
|
||||
LOGI("MTKnewly");
|
||||
hello = "Basic MjBmNzBiYmViNzhiYWQyM2VkZGQwOGQwOjU0ZWRjYzczYzU4NWRkOGIyMjJlZjY4MA==";
|
||||
} else if (s.compare("beta") == 0) {
|
||||
LOGI("beta");
|
||||
hello = "Basic NTJkODE2NDM2NjViYjJjYWRhY2YwZTllOmI5N2RkZTYwNjdhY2ZhMjY5MDlhZjQ1Nw==";
|
||||
}
|
||||
// LOGI("%s", char_name);
|
||||
// LOGI("dasdasd");
|
||||
// LOGI("%s", hello.c_str());
|
||||
return env->NewStringUTF(hello.c_str());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user