ĬJ
_oL
p l 3
_lIMIƷ¿3F_Դє]Meߏ·... վLoch
2020Android_߀Б΃ŵČF
x2002 | uՓ3 ղ2 1 ٝ2

1


ƄӶIMúϢ͑õ_l߁fAndroid_@Ϥ^

ԏAndroid PAndroid 8.0FԺAndroidѽϵy挢_@l·oˣԔҊAndroid Pʽ漴_ñϢ͵جЩӳFıڿƼõҲԽԽˣԔҊȫPcǰAndroid_挍\Чֹ2019ǰmȻьӏS̵ROOMͨһS̵ͽӿڶһӣͬһS̲ͬϵy汾gҲͽӿڵļԆ}ܲһҪһҼԵͷSDK׌APP׃ĺܴ@׌APPd׃ĺܲѺ

֮Androidõĺ_ijЩ߀гm֮ǰЩԔıڿƼAndroid 9.0Android 10r҂߀ЩôՈߵ˼·ŵĺ_F

2020Android_߀Б΃ŵČF_timg-(1).jpg

2P


WNanBoxIAпƼWF"ȦAPP߼Android_l̎Ҫؓ؟˾ Android ĿģK_l漰 GPS λ؈DDƬ݋ȹ_lֱ푪Ŀ ĿБ Flutter ƽ__lgFԭ Flutter Ļ_l

ߘڷƽrg²ڶƽ_ǾߵһT¿x^ 10 f GitHub ж_ԴĿڈFꠃȲMмg Android Flutter ٷęng

3P


Ԕ˽ĿǰAndroidƽ_Ϻ_gՈx


ЩFAndroidڿƼֵúúxx


4AndroidF


҂֪Android ϵyښ_M̵rSϵy汾ĸM̵߀ԽԽڅݣҊAndroid Pʽ漴_ñϢ͵ج

ϵy@NlcǺõԹʡȴ͹ҲһЩåО

һ֑ñʹÈҪں_\ÑҲԸ׌ں_\еܲһЩеÌӏSͨIMϢYӍõ

һåܛøNåֶMбһϵyӴ󚢺_҂һЩҪں_\еđñ`಻

5ŵı


F˲١ڿƼ 1 ص Activityşo•lpM̻oȣxx@ϵУñKOY(һ)Android6.0µpMo`ñKOY()Android6.0ϵı`(M̷ƪ)ñKOY()Android6.0ϵı`(ͻƪ)

@ЩfǺåƉ Android BS Android ϵy汾ĸ@ЩdzҎıֶκܶ඼ʧЧ

Щ_Ҫں_\еđ҂ŵı

6_\аԃŵČF


Android 6.0 _ʼϵyʡģʽϵyCһΕrg_\еMϵyһ_\аđÌܵӰԭϵyͨ^Oá - 늳ء - 늳؃ - δáԿ@

ͨ@λ
2020Android_߀Б΃ŵČF_a.jpg

´αaƷf XXX Աʲô҂ĕr֪ôȥSͨ^֙CS̵ĺԼđĬJ뵽һՄ@NĴSҲͲ¿

ϵy߀]В҂S҂Ոёü

 AndroidManifest.xml ļһ™ޣ
<uses-permission android:name="android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS" />

ͨ^·Д҂đǷڰУ
@RequiresApi(api = Build.VERSION_CODES.M)
private boolean isIgnoringBatteryOptimizations() {
    boolean isIgnoring = false;
    PowerManager powerManager = (PowerManager) getSystemService(Context.POWER_SERVICE);
    if (powerManager != null) {
        isIgnoring = powerManager.isIgnoringBatteryOptimizations(getPackageName());
    }
    return isIgnoring;
}

