11package mgks .os .swv ;
22
3- /*
4- Smart WebView v7
5- https://github.com/mgks/Android-SmartWebView
6-
7- A modern, open-source WebView wrapper for building advanced hybrid Android apps.
8- Native features, modular plugins, and full customisation—built for developers.
3+ import android . content . Context ;
4+ import android . content . pm . ApplicationInfo ;
5+ import android . content . pm . PackageInfo ;
6+ import android . content . pm . PackageManager ;
7+ import android . os . Build ;
8+ import android . util . Log ;
99
10- - Documentation: https://docs.mgks.dev/smart-webview
11- - Plugins: https://docs.mgks.dev/smart-webview/plugins
12- - Discussions: https://github.com/mgks/Android-SmartWebView/discussions
13- - Sponsor the Project: https://github.com/sponsors/mgks
10+ import androidx .multidex .BuildConfig ;
1411
15- MIT License — https://opensource.org/licenses/MIT
12+ public class MetaPull {
1613
17- Mentioning Smart WebView in your project helps others find it and keeps the dev loop alive.
18- */
14+ private final Context context ;
15+ private static final String TAG = "MetaPull" ;
1916
20- import android .os .Build ;
17+ public MetaPull (Context context ) {
18+ this .context = context ;
19+ }
2120
22- public class MetaPull {
23- String swv (){
24- return "SWV.RELEASE : 7.1"
25- +"\n SWV.BUILD : 7"
26- +"\n SWV.SDK.MIN : 23"
27- +"\n SWV.SDK.MAX : 35"
28- +"\n SWV.BUILD.TYPE : release"
29- +"\n SWV.BUILD.NAME : 7.1"
30- +"\n SWV.PACKAGE.NAME : mgks.os.swv" ;
21+ String swv () {
22+ try {
23+ PackageInfo pInfo = context .getPackageManager ().getPackageInfo (context .getPackageName (), 0 );
24+ ApplicationInfo appInfo = context .getApplicationInfo ();
25+
26+ String buildType = BuildConfig .DEBUG ? "debug" : "release" ;
27+ int minSdk = appInfo .minSdkVersion ;
28+ int targetSdk = appInfo .targetSdkVersion ;
29+
30+ return "SWV.RELEASE : " + pInfo .versionName
31+ + "\n SWV.BUILD : " + pInfo .versionCode
32+ + "\n SWV.SDK.MIN : " + minSdk
33+ + "\n SWV.SDK.MAX : " + targetSdk
34+ + "\n SWV.BUILD.TYPE : " + buildType
35+ + "\n SWV.BUILD.NAME : " + pInfo .versionName
36+ + "\n SWV.PACKAGE.NAME : " + context .getPackageName ();
37+
38+ } catch (PackageManager .NameNotFoundException e ) {
39+ Log .e (TAG , "Could not get package info" , e );
40+ return "Error fetching app info." ;
41+ }
3142 }
3243
33- String device (){
34- return "VERSION.RELEASE : " +Build .VERSION .RELEASE
35- +"\n VERSION.SDK.NUMBER : " +Build .VERSION .SDK_INT
36- +"\n MANUFACTURER : " +Build .MANUFACTURER
37- +"\n MODEL : " +Build .MODEL ;
38-
39- // consider these if really necessary
40- /*
41- //+"\nVERSION.INCREMENTAL : "+Build.VERSION.INCREMENTAL
42- //+"\nBOARD : "+Build.BOARD
43- //+"\nBOOTLOADER : "+Build.BOOTLOADER
44- //+"\nDISPLAY : "+Build.DISPLAY
45- //+"\nFINGERPRINT : "+Build.FINGERPRINT
46- //+"\nHARDWARE : "+Build.HARDWARE
47- //+"\nBRAND : "+Build.BRAND
48- //+"\nHOST : "+Build.HOST
49- //+"\nID : "+Build.ID
50- //+"\nPRODUCT : "+Build.PRODUCT
51- //+"\nTAGS : "+Build.TAGS
52- //+"\nTIME : "+Build.TIME
53- //+"\nTYPE : "+Build.TYPE
54- //+"\nUNKNOWN : "+Build.UNKNOWN
55- //+"\nUSER : "+ Build.USER;
56- */
44+ String device () {
45+ return "VERSION.RELEASE : " + Build .VERSION .RELEASE
46+ + "\n VERSION.SDK.NUMBER : " + Build .VERSION .SDK_INT
47+ + "\n MANUFACTURER : " + Build .MANUFACTURER
48+ + "\n MODEL : " + Build .MODEL ;
5749 }
58- }
50+ }
0 commit comments