DanielAnderson94
Lurker
I got an app that user a timer. When the time on timer hit t= 0 a notification pops on the screen.
With a tap on the notification the vibration stops. It works both in home and locked screen.
But when on the locked screen, the phone requires the pin-code when pushing the notification to launch the method that stops the vibration. How can I code so that the pin-code is not required when pushing the notification?
With a tap on the notification the vibration stops. It works both in home and locked screen.
But when on the locked screen, the phone requires the pin-code when pushing the notification to launch the method that stops the vibration. How can I code so that the pin-code is not required when pushing the notification?
Java:
public void showNotification() {
Intent i = new Intent(this, MyBroadcastReceiver.class);
PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, i, 0 );
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext(), "1")
.setContentTitle("Timer Vibration")
.setContentText("The timer is vibrating")
// .setPriority(NotificationCompat.PRIORITY_DEFAULT)
.setDefaults(NotificationCompat.DEFAULT_ALL) // Added by me
.setPriority(NotificationCompat.PRIORITY_MAX) // Added by me
.setContentIntent(pendingIntent)
.setSmallIcon(R.drawable.ic_arrow_upward_black_24dp)
.setAutoCancel(true);
// mBuilder.build();
NotificationManagerCompat notificatManager = NotificationManagerCompat.from(this);
notificatManager.notify(70, mBuilder.build());
}