Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
fastdevelop
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
高超
fastdevelop
Commits
6c215fe6
Commit
6c215fe6
authored
Nov 06, 2019
by
gao.chao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
26版本直接跳转允许安装未知应用页面
parent
e0c573ad
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
2 deletions
+43
-2
app/src/main/java/com/mayi/demo/FunctionActivity.java
+35
-0
app/src/main/res/layout/activity_function.xml
+6
-0
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/UpdateDownLoadAPKActvity.java
+2
-1
fastDevelop/src/main/res/layout/view_wheel_time.xml
+0
-1
No files found.
app/src/main/java/com/mayi/demo/FunctionActivity.java
View file @
6c215fe6
package
com
.
mayi
.
demo
;
package
com
.
mayi
.
demo
;
import
android.content.Intent
;
import
android.net.Uri
;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Bundle
;
import
android.provider.Settings
;
import
android.view.View
;
import
android.view.View
;
import
androidx.annotation.Nullable
;
import
androidx.annotation.Nullable
;
...
@@ -14,6 +18,7 @@ import com.gc.call.CallReturnListener;
...
@@ -14,6 +18,7 @@ import com.gc.call.CallReturnListener;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.base.BaseActivity
;
import
com.mayi.fastdevelop.bean.UserInfo
;
import
com.mayi.fastdevelop.bean.UserInfo
;
import
com.mayi.fastdevelop.comnon.Constant
;
import
com.mayi.fastdevelop.comnon.Constant
;
import
com.mayi.fastdevelop.comnon.RequestCode
;
import
com.mayi.fastdevelop.okhttp.NetWorkBuilder
;
import
com.mayi.fastdevelop.okhttp.NetWorkBuilder
;
import
com.mayi.fastdevelop.okhttp.ResultCallback
;
import
com.mayi.fastdevelop.okhttp.ResultCallback
;
import
com.mayi.fastdevelop.util.LogUtils
;
import
com.mayi.fastdevelop.util.LogUtils
;
...
@@ -117,6 +122,36 @@ public class FunctionActivity extends BaseActivity {
...
@@ -117,6 +122,36 @@ public class FunctionActivity extends BaseActivity {
gotoActivity
(
PlayerActivity
.
class
);
gotoActivity
(
PlayerActivity
.
class
);
}
}
});
});
findViewById
(
R
.
id
.
b10
).
setOnClickListener
(
new
OnMultiClickListener
()
{
@Override
public
void
onMultiClick
(
View
v
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
//开启设置安装未知来源应用权限界面
if
(!
getPackageManager
().
canRequestPackageInstalls
())
{
Uri
packageURI
=
Uri
.
parse
(
"package:"
+
getPackageName
());
Intent
intent
=
new
Intent
(
Settings
.
ACTION_MANAGE_UNKNOWN_APP_SOURCES
,
packageURI
);
startActivityForResult
(
intent
,
RequestCode
.
REQUEST_CODE_APP_INSTALL
);
}
else
{
showToast
(
"允许应用安装"
);
}
}
else
{
showToast
(
"版本小于26,允许应用安装"
);
}
}
});
}
}
@Override
protected
void
onActivityResult
(
int
requestCode
,
int
resultCode
,
@Nullable
Intent
data
)
{
if
(
requestCode
==
RequestCode
.
REQUEST_CODE_APP_INSTALL
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
if
(
getPackageManager
().
canRequestPackageInstalls
())
{
showToast
(
"允许应用安装"
);
}
else
{
showToast
(
"未允许应用安装"
);
}
}
}
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
);
}
}
}
app/src/main/res/layout/activity_function.xml
View file @
6c215fe6
...
@@ -62,6 +62,12 @@
...
@@ -62,6 +62,12 @@
android:layout_height=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"播放视频/音频\n未完成"
/>
android:text=
"播放视频/音频\n未完成"
/>
<Button
android:id=
"@+id/b10"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"跳转安装未知应用权限界面"
/>
</LinearLayout>
</LinearLayout>
...
...
fastDevelop/src/main/java/com/mayi/fastdevelop/commonpage/UpdateDownLoadAPKActvity.java
View file @
6c215fe6
...
@@ -67,7 +67,8 @@ public abstract class UpdateDownLoadAPKActvity extends BaseActivity {
...
@@ -67,7 +67,8 @@ public abstract class UpdateDownLoadAPKActvity extends BaseActivity {
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
//开启设置安装未知来源应用权限界面
//开启设置安装未知来源应用权限界面
if
(!
context
.
getPackageManager
().
canRequestPackageInstalls
())
{
if
(!
context
.
getPackageManager
().
canRequestPackageInstalls
())
{
Intent
intent2
=
new
Intent
(
Settings
.
ACTION_MANAGE_UNKNOWN_APP_SOURCES
);
Uri
packageURI
=
Uri
.
parse
(
"package:"
+
getPackageName
());
Intent
intent2
=
new
Intent
(
Settings
.
ACTION_MANAGE_UNKNOWN_APP_SOURCES
,
packageURI
);
startActivityForResult
(
intent2
,
RequestCode
.
REQUEST_CODE_APP_INSTALL
);
startActivityForResult
(
intent2
,
RequestCode
.
REQUEST_CODE_APP_INSTALL
);
ToastUtil
.
show
(
context
,
"请允许安装应用!"
);
ToastUtil
.
show
(
context
,
"请允许安装应用!"
);
return
;
return
;
...
...
fastDevelop/src/main/res/layout/view_wheel_time.xml
View file @
6c215fe6
...
@@ -4,7 +4,6 @@
...
@@ -4,7 +4,6 @@
android:layout_height=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/white"
>
android:background=
"@color/white"
>
<!--再想想-->
<TextView
<TextView
android:id=
"@+id/txt_think"
android:id=
"@+id/txt_think"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
...
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