App developers can limit the content inside their apps, if it's running on a restricted profile. With the new restricted profile system we can also limit which app's can be used in such profiles.
However, a lot of apps have to be fixed, because if we are using an app, and that app wants to start a not permitted activity on a restricted profile, then the app will crash.
The fix is simple, we have to check if the activity we want to launch exists, and if it exists we proceed to launch it. If the activity exists, it means that we hace access to it, so it's permitted.
developer.android.com example:
Intent intent = new Intent(Intent.ACTION_SEND); ... if (intent.resolveActivity(getPackageManager()) != null) { startActivity(intent); } else { Toast.makeText(context, R.string.app_not_available, Toast.LENGTH_LONG).show(); }
No hay comentarios:
Publicar un comentario