Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lib_base
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sikang
lib_base
Commits
9c8895be
Commit
9c8895be
authored
Mar 23, 2019
by
sikang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nothing
parent
4357e5b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
50 deletions
+50
-50
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
+9
-9
src/main/java/tech/starwin/utils/context_utils/AppInfoUtils.java
+41
-41
No files found.
src/main/java/tech/starwin/network/DefaultHeaderAddInterceptor.java
View file @
9c8895be
...
...
@@ -90,15 +90,15 @@ class DefaultHeaderAddInterceptor implements Interceptor {
return
ROOT_STATUS
;
}
public
String
getSimInfo
()
{
if
(
TextUtils
.
isEmpty
(
SIM_INFO
))
{
String
sim_info
=
AppInfoUtils
.
getSimSerialNumber
(
LibConfig
.
getContext
())
+
","
+
AppInfoUtils
.
getPhoneNumber
(
LibConfig
.
getContext
());
if
(
sim_info
.
length
()
>
1
)
{
SIM_INFO
=
sim_info
;
}
}
return
SIM_INFO
;
}
//
public String getSimInfo() {
//
if (TextUtils.isEmpty(SIM_INFO)) {
//
String sim_info = AppInfoUtils.getSimSerialNumber(LibConfig.getContext()) + "," + AppInfoUtils.getPhoneNumber(LibConfig.getContext());
//
if (sim_info.length() > 1) {
//
SIM_INFO = sim_info;
//
}
//
}
//
return SIM_INFO;
//
}
private
String
getGAId
()
{
if
(!
TextUtils
.
isEmpty
(
GA_ID
))
{
...
...
src/main/java/tech/starwin/utils/context_utils/AppInfoUtils.java
View file @
9c8895be
...
...
@@ -72,47 +72,47 @@ public class AppInfoUtils {
}
@SuppressLint
(
"MissingPermission"
)
public
static
String
getPhoneNumber
(
Context
context
)
{
try
{
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
context
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
if
(
telephonyManager
!=
null
&&
PermissionsHelper
.
isGranted
(
context
,
Manifest
.
permission
.
READ_PHONE_STATE
))
{
return
telephonyManager
.
getLine1Number
();
}
}
catch
(
Exception
e
)
{
return
""
;
}
return
""
;
}
@SuppressLint
(
"MissingPermission"
)
public
static
String
getIMSI
(
Context
context
)
{
try
{
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
context
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
if
(
telephonyManager
!=
null
&&
PermissionsHelper
.
isGranted
(
context
,
Manifest
.
permission
.
READ_PHONE_STATE
))
{
String
imsi
=
telephonyManager
.
getSubscriberId
();
LogUtils
.
d
(
"IMSI_INFO"
,
imsi
);
return
imsi
;
}
}
catch
(
Exception
e
)
{
return
""
;
}
return
""
;
}
@SuppressLint
(
"MissingPermission"
)
public
static
String
getSimSerialNumber
(
Context
context
)
{
try
{
TelephonyManager
telephonyManager
=
(
TelephonyManager
)
context
.
getSystemService
(
Context
.
TELEPHONY_SERVICE
);
if
(
telephonyManager
!=
null
&&
PermissionsHelper
.
isGranted
(
context
,
Manifest
.
permission
.
READ_PHONE_STATE
))
{
return
telephonyManager
.
getSimSerialNumber
();
}
}
catch
(
Exception
e
)
{
return
""
;
}
return
""
;
}
//
@SuppressLint("MissingPermission")
//
public static String getPhoneNumber(Context context) {
//
try {
//
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
//
if (telephonyManager != null && PermissionsHelper.isGranted(context, Manifest.permission.READ_PHONE_STATE)) {
//
return telephonyManager.getLine1Number();
//
}
//
} catch (Exception e) {
//
return "";
//
}
//
return "";
//
}
//
//
@SuppressLint("MissingPermission")
//
public static String getIMSI(Context context) {
//
try {
//
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
//
if (telephonyManager != null && PermissionsHelper.isGranted(context, Manifest.permission.READ_PHONE_STATE)) {
//
String imsi = telephonyManager.getSubscriberId();
//
LogUtils.d("IMSI_INFO",imsi);
//
return imsi;
//
}
//
} catch (Exception e) {
//
return "";
//
}
//
return "";
//
}
//
//
//
@SuppressLint("MissingPermission")
//
public static String getSimSerialNumber(Context context) {
//
try {
//
TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
//
if (telephonyManager != null && PermissionsHelper.isGranted(context, Manifest.permission.READ_PHONE_STATE)) {
//
return telephonyManager.getSimSerialNumber();
//
}
//
} catch (Exception e) {
//
return "";
//
}
//
return "";
//
}
/**
* 判断是否已ROOT
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment