Skip to content

Commit

Permalink
修复App更新8.0权限拒绝,降低App更新通知栏通知权限级别
Browse files Browse the repository at this point in the history
  • Loading branch information
beaven11 committed May 30, 2018
1 parent a585db3 commit 0fd4bf6
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 17 deletions.
27 changes: 14 additions & 13 deletions library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,24 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="mejust.frame">
package="mejust.frame">

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>

<application>
<service
android:name=".upgrade.UpgradeDownloadService"
android:exported="false">
</service>
android:name=".upgrade.UpgradeDownloadService"
android:exported="false" />
<provider
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.versionProvider"
android:exported="false"
android:grantUriPermissions="true">
android:name="android.support.v4.content.FileProvider"
android:authorities="${applicationId}.versionProvider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/version_upgrade_file_path"/>
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/version_upgrade_file_path" />
</provider>
</application>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public NotificationProgress(Context context, ProgressMessageBuilder progressMess
String name = "应用更新";
String description = "Prompt to say that you received the offer";
NotificationChannel channel =
new NotificationChannel(CHANNEL, name, NotificationManager.IMPORTANCE_DEFAULT);
new NotificationChannel(CHANNEL, name, NotificationManager.IMPORTANCE_LOW);
channel.setDescription(description);
NotificationManager notificationManager =
(NotificationManager) context.getSystemService(NOTIFICATION_SERVICE);
Expand All @@ -51,22 +51,25 @@ public NotificationProgress(Context context, ProgressMessageBuilder progressMess
@Override
public void updateProgress(int progress) {
notificationBuilder.setProgress(100, progress, false)
.setContentText(Utils.getApp().getResources().getString(R.string.download_ing_frame));
.setContentText(
Utils.getApp().getResources().getString(R.string.download_ing_frame));
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
}

@Override
public void downloadSuccess() {
notificationBuilder.setProgress(0, 0, false)
.setContentText(Utils.getApp().getResources().getString(R.string.download_success_frame));
.setContentText(
Utils.getApp().getResources().getString(R.string.download_success_frame));
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
notificationManager.cancel(NOTIFICATION_ID);
}

@Override
public void downloadFail() {
notificationBuilder.setProgress(0, 0, false)
.setContentText(Utils.getApp().getResources().getString(R.string.download_fail_frame));
.setContentText(
Utils.getApp().getResources().getString(R.string.download_fail_frame));
notificationManager.notify(NOTIFICATION_ID, notificationBuilder.build());
notificationManager.cancel(NOTIFICATION_ID);
}
Expand Down

0 comments on commit 0fd4bf6

Please sign in to comment.