Peter Cai
7ca33edd26
On Android 8.0+, the activity intent ACTION_PROVISIONING_SUCCESSFUL is also sent out before the broadcast ACTION_PROFILE_PROVISIONING_COMPLETE. We can make of use this to directly bring up an activity for finalization, skipping over our original notification-based switch-er-oo from the broadcast receiver. This is also necessary on platform release T since now we cannot send notifications by default. We cannot request for the permission either since that will require a visible activity too. Using the activity intent works around all of this and makes Shelter work again on T. (And we won't have to deal with the Do-Not-Disturb nonsense anymore)
20 lines
597 B
Java
20 lines
597 B
Java
package net.typeblog.shelter.ui;
|
|
|
|
import android.content.Intent;
|
|
import android.os.Bundle;
|
|
|
|
import androidx.annotation.Nullable;
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
public class FinalizeActivity extends AppCompatActivity {
|
|
@Override
|
|
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
Intent i = new Intent(getApplicationContext(), DummyActivity.class);
|
|
i.setAction(DummyActivity.FINALIZE_PROVISION);
|
|
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
startActivity(i);
|
|
finish();
|
|
}
|
|
}
|