MIUI does not send callback (#2279)
This commit is contained in:
parent
86d4722f80
commit
fdff7f5aad
|
|
@ -29,6 +29,7 @@ import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
|
import android.os.Handler;
|
||||||
import android.os.Looper;
|
import android.os.Looper;
|
||||||
import android.os.Process;
|
import android.os.Process;
|
||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
|
|
@ -126,7 +127,8 @@ public class App extends Application {
|
||||||
private static OkHttpClient okHttpClient;
|
private static OkHttpClient okHttpClient;
|
||||||
private static Cache okHttpCache;
|
private static Cache okHttpCache;
|
||||||
private SharedPreferences pref;
|
private SharedPreferences pref;
|
||||||
private final ExecutorService executorService = Executors.newCachedThreadPool();
|
private static final ExecutorService executorService = Executors.newCachedThreadPool();
|
||||||
|
private static final Handler MainHandler = new Handler(Looper.getMainLooper());
|
||||||
|
|
||||||
public static App getInstance() {
|
public static App getInstance() {
|
||||||
return instance;
|
return instance;
|
||||||
|
|
@ -144,6 +146,10 @@ public class App extends Application {
|
||||||
return !Process.isApplicationUid(Process.myUid());
|
return !Process.isApplicationUid(Process.myUid());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Handler getMainHandler() {
|
||||||
|
return MainHandler;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void attachBaseContext(Context base) {
|
protected void attachBaseContext(Context base) {
|
||||||
super.attachBaseContext(base);
|
super.attachBaseContext(base);
|
||||||
|
|
|
||||||
|
|
@ -97,6 +97,12 @@ public class ShortcutUtil {
|
||||||
context.registerReceiver(receiver, filter, permission,
|
context.registerReceiver(receiver, filter, permission,
|
||||||
null/* main thread */, Context.RECEIVER_NOT_EXPORTED);
|
null/* main thread */, Context.RECEIVER_NOT_EXPORTED);
|
||||||
|
|
||||||
|
App.getMainHandler().postDelayed(() -> {
|
||||||
|
if (isLaunchShortcutPinned()) {
|
||||||
|
task.run();
|
||||||
|
}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
var intent = new Intent(uuid);
|
var intent = new Intent(uuid);
|
||||||
int flags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE;
|
int flags = PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE;
|
||||||
return PendingIntent.getBroadcast(context, 0, intent, flags).getIntentSender();
|
return PendingIntent.getBroadcast(context, 0, intent, flags).getIntentSender();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue