How To Kill Android Process If User Opens Youtube
Possible Duplicate: How to restrict Android device to not open some specific site e.g.youtube, facebook I am writing an application and a feature is that if the user opens youtu
Solution 1:
I am writing an application and a feature is that if the user opens youtube.com then not allow him to do this.
Fortunately, malware authors have limited ability to do things like this.
So I planned to kill the Android browser process if the user try to open it.
Fortunately, this is impossible, at least on Android 2.1+.
I know that this code kills the process
Only if you have rights to kill that process. Fortunately, you do not have rights to kill that process.
Solution 2:
If it is a webview they are opening the url in then you could use the public boolean shouldOverrideUrlLoading (WebView view, String url)
this gives the host application a chance to take over the control when a new url is about to be loaded in the current WebView.
example:
WebViewClient yourWebClient = newWebViewClient()
{
// Override page@OverridepublicbooleanshouldOverrideUrlLoading(WebView view, String url)
{
// This line we let me load only pages inside Firstdroid Webpageif ( url.contains("youtube") == true )
//Load new URL & override URL Linkreturntrue;
// Return false to not override url loading.returnfalse;
}
};
Post a Comment for "How To Kill Android Process If User Opens Youtube"