ڰͨ^´aՈΣ
@RequiresApi(api = Build.VERSION_CODES.M)
public void requestIgnoreBatteryOptimizations() {
    try {
        Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS);
        intent.setData(Uri.parse("package:" + getPackageName()));
        startActivity(intent);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

ՈrϕF@һڣ
2020Android_߀Б΃ŵČF_b.jpg

Կ@ϵyӰ늳m׌ÑcSҪPfҪДÑǷcSՈĕr{ startActivityForResult onActivityResult ДһǷڰ

7_\аεĶSm䷽


7.1f


Android _lһyc֙CŠԭϵyM˲ͬĶ҂ҪMвͬm_һܺõwF׺S̶Լĺ_㑪ü˺_\аȻܕSԼĺ_ɵ

ܰёüSϵyĺ_MһM̱ĸͬďSڲͬĵطMOһڸԵġ֙CܼҡyͬһS̵ϵyͬİ汾ҲڲͬطO

҂ͬ֙CDzͬϵy汾oÑʬFһDIJEṩһoֱDָMOҪÿSÿ汾MmDZ^ʹCyԇ˴󲿷 Android S̵֙C˲֙CPY

҂Զx@Ӄɂ
/**
 * Dָõ
 */
private void showActivity(@NonNull String packageName) {
    Intent intent = getPackageManager().getLaunchIntentForPackage(packageName);
    startActivity(intent);
}

/**
 * Dָõָ
 */
private void showActivity(@NonNull String packageName, @NonNull String activityDir) {
    Intent intent = new Intent();
    intent.setComponent(new ComponentName(packageName, activityDir));
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    startActivity(intent);
}

Dz֙CďSДDOòEDCа汾϶ܳɹDҪ try catch

7.2A


SДࣺ
public boolean isHuawei() {
    if (Build.BRAND == null) {
        return false;
    } else {
        return Build.BRAND.toLowerCase().equals("huawei") || Build.BRAND.toLowerCase().equals("honor");
    }
}

DA֙CܼҵĆӹ퓣
private void goHuaweiSetting() {
    try {
        showActivity("com.huawei.systemmanager",
            "com.huawei.systemmanager.startupmgr.ui.StartupNormalAppListActivity");
    } catch (Exception e) {
        showActivity("com.huawei.systemmanager",
            "com.huawei.systemmanager.optimize.bootstart.BootStartActivity");
    }
}

EÆӹ -> P]_P -> _SԆ

7.3С


SДࣺ
public static boolean isXiaomi() {
    return Build.BRAND != null && Build.BRAND.toLowerCase().equals("xiaomi");
}

DСװȫĵԆӹ棺
private void goXiaomiSetting() {
    showActivity("com.miui.securitycenter",
        "com.miui.permcenter.autostart.AutoStartManagementActivity");
}

Eڙ -> Ԇӹ -> SԆ

7.4OPPO


SДࣺ
public static boolean isOPPO() {
    return Build.BRAND != null && Build.BRAND.toLowerCase().equals("oppo");
}

D OPPO ֙Cܼң
private void goOPPOSetting() {
    try {
        showActivity("com.coloros.phonemanager");
    } catch (Exception e1) {
        try {
            showActivity("com.oppo.safe");
        } catch (Exception e2) {
            try {
                showActivity("com.coloros.oppoguardelf");
            } catch (Exception e3) {
                showActivity("com.coloros.safecenter");
            }
        }
    }
}

E[˽ -> Ԇӹ -> SԆ

7.5VIVO


SДࣺ
public static boolean isVIVO() {
    return Build.BRAND != null && Build.BRAND.toLowerCase().equals("vivo");
}

D VIVO ֙Cܼң
private void goVIVOSetting() {
    showActivity("com.iqoo.secure");
}

E޹ -> Ԇ -> SԆ

7.6


SДࣺ
public static boolean isMeizu() {
    return Build.BRAND != null && Build.BRAND.toLowerCase().equals("meizu");
}

D֙Cܼң
private void goMeizuSetting() {
    showActivity("com.meizu.safe");
}

E޹ -> _ -> c -> S_\

7.7


SДࣺ
public static boolean isSamsung() {
    return Build.BRAND != null && Build.BRAND.toLowerCase().equals("samsung");
}


private void goSamsungSetting() {
    try {
        showActivity("com.samsung.android.sm_cn");
    } catch (Exception e) {
        showActivity("com.samsung.android.sm");
    }
}

EԄ\Бó -> __P -> 늳ع -> δOҕđó -> ӑ

7.8ҕ


SДࣺ
public static boolean isLeTV() {
    return Build.BRAND != null && Build.BRAND.toLowerCase().equals("letv");
}

Dҕ֙Cܼң
private void goLetvSetting() {
    showActivity("com.letv.android.letvsafe", 
        "com.letv.android.letvsafe.AutobootManageActivity");
}

EԆӹ -> SԆ

7.9N


SДࣺ
    public static boolean isSmartisan() {
        return Build.BRAND != null && Build.BRAND.toLowerCase().equals("smartisan");
    }

D֙C
private void goSmartisanSetting() {
    showActivity("com.smartisanos.security");
}

E޹ -> Ԇә޹ -> c -> Sϵy

8¾


֮ǰܲOһOᵽO÷@

lFijҲMD 1 ҂D 2 ijģ
2020Android_߀Б΃ŵČF_c.jpg

ijˏOӋҌIJõİҏʮ_֙CһһĈDMȫλ¾xij˵Jijl @ôһԒ¾ͬrܲfһxx

ij˵¾һfĿǰ_MױyȴĆ}һҲf@NÑMаOõֶЧ

䛣Pg


ñKOY(һ)Android6.0µpMo`
ñKOY()Android6.0ϵı`(M̷ƪ)
ñKOY()Android6.0ϵı`(ͻƪ)
AndroidM̱Ԕ⣺һƪ½QɆ
AndroidϢͿYFԭĆ}
AndroidϢ@С
λTCPfhƄӶIMȻҪC
΢ňFԭAndroid΢ź_(M̱ƪ)
΢ňFԭAndroid΢ź_(Wjƪ)
ƄӶIM`FAndroid΢ŵC
ƄӶIM`WhatsAppLine΢ŵԷ
Android Pʽ漴_ñϢ͵ج
ȫPcǰAndroid_挍\Чֹ2019ǰ
һxrͨӍеľWjCƣԭF˼·
Ƽgư׿IMaƷľWj·g`
_IMLBӵBC֌FIMԴa
2020Android_߀Б΃ŵČF
>> ͬ

rͨӍW - rͨӍ_l^ Դ - rͨӍ_l^

һƪ΢ŵIMappi_rBmӺз

¼g݋

]
3
ĺܺղ
֮ĿǰֻЃɷNЧ;ҪÑքӸAһǺ늳؃DozegԿʹþWjÑ__\кԆӣ@һҪÿC_ڲһmdz韩҃ǰҲ@ЩÿΏʾsnackbarĕrÑֻ͟עጵ䌍߀һNJobScheduler8.09.0ٵ10.0ԽԽL
ãhmtabc l 2019-12-30 09:29
֮ĿǰֻЃɷNЧ;ҪÑքӸAһǺ늳؃DozegԿʹþWj ...

_cٵSهڱđIչҪQ˼·mϵy@
: ^mϰ
p ×
ʹ΢Ŵp ʹ֧p

ʮһѡ忪