Friday 28 February 2020

Flutter Command

10:43:00 Posted by Kumanan ,
To run in all connected device:
flutter run -d all 


To run in a device :
flutter run -d <device-id>


To run in a device in release mode:

flutter run --release -d <device-id>


To get List of emulators :
flutter emulators

To run an emulator :
flutter emulators -- launch <emulator-name>

Help :
flutter -h

To run in a release mode: flutter run --release To run in debug mode : flutter run To run in profile mode : flutter run --profile

To clear Build Cache : flutter clean

To view the connected devices :
flutter devices

To check flutter version
flutter version

Monday 22 January 2018

Wednesday 13 September 2017

Get MAC Address from Android

17:21:00 Posted by Kumanan ,
Permission in AndroidManifest.xml :-

<uses-permission android:name="android.permission.INTERNET" />


Method to get MAC address :-

public static String getMacAddr() {
        try {
            List<NetworkInterface> all = Collections.list(NetworkInterface.getNetworkInterfaces());
            for (NetworkInterface nif : all) {
                if (!nif.getName().equalsIgnoreCase("wlan0")) continue;

                byte[] macBytes = nif.getHardwareAddress();
                if (macBytes == null) {
                    return "";
                }

                StringBuilder res1 = new StringBuilder();
                for (byte b : macBytes) {
                    res1.append(String.format("%02X:",b));
                }

                if (res1.length() > 0) {
                    res1.deleteCharAt(res1.length() - 1);
                }
                return res1.toString();
            }
        } catch (Exception ex) {
        }
        return "02:00:00:00:00:00";
    }

Saturday 17 June 2017

Samba error in Ubuntu

15:41:00 Posted by Kumanan , ,
'net usershare' returned error 255: net usershare add: cannot share path /var/www/html/moodle as we are restricted to only sharing directories we own :-

cd /etc/samba

Then Edit the configuration file :
sudo gedit smb.conf

And then add a line in Global Settings :
   usershare owner only = false


After doing this, restart your samba service using,

sudo service smbd restart

Friday 7 April 2017

Change color of a material icon - Android

17:27:00 Posted by Kumanan , ,
public final class DrawableUtils {

    public static Drawable applyColorFilter(@NonNull Context context, @DrawableRes int drawableId, @ColorRes int colorId, @NonNull PorterDuff.Mode mode) {
        Drawable d = ContextCompat.getDrawable(context, drawableId);
        int color = ContextCompat.getColor(context, colorId);

        d.setColorFilter(color, mode);
        return d;
    }

    public static Drawable applyColorFilter(@NonNull Context context, @DrawableRes int drawableId) {
        return applyColorFilter(context, drawableId, R.color.colorPrimaryDark, PorterDuff.Mode.SRC_ATOP);
    }
}