When you receive a signal from SPIN, call the methods in sequence:

  1. Wake up: moves the application into focus when it is in the background

private void wakeUp() {
    this.runOnUiThread(() -> {
        KeyguardManager km1 = (KeyguardManager) MainActivity.this.getSystemService(Context.KEYGUARD_SERVICE);        
        final KeyguardManager.KeyguardLock kl1 = km1.newKeyguardLock("MyKeyguardLock");        
        kl1.disableKeyguard();        
        PowerManager pm = (PowerManager) MainActivity.this.getSystemService(Context.POWER_SERVICE);        
        PowerManager.WakeLock wakeLock = pm.newWakeLock(
              PowerManager.FULL_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP | PowerManager.ON_AFTER_RELEASE, "Tag:wakeUp"
        );
        wakeLock.acquire();        
        wakeLock.release();    
        }
    );
}

2) Set display active

private void bringApplicationToFront() {
    Intent notificationIntent = new Intent(this, MainActivity.class);    
    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);    
    PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notificationIntent, 0);    
    try {
        pendingIntent.send();    
    } catch (PendingIntent.CanceledException e) {
        e.printStackTrace();    
    }
}