Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
yunpeng committed Feb 11, 2018
1 parent d49c341 commit dec7e44
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 0 additions & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="site.site8.updateapk.updateapk">
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
Expand Down
1 change: 1 addition & 0 deletions updateapp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package="site.site8.updateapk.updateapp">
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
<application android:allowBackup="true">
<service android:name=".UpdateService" />
</application>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageManager;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
Expand Down Expand Up @@ -249,14 +250,15 @@ private void buildNotification() {

//android8.0需要NotificationChannel
if (Build.VERSION.SDK_INT >= 26) {
NotificationChannel channel = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_HIGH);
channel.setVibrationPattern(null);
NotificationChannel channel = new NotificationChannel(id, name, NotificationManager.IMPORTANCE_LOW);
channel.enableLights(false);
channel.setLightColor(Color.RED);
channel.enableVibration(false);
manager.createNotificationChannel(channel);
builder = new NotificationCompat.Builder(getApplicationContext(), id);
} else {
builder = new NotificationCompat.Builder(this);
}

builder = new NotificationCompat.Builder(getApplicationContext(), id);

builder.setContentTitle("准备下载")
.setWhen(System.currentTimeMillis())
.setProgress(100, 1, false)
Expand Down

0 comments on commit dec7e44

Please sign in to comment.