Posts

How to make a Flashlight App in Sketchware App

Image
1) Create a New project in Sketchware. 2) In view area add a LinearLayout as linear1  and set it's layout to center horizontal and center vertical. Then add Imageview as imageview1 . Set it's width and height to 100dp and scale type to FIT_XY. Then on image manager add two images ic_flash_on_black and ic_flash_off_black . Set imageview1 to  ic_flash_off_black . 3) In library manager switch on AppCompat and Design. 4) Add a Camera component. 5) Add two Boolean Variables as flashLightStatus and hasCameraFlash . 6) Add two more blocks as flashLightOn and flashLightOff . 7) In OnCreate event add an add source directly block with code: hasCameraFlash = getPackageManager(). hasSystemFeature(PackageManager.FEATURE_CAMERA_FLASH); 8) In More block flashLightOn add a add source directly block with code: android.hardware.camera2.CameraManager cameraManager = (android.hardware.camera2.CameraManager) getSystemService(Context.CAMERA_SERVICE); try { S

How to Check Latest Version in sketchware with Firebase Database

Image
1) Create a new project in Sketchware. 2) Add Firebase library in the library. Make sure the rules in your Firebase database are read and write true. 3) Add Firebase Database component as version:version 4) Add String variables as package_name, your_version, latest_version and Add map variable as map 5) Then OnCreate event set string package_name to your app package. In this tutorial I am using sketchware.check.version 6) Then below set string block add two add source directly block. First code is try { android.content.pm.PackageInfo pinfo = getPackageManager().getPackageInfo( package_name, android.content.pm.PackageManager.GET_ACTIVITIES); your_version = pinfo.versionName; } catch (Exception e){ showMessage(e.toString()); } Second code is DatabaseReference rootRef = _firebase.getReference(); rootRef.child("version").addListenerForSingleValueEvent(new ValueEventListener() { @Override public void onDataChange(DataSnapshot snapshot) { if (snap

How to Enable Own Download in Sketchware app.

Image
Enable own Download in sketchware app. Ads:- Follow the below instructions :- 1) Create a New project in Sketchware. 2) In View area add WebView as webview1 3) Add more block as download_path with String as file_path 4) On create Activity event add as shown Here I have used " /Webview/Download/ " folder as download folder. You can change it to your choice by changing all the text" /Webview/Download/ ". Codes below copy to the add source directly block as shown above. webview1.setDownloadListener(new DownloadListener() { public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) { DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url)); String cookies = CookieManager.getInstance().getCookie(url); request.addRequestHeader("cookie", cookies); request.addRequestHeader("User-Agent", userAgent); request.setDescription("

Enable Fullscreen for Youtube videos in WebView

Image
1) Create a New project in Sketchware App. 2) In View area add WebView as webview1 . 3) Add more block as full . 4) Copy the below code to more block in add source directly } public class CustomWebClient extends WebChromeClient { private View mCustomView; private WebChromeClient.CustomViewCallback mCustomViewCallback; protected FrameLayout frame; // Initially mOriginalOrientation is set to Landscape private int mOriginalOrientation = android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE; private int mOriginalSystemUiVisibility; // Constructor for CustomWebClient public CustomWebClient() {} public Bitmap getDefaultVideoPoster() { if (MainActivity.this == null) { return null; } return BitmapFactory.decodeResource(MainActivity.this.getApplicationContext().getResources(), 2130837573); } public void onShowCustomView(View paramView, WebChromeClient.CustomViewCallback viewCallback) { if (this.mCustomView != null) { onHideCustomVie