Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing pendingintent for A12 #471

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,14 @@ static void notifcation(Context context, String messageString, Intent intent, in
//the message that will be displayed as the ticker
String ticker = contentTitle + " " + messageString;

int retryFlags = PendingIntent.FLAG_UPDATE_CURRENT;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
retryFlags |= PendingIntent.FLAG_IMMUTABLE;
}

//build the pending intent that will start the appropriate activity
PendingIntent pendingIntent = PendingIntent.getActivity(context,
0, intent, 0);
0, intent, retryFlags);

//build the notification
Builder notificationCompat = new Builder(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,13 @@ public void start() {
Log.d(TAG, "Register alarmreceiver to MqttService"+ action);
service.registerReceiver(alarmReceiver, new IntentFilter(action));

int retryFlags = PendingIntent.FLAG_UPDATE_CURRENT;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
retryFlags |= PendingIntent.FLAG_IMMUTABLE;
}

pendingIntent = PendingIntent.getBroadcast(service, 0, new Intent(
action), PendingIntent.FLAG_UPDATE_CURRENT);
action), retryFlags);

schedule(comms.getKeepAlive());
hasStarted = true;
Expand Down