Этот коммит содержится в:
Anton Tananaev
2017-04-08 17:47:54 +12:00
родитель 9bae6e554f
Коммит d632c7cdfa
+14 -7
Просмотреть файл
@@ -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)