Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
mmm-rain
AndroidUtilCode
提交
7a6a8605
A
AndroidUtilCode
项目概览
mmm-rain
/
AndroidUtilCode
与 Fork 源项目一致
从无法访问的项目Fork
通知
4
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
AndroidUtilCode
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7a6a8605
编写于
9月 14, 2016
作者:
B
blankj
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
see 09/14 log
上级
71ba3a69
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
15 addition
and
12 deletion
+15
-12
utilcode/src/main/java/com/blankj/utilcode/utils/AppUtils.java
...ode/src/main/java/com/blankj/utilcode/utils/AppUtils.java
+15
-11
utilcode/src/main/java/com/blankj/utilcode/utils/DeviceUtils.java
.../src/main/java/com/blankj/utilcode/utils/DeviceUtils.java
+0
-1
未找到文件。
utilcode/src/main/java/com/blankj/utilcode/utils/AppUtils.java
浏览文件 @
7a6a8605
...
...
@@ -11,7 +11,6 @@ import android.graphics.drawable.Drawable;
import
android.net.Uri
;
import
android.os.Build
;
import
android.webkit.MimeTypeMap
;
import
android.widget.Toast
;
import
java.io.File
;
import
java.util.ArrayList
;
...
...
@@ -32,20 +31,22 @@ public class AppUtils {
}
/**
*
安装App(支持6.0以上)
*
获取安装App(支持6.0以上)的意图
*
* @param context 上下文
* @param filePath 文件路径
* @return 意图
*/
public
static
void
installApp
(
Context
context
,
String
filePath
)
{
installApp
(
context
,
FileUtils
.
getFileByPath
(
filePath
));
public
static
Intent
installApp
(
Context
context
,
String
filePath
)
{
return
installApp
(
context
,
FileUtils
.
getFileByPath
(
filePath
));
}
/**
*
安装App(支持6.0以上)
*
获取安装App(支持6.0以上)的意图
*
* @param context 上下文
* @param file 文件
* @return 意图
*/
public
static
Intent
installApp
(
Context
context
,
File
file
)
{
if
(
file
==
null
)
return
null
;
...
...
@@ -62,10 +63,11 @@ public class AppUtils {
}
/**
*
卸载指定包名的App
*
获取卸载指定包名的App的意图
*
* @param context 上下文
* @param packageName 包名
* @return 意图
*/
public
Intent
uninstallApp
(
Context
context
,
String
packageName
)
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_DELETE
);
...
...
@@ -251,7 +253,7 @@ public class AppUtils {
*
* @param context 上下文
* @param packageName 包名
* @return
意图
* @return
Intent
*/
private
static
Intent
getIntentByPackageName
(
Context
context
,
String
packageName
)
{
return
context
.
getPackageManager
().
getLaunchIntentForPackage
(
packageName
);
...
...
@@ -269,21 +271,22 @@ public class AppUtils {
}
/**
*
打开指定包名的App
*
获取打开指定包名App的意图
*
* @param context 上下文
* @param packageName 包名
* @return
{@code true}: 打开成功<br>{@code false}: 打开失败
* @return
意图
*/
public
static
Intent
openAppByPackageName
(
Context
context
,
String
packageName
)
{
return
getIntentByPackageName
(
context
,
packageName
);
}
/**
*
打开指定包名的App应用信息界面
*
获取打开指定包名的App应用信息的意图
*
* @param context 上下文
* @param packageName 包名
* @return 意图
*/
public
static
Intent
openAppInfo
(
Context
context
,
String
packageName
)
{
Intent
intent
=
new
Intent
();
...
...
@@ -293,10 +296,11 @@ public class AppUtils {
}
/**
*
可用来做App信息分享
*
获取App信息分享的意图
*
* @param context 上下文
* @param info 分享信息
* @return 意图
*/
public
static
Intent
shareAppInfo
(
Context
context
,
String
info
)
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_SEND
);
...
...
utilcode/src/main/java/com/blankj/utilcode/utils/DeviceUtils.java
浏览文件 @
7a6a8605
...
...
@@ -44,7 +44,6 @@ public class DeviceUtils {
/**
* 获取设备MAC地址
* <p/>
* <p>需添加权限 {@code <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>}</p>
*
* @return MAC地址
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录