CopyPastor

Detecting plagiarism made easy.

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

Possible Plagiarism

Plagiarized on 2018-12-28
by Farid Haq

Original Post

Original - Posted on 2017-10-25
by itzhar



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

Finally i tested almost all devices and works fine. The code given as follows
public void goToPushSettingPage(Context context) { try { Intent intent=new Intent(); if(Build.VERSION.SDK_INT>Build.VERSION_CODES.N_MR1){ intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_APP_PACKAGE,context.getPackageName()); }else if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ intent.setAction(Settings.ACTION_APP_NOTIFICATION_SETTINGS); intent.putExtra(ConstUtil.PUSH_SETTING_APP_PACKAGE,context.getPackageName()); intent.putExtra(ConstUtil.PUSH_SETTING_APP_UID,context.getApplicationInfo().uid); }else{ intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setData(Uri.parse(ConstUtil.PUSH_SETTING_URI_PACKAGE+context.getPackageName())); } startActivity(intent); } catch (Exception e) { // log goes here } }
public static void goToNotificationSettings(Context context) { Intent intent = new Intent(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.setData(Uri.fromParts(SCHEME, context.getPackageName(), null)); } else if (Build.VERSION.SDK_INT > Build.VERSION_CODES.N_MR1) { intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); intent.putExtra("app_package", context.getPackageName()); } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); intent.putExtra("app_package", context.getPackageName()); intent.putExtra("app_uid", context.getApplicationInfo().uid); } else if (Build.VERSION.SDK_INT == Build.VERSION_CODES.KITKAT) { intent.setAction(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setData(Uri.parse("package:" + context.getPackageName())); } else { return; } context.startActivity(intent); }

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