Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Clean fragments (only if the app is recreated (When user disable permission))
- FragmentManager fragmentManager = getSupportFragmentManager();
- if (fragmentManager.getBackStackEntryCount() > 0) {
- fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
- }
- // Remove previous fragments (case of the app was restarted after changed permission on android 6 and higher)
- List<Fragment> fragmentList = fragmentManager.getFragments();
- if (fragmentList != null) {
- for (Fragment fragment : fragmentList) {
- if (fragment != null) {
- fragmentManager.beginTransaction().remove(fragment).commit();
- }
- }
- }
- if (!((MyApplication)ApplicationContext).IsInitialized)
- {
- Intent intent = new Intent(Application.Context,typeof(StartupActivity));
- intent.SetFlags(ActivityFlags.NewTask);
- StartActivity(intent);
- Finish();
- }
- adb shell "ps | grep <com.yourpackage>" // get the app process id
- adb shell run-as <com.yourpackage> kill <app-process-id> // kill the app
Add Comment
Please, Sign In to add comment