You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+2-56Lines changed: 2 additions & 56 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,60 +3,9 @@
3
3
The Android Restricted WebView is an Android application template that allows you to display a specific website using a WebView while restricting access to other sites. If the application attempts to load a URL other than the allowed site, an error message "This URL is not allowed" will be displayed.
4
4
5
5
## Configuration
6
+
in `app/build.gradle` file.
6
7
7
-
To configure the application and set the allowed website, follow these steps:
8
-
9
-
1. Open the project in Android Studio.
10
-
2. Navigate to the `MainActivity.java` file.
11
-
3. Locate the line 33 containing the `ALLOWED_DOMAIN` constant.
12
-
4. Replace the value of the `ALLOWED_DOMAIN` constant with the desired URL for the allowed site.
Make sure to provide a valid URL for the website you want to allow in the application.
19
-
20
-
## Portrait Mode Configuration
21
-
22
-
The Android Restricted WebView also allows for the forcing of screen orientation to portrait mode. This is controlled by the `FORCE_PORTRAIT` constant on line 31 in the `MainActivity` class.
23
-
24
-
To configure this, follow these steps:
25
-
26
-
1. In the `MainActivity.java` file, locate the line 34 containing the `FORCE_PORTRAIT` constant.
27
-
2. Replace the value of the `FORCE_PORTRAIT` constant to `true` to enforce portrait mode or `false` to allow the system and user preferences to determine the screen orientation.
28
-
```java
29
-
privatestaticfinalbooleanFORCE_PORTRAIT=true; // Change this value to true or false
30
-
```
31
-
3. Save the changes.
32
-
33
-
After modifying this value, you need to recompile and redeploy the application for the change to take effect.
34
-
35
-
## Changing the Package Name
36
-
37
-
To change the package name of the application, follow these steps:
38
-
39
-
1. Open the project in Android Studio.
40
-
2. Locate the `build.gradle` file (Module: app).
41
-
3. In the `build.gradle` file, find the line 9 containing the `applicationId`.
42
-
4. Replace the value of the `applicationId` with the desired package name.
43
-
```gradle
44
-
defaultConfig {
45
-
// ...
46
-
applicationId "com.example.newpackagename"
47
-
// ...
48
-
}
49
-
```
50
-
5. Sync the project with Gradle to apply the changes.
51
-
52
-
Ensure that the new package name follows the proper naming conventions.
53
-
54
-
## Usage
55
-
56
-
After configuring the allowed URL, setting the portrait mode preference, and optionally changing the package name, you can run the application on an Android emulator or device. The application will display the web page of the allowed site within the WebView.
57
-
58
-
If an attempt is made to load a URL other than the allowed site, the application will display an error message "This URL is not allowed" instead of the content.
59
-
8
+
recompile and redeploy the application for the change to take effect.
60
9
61
10
## License
62
11
@@ -65,6 +14,3 @@ This application is distributed under the GNU General Public License version 3 (
65
14
## Disclaimer
66
15
67
16
Please note that I am not a lawyer and the information provided here should not be considered legal advice. It is important to consult with a qualified legal professional to ensure compliance with all relevant licensing requirements and obligations.
0 commit comments