Posts

Showing posts from January, 2020

Cheque MICR Code reader from image using tesseract.js

Cheque (MICR Code) Reader for Ionic 4 description: Cheque (MICR Code) Reader for Ionic 4 using tesseract.js ocr library Installation: Create an ionic project : ionic start MicrChequeProject blank --type=angular Install the dependencies: ``` npm install tesseract.js@1.0.14 npm install underscore ``` Create a service provider: ionic generate service services/ocr_provider Use this below code in your service provider Add the provider class name in the appmodule.ts Execute the project in the browser: ionic serve You can clone the full code from the below GitHub URL Github Repository: https://github.com/AndroidManikandan5689/IonicMICRCodeReader Demo Screenshot: https://github.com/AndroidManikandan5689/IonicMICRCodeReader/tree/master/screenshot/micr_tesseract.png Happy Coding...:)

Create custom cordova plugin for ionic

Image
Install plugman for create a custom plugin https://www.npmjs.com/package/plugman CLI command: npm install -g plugman Create a plugin using plugman: plugman create --name AppName --plugin_id cordova-plugin-myapp --plugin_version 0.0.1 cd AppName Create a package json for the plugin: plugman createpackagejson AppName Add a platform for android and ios: plugman platform add --platform_name android plugman platform add --platform_name ios Upload the plugin in github repositary Eg:  https://github.com/AndroidManikandan5689/Custom-cordova-plugin-example Publish the plugin in NPM repository npm publish --access=public Login npm for publish the plugin npm login Check the existing user through command line npm whoami Install the plugin in Ionic/Cordova project from the npm repository npm install <plugin_name> ionic cordova plugin add <plugin_name> (or) Install the plugin from local director to node modules folder npm install <local_dir

Pipes in Angular for Ionic

Image
Definition: Pipes are a useful feature in Angular.  They are a simple way to transform values in an Angular template. There are some built-in pipes available in angular. You can also create own pipes. A pipe takes in a value or values and then returns a value. Predefined Pipes: Lower case pipe - msg :  String  =  "This example for case pipes" {{ msg  |  lowercase }} Output :   this example for case pipes --------------------------------------------------------------------------------------- Upper case pipe - {{ msg  |  uppercase }} Output:    THIS EXAMPLE FOR CASE PIPES --------------------------------------------------------------------------------------- Title case pipe - Syntax:  {{ value_expression | titlecase}} {{ msg  |  titlecase }} Output:    This Example For Case Pipes --------------------------------------------------------------------------------------- Percentage pipe - Syntax:   {{ value | percent [ : digitsInfo [ :

Foreground Service with Notification chennal

Example code for notification in foreground service Here we are starting the foreground service from the MainActivity.kt //Start foreground service using notification channel id button.setOnClickListener { val intent = Intent(this, ForeGrService::class.java) intent.putExtra("extraText", editText.text.toString()) // startService(intent) //or ContextCompat.startForegroundService(this, intent) } Stop the service from the Activity class btn_stop.setOnClickListener { val intent: Intent = Intent(this, ForeGrService::class.java) stopService(intent) } onStartComment override method will trigger the notification using channel id in ForegroundService class override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { val extraText = intent?.getStringExtra("extraText"); if(Build.VERSION.SDK_INT >= Build.VER

Notification Channel in Android Kotlin

Image
Step 1: Create AppController class and extends from Application class then declared this class name into the application tag of the android manifest file AppController.kt class AppController : Application() { companion object { var CHANNEL_1_ID = "chennal1" val CHENNEL_2_ID = "ServiceChannel" } override fun onCreate() { super.onCreate() createNotificationChennal() } fun createNotificationChennal() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { val notificationChannel = NotificationChannel( CHANNEL_1_ID, "CHANNEL 1", NotificationManager.IMPORTANCE_DEFAULT ) notificationChannel.description = "Channel 1 description" notificationChannel.enableLights(true) notificationChannel.enableVibration(true) notificationChannel.lightColor = Color.GREEN

Connect android device using adb wifi without route

Image
Here we are going to see about ABD wifi for android device debug and connectivity using the same wifi Step 1: File -> Settings -> Plugins -> Marketplace -> type "adb wifi ultimate" -> Install "WIFI ADB ULTIMATE" plugin (Don't forogt to restart the android studio ide after install it) Step 2: Enable USB Debugging in Android device and connect the device in your pc with USB for the first time only Step 3: You can see the installed plugin in the right side tab bar of the android studio after restart it. Please refer below screenshot You can see the available device after clicking the refresh button. Press the play button on the right side of that device's name. The device will connect with your android studio through wifi. Now, you can unplug the USB and continue with wifi connection.

Key Hash generate for Facebook integration in Android

Image
The command for key hash generate in Windows     keytool -exportcert -alias androiddebugkey -keystore "C:\Users\USERNAME\.android\debug.keystore" | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" sha1 -binary | "PATH_TO_OPENSSL_LIBRARY\bin\openssl" base64   Example: keytool -exportcert -alias androiddebugkey -keystore "C:\Users\Manikandan.Kasinatha\.android\debug.keystore" | "C:\openssl\bin\openssl" sha1 -binary | "C:\openssl\bin\openssl" base64 Download OpenSSL execute the file from the below website https://www.openssl.org/source/

Memory Leaks on Android

Hello friends, Here we are exploring what is memory leaks in android and how to avoid memory leaks Tool: LeakCanary https://square.github.io/leakcanary/getting_started/ Add LeakCanary dependency in build.gradle Option 1: Add object-watcher-android to release builds. // Memory leaks debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0' implementation 'com.squareup.leakcanary:leakcanary-object-watcher-android:2.0' override fun onCreate() { super.onCreate() AppWatcher.config = AppWatcher.config.copy(watchFragmentViews = false) } There is no more code for the default setup.