提交修改
This commit is contained in:
co-authored by
changyunjia
parent
d4442fc21f
commit
3ac4fe0cd0
Regular → Executable
+16
-16
@@ -1,17 +1,17 @@
|
||||
package com.tool.countrycode;
|
||||
import android.app.Activity;
|
||||
import java.util.Locale;
|
||||
public class AcquireCountryCode {
|
||||
// 获取国家码
|
||||
public static String getCountryCode()
|
||||
{
|
||||
Locale locale = Locale.getDefault();
|
||||
return locale.getCountry();
|
||||
}
|
||||
|
||||
public static String getCountryCode3() {
|
||||
Locale currentLocale = Locale.getDefault();
|
||||
return currentLocale.getISO3Country();
|
||||
}
|
||||
|
||||
package com.tool.countrycode;
|
||||
import android.app.Activity;
|
||||
import java.util.Locale;
|
||||
public class AcquireCountryCode {
|
||||
// 获取国家码
|
||||
public static String getCountryCode()
|
||||
{
|
||||
Locale locale = Locale.getDefault();
|
||||
return locale.getCountry();
|
||||
}
|
||||
|
||||
public static String getCountryCode3() {
|
||||
Locale currentLocale = Locale.getDefault();
|
||||
return currentLocale.getISO3Country();
|
||||
}
|
||||
|
||||
}
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+33
-33
@@ -1,33 +1,33 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6e3da5c7fe21c1347a563e64e8f305d4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
fileFormatVersion: 2
|
||||
guid: 6e3da5c7fe21c1347a563e64e8f305d4
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
- first:
|
||||
Any:
|
||||
second:
|
||||
enabled: 1
|
||||
settings: {}
|
||||
- first:
|
||||
Editor: Editor
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
DefaultValueInitialized: true
|
||||
- first:
|
||||
Windows Store Apps: WindowsStoreApps
|
||||
second:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
|
||||
Regular → Executable
Regular → Executable
Regular → Executable
+12
-12
@@ -1,12 +1,12 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern "C" {
|
||||
__attribute__((visibility("default")))
|
||||
const char* _GetDeviceCountryCode() {
|
||||
@autoreleasepool {
|
||||
NSLocale *currentLocale = [NSLocale currentLocale];
|
||||
NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
|
||||
return strdup([countryCode UTF8String]); // 使用strdup确保内存安全
|
||||
}
|
||||
}
|
||||
}
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
extern "C" {
|
||||
__attribute__((visibility("default")))
|
||||
const char* _GetDeviceCountryCode() {
|
||||
@autoreleasepool {
|
||||
NSLocale *currentLocale = [NSLocale currentLocale];
|
||||
NSString *countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
|
||||
return strdup([countryCode UTF8String]); // 使用strdup确保内存安全
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Regular → Executable
Reference in New Issue
Block a user