Fix issues with notification
Этот коммит содержится в:
@@ -37,8 +37,18 @@ public class TrackingService extends Service {
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
private static Notification createNotification(Context context) {
|
||||
Intent notificationIntent = new Intent(context, MainActivity.class);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
|
||||
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, new Intent(context, MainActivity.class), 0);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||
|
||||
return new Notification.Builder(context)
|
||||
.setContentTitle(context.getString(R.string.app_name))
|
||||
.setContentText(context.getString(R.string.settings_status_on_summary))
|
||||
.setContentIntent(pendingIntent)
|
||||
.setPriority(Notification.PRIORITY_MIN)
|
||||
.build();
|
||||
|
||||
} else {
|
||||
|
||||
Notification notification = new Notification(android.R.drawable.stat_notify_sync_noanim, null, 0);
|
||||
try {
|
||||
@@ -51,12 +61,9 @@ public class TrackingService extends Service {
|
||||
} catch (SecurityException | NoSuchMethodException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
notification.priority = Notification.PRIORITY_MIN;
|
||||
}
|
||||
|
||||
return notification;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.ECLAIR)
|
||||
|
||||
Ссылка в новой задаче
Block a user