CopyPastor

Detecting plagiarism made easy.

Score: 0.8004468083381653; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2019-04-24
by Ganesh Pokale

Original Post

Original - Posted on 2017-11-15
by Sagar



            
Present in both answers; Present only in the new answer; Present only in the old answer;

Main Reason behind this is AutoLaunch and Battery Optimization(MIUI) devices try to change don't optimize option for your app in Battery setting
private void initOPPO() { try { Intent i = new Intent(Intent.ACTION_MAIN); i.setComponent(new ComponentName("com.oppo.safe", "com.oppo.safe.permission.floatwindow.FloatWindowListActivity")); startActivity(i); } catch (Exception e) { e.printStackTrace(); try { Intent intent = new Intent("action.coloros.safecenter.FloatWindowListActivity"); intent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.floatwindow.FloatWindowListActivity")); startActivity(intent); } catch (Exception ee) { ee.printStackTrace(); try { Intent i = new Intent("com.coloros.safecenter"); i.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.sysfloatwindow.FloatWindowListActivity")); startActivity(i); } catch (Exception e1) { e1.printStackTrace(); } } } } private static void autoLaunchVivo(Context context) { try { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.iqoo.secure", "com.iqoo.secure.ui.phoneoptimize.AddWhiteListActivity")); context.startActivity(intent); } catch (Exception e) { try { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.vivo.permissionmanager", "com.vivo.permissionmanager.activity.BgStartUpManagerActivity")); context.startActivity(intent); } catch (Exception ex) { try { Intent intent = new Intent(); intent.setClassName("com.iqoo.secure", "com.iqoo.secure.ui.phoneoptimize.BgStartUpManager"); context.startActivity(intent); } catch (Exception exx) { ex.printStackTrace(); } } } }

Usage
if (Build.MANUFACTURER.equalsIgnoreCase("oppo")) { initOPPO(); } else if (Build.MANUFACTURER.equalsIgnoreCase("vivo")) { autoLaunchVivo(BaseSettingActivity.this); } else if (Build.MANUFACTURER.equalsIgnoreCase("xiaomi")) { try { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.miui.securitycenter", "com.miui.permcenter.autostart.AutoStartManagementActivity")); startActivity(intent); } catch (Exception e) { e.printStackTrace(); } }
Please check the following solution to enable the `floating window` and `autostart permission` for `OPPO` and `VIVO` devices.
**There's no way to find out whether the Auto-start option is enabled or not**. You can manually check under `Security permissions => Autostart => Enable Autostart`.

## On Oppo devices:
private void initOPPO() { try {
Intent i = new Intent(Intent.ACTION_MAIN); i.setComponent(new ComponentName("com.oppo.safe", "com.oppo.safe.permission.floatwindow.FloatWindowListActivity")); startActivity(i); } catch (Exception e) { e.printStackTrace(); try {
Intent intent = new Intent("action.coloros.safecenter.FloatWindowListActivity"); intent.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.permission.floatwindow.FloatWindowListActivity")); startActivity(intent); } catch (Exception ee) {
ee.printStackTrace(); try{
Intent i = new Intent("com.coloros.safecenter"); i.setComponent(new ComponentName("com.coloros.safecenter", "com.coloros.safecenter.sysfloatwindow.FloatWindowListActivity")); startActivity(i); }catch (Exception e1){
e1.printStackTrace(); } }
} }
## Auto Start permission for VIVO
private static void autoLaunchVivo(Context context) { try { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.iqoo.secure", "com.iqoo.secure.ui.phoneoptimize.AddWhiteListActivity")); context.startActivity(intent); } catch (Exception e) { try { Intent intent = new Intent(); intent.setComponent(new ComponentName("com.vivo.permissionmanager", "com.vivo.permissionmanager.activity.BgStartUpManagerActivity")); context.startActivity(intent); } catch (Exception ex) { try { Intent intent = new Intent(); intent.setClassName("com.iqoo.secure", "com.iqoo.secure.ui.phoneoptimize.BgStartUpManager"); context.startActivity(intent); } catch (Exception exx) { ex.printStackTrace(); } } } }
## Auto Start for OPPO
if (Build.MANUFACTURER.equalsIgnoreCase("oppo")) { try { Intent intent = new Intent(); intent.setClassName("com.coloros.safecenter", "com.coloros.safecenter.permission.startup.StartupAppListActivity"); startActivity(intent); } catch (Exception e) { try { Intent intent = new Intent(); intent.setClassName("com.oppo.safe", "com.oppo.safe.permission.startup.StartupAppListActivity"); startActivity(intent);
} catch (Exception ex) { try { Intent intent = new Intent(); intent.setClassName("com.coloros.safecenter", "com.coloros.safecenter.startupapp.StartupAppListActivity"); startActivity(intent); } catch (Exception exx) {
} } } }

        
Present in both answers; Present only in the new answer; Present only in the old answer;