Skip to content
Gradient border and text color with jetpack compose

Jetpack Compose Gradient

Drawing gradient border or text color as gradient is quiet cumbersome task with Android Java or Kotlin, with Jetpack compose its a very simple and straight forward which can be accomplished with very steps.
Here is how it can be down to draw a gradient border and gradient text color.

Gradient Border Color

Image(
            painter = painterResource(user.avatar),
            contentDescription = user.name,
            modifier = Modifier
                .size(80.dp)
                .clip(RoundedCornerShape(40.dp))
                .border(
                    1.dp,
                    brush = Brush.verticalGradient(gradient01),
                    shape = RoundedCornerShape(40.dp)
                ),
        )

Output

Gradient Text Color

Text(
            text = "saharakks",
            style = TextStyle(
                brush = Brush.verticalGradient(gradient01),
                fontWeight = FontWeight.Bold
            ),
            modifier = Modifier
                .padding(10.dp)
        )

Output



What is Google Play Billing System?

Google Play Billing is a payment system that allows users to purchase digital content on Android devices. It includes the Google Play Store app for downloading apps and games, as well as the Google Play Music app for purchasing and streaming music.

To make a purchase using Google Play Billing, a user must have a Google account and a form of payment method linked to their account, such as a credit card or a Google Play gift card. When a user wants to make a purchase, they can select the item they want and confirm the payment using the linked payment method.

Google Play Billing uses a flexible pricing model that allows developers to offer a variety of purchase options, including one-time purchases, subscriptions, and in-app purchases. Developers can also offer free trials and promotional discounts to encourage users to make a purchase.

One of the key features of Google Play Billing is its ability to manage subscriptions. Subscriptions allow users to pay for access to content on a recurring basis, such as monthly or annually. When a user subscribes to a service, they will be automatically charged at the start of each billing cycle until they choose to cancel the subscription.

Google Play Billing also includes features to help protect against fraudulent activity and unauthorized purchases. It allows users to set up password protection for purchases and provides tools for developers to detect and prevent fraudulent transactions.

Overall, Google Play Billing is a reliable and convenient system for users to purchase digital content on Android devices and for developers to monetize their apps and games.

Available platform

Google Play Billing is supported on Android devices that have the Google Play Store app installed. It is not available on iOS devices or other platforms.

Issues and Solutions while upgrading Google Play Billing Library version 3

Issues and Solutions while upgrading Google Play Billing Library version 3?

You might receive an email regarding last date to update your app to Google Play Billing Library 4 or later by Nov 1, you might also see a similar reminder alert at android developer site when you visit Google Play billing system which says:

Reminder: Starting on August 2, 2022, all new apps must use Billing Library version 4 or newer. By November 1, 2022, all updates to existing apps must use Billing Library version 4 or newer. Learn more.

So one of main issue the developer might face when he is managing multiple clients and accounts with multiple apps is to find out exactly which apps are going to be effected, because many of my clients contacted me in panic after getting this email as they were unable to find which apps are causing the issue. That is why I am writing this post to help people who are facing similar issues.

Google had announced back in August 2022, about deprecation the Play Billing version 3, and instructs developers to update their Billing Library by 1 November, 2022. Although many of them had already upgraded to latest versions of Play Billing Library to version 4 or 5 respectively.

Contents

Find depreciated Applications

I am going to explain step-by-step instruction how you can find app that are using old Google Play Billing or later than 4 by what i mean. Our goal here is to find apk or app that is triggering that warning.

Methods

Find through Android Studio

Open your android project in Android Studio, and Open your project AndroidManifest.xml file and search for permission com.android.vending.BILLING if you found that means its is the on that you might be be looking for, one you found this permission also open buid.gradle for your project and make sure version for Play Billing Library should be greater than 4.0.0

You have to repeat this procedure for every application that you have published on Google Play Store to find out depreciated Google Play Billing Library

 

Find in Google Play Console

To find application that is using billing you have to access your Google Play Store account then have to do the below actions for all apps one by one to find the effected app.

  1. Select App Apps from the left menu
  2. Select App that you want to Check
  3. Once you are in App Dashboard select App Bundle Explorer
  4. Choose Active release of your application by clicking the -> arrow button
  5. In the detail tab scroll down to the permissions and click Show Detail option which have chevron down icon with it.
  6. In permission list check for com.android.vending.BILLING and if you find it, that’s means might be the app you are searching for.
Screenshot of Google Play Console showing how you can find if Google Play Billing Library 3 is used

Frequently Asked Questions


Question: Which version of Play Billing Library is expiring?

Answer: Play Billing Library 3

Question: When Google announced depreciation of Play Billing Library 3?

Answer: On 02, August 2022

Question: Until when i can upgrade Play Billing Library 3?

Answer: 01 November,2022

Question: How long support is provided for Play Billing Library?

Answer: For major released Google continue support it for 2 years

Question: What are current Play Billing Library version that i upgrade to?

Answer: You can upgrade your Play Billing Library 4 or 5 . Version 4 will be supported for up-to 2024 and version 5 till 2025

Do you have any specific query?

Additional Resources

Zen coding plugin for gedit 3

Hi guys are you using gedit as your primary code editor and want to install zen coding plugin you are in right place, there are 2 popular plugin for gedit although that are not maintained since a long time.

First one which i tried and i abled to run it on my system is
https://github.com/mikecrittenden/zen-coding-gedit

although you have to make a little tweak while installing the plugin you have to change the plugin file name zencoding.gedit-plugin to zencoding.gedit  It a simple tweak isn’t?

Well if you don’t want to tweak your self just visit my clone project for the same plugin with fixes. download and enjoy

https://github.com/ardanees-jatali/zen-coding-gedit

Just follow the instruction in README to install on your system.

NOTE:

Move zencoding.gedit and the zencoding folder into ~/.local/share/gedit/plugins/

Android Studio Tag Mismatch Issue [Fixed]

The Tag Mismatch is one of the issue that i searched for almost a week,although i find the a workaround the first day.So after a week i found a solution on the stackoverflow which help me fixing the issue. the issue is due to the fact that your ISP may using a transparent proxy server or firewall which is creating the issue. At this point i don’t know exactly why this is happening but the solution is simple change the repository url to use http protocol instead of https. by default your gradle setting use jcenter() and it uses https by default.
To Fix the issue just change this:

allprojects {
    repositories {
       jcenter()
    }
}

TO

allprojects {
    repositories {
       // jcenter()
        maven { url "http://jcenter.bintray.com" }
    }
}

View Answer on StackOverFlow

Installing Laravel 5.3 with Composer on Ubuntu

Hi Pals recently i had been stared developing on laravel and i got many issues while installing laravel. I was new to Composer and Laravel so it was enough time consuming installing and tweaking setting so i plan to write a guide, that might help you.

I Have Linux Ubuntu 16.0 LTS Install and LAMP Installed.

OS: Linux Ubuntu 16.0 LTS

Server version: Apache/2.4.18 (Ubuntu)
Server built:   2016-07-14T12:32:26

mysql  Ver 14.14 Distrib 5.7.13, for Linux (x86_64) using  EditLine wrapper

PHP 7.0.8-0ubuntu0.16.04.2 (cli) ( NTS )
Copyright (c) 1997-2016 The PHP Group
Zend Engine v3.0.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.8-0ubuntu0.16.04.2, Copyright (c) 1999-2016, by Zend Technologies

Ok So these were the package version.

Step One: Install Composer.
sudo apt-get install composer

To Find out composer version type:
composer --v
Composer version @package_branch_alias_version@ (1.0.0-beta2) 2016-03-27 16:00:34

Step two: Install Laravel Installer

virgo@virgo-pc: composer global require "laravel/installer"

if the command run successfully move to [On success] section if you got any errors similar to me i had wrote solutions read more.

Errors that occur during installation.

1-

Solution :

virgo@virgo-pc: composer clear
Clearing cache (cache-dir): /home/virgo/.cache/composer
Clearing cache (cache-files-dir): /home/virgo/.cache/composer/files
Clearing cache (cache-repo-dir): /home/virgo/.cache/composer/repo
Cache directory does not exist (cache-vcs-dir):

All caches cleared.

2-

Solution: This Happens if you are using any kind of proxy or if you are not using proxy but the variables $http_proxy and $https_proxy is set.

If you are using proxy do this

virgo@virgo-pc: set http_proxy= "http://username:[email protected]"

virgo@virgo-pc: set https_proxy= "http://username:[email protected]"

If you are not using proxy verify the variable value by.

virgo@virgo-pc: echo $http_proxy

virgo@virgo-pc: echo $https_proxy

if any of this give you any value you have to unset these variables by

virgo@virgo-pc: unset http_proxy


virgo@virgo-pc: unset https_proxy

if you are getting some other error you have to google it.

Thats it now run again

virgo@virgo-pc:
composer global require "laravel/installer"

[On success]

i hope this will now end with successful installation

Step three: Configure Laravel Installer executeable.

Open .brashrc and add the the below line at the bottom

export PATH=”/home/virgo/.config/composer/vendor/bin:$PATH”

virgo@virgo-pc: nano ~/.bashrc

export PATH=”/home/virgo/.config/composer/vendor/bin:$PATH”

CTRL+X to save

now reload bashrc run this command

virgo@virgo-pc: source ~/.bashrc

Now you had successfully configured the laravel installer executable.

Step Four: Create Laravel Project

virgo@virgo-pc: laravel new blog

this will create a laravel project for you. congratulations you had successfully installed and configured laravel installer.

Kindly comment and share you feedback. Thanks

Using external webcam as Security Camera with Linux Ubuntu

Trying new methods and hacks is usually one of developers favorite things to do. Recently i found a webcam/CAM,i already have laptops cam but the one i found is external and have about 1 yard of cord which you can connect to USB port to use cam.So i really wanted to use that as security camera/CCTV to start using it as security camera.

The First thing i have to find is to check either this CAM is supported by linux. To find out you can use couple of Linux commands

Checking dmesg

virgo@virgo-pc:~$ dmesg
: :
[ 6793.347377] usb 1-1.1: new high-speed USB device number 8 using ehci-pci
[ 6793.441332] usb 1-1.1: New USB device found, idVendor=1908, idProduct=2311
[ 6793.441353] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 6793.441355] usb 1-1.1: Product: USB2.0 PC CAMERA
[ 6793.441356] usb 1-1.1: Manufacturer: Generic
[ 6793.441358] usb 1-1.1: SerialNumber: 20100331010203
[ 6793.442016] uvcvideo: Found UVC 1.00 device USB2.0 PC CAMERA (1908:2311)
[ 6793.442838] input: USB2.0 PC CAMERA as /devices/pci0000:00/0000:00:1a.0/usb1/1-1/1-1.1/1-1.1:1.0/input/input17

to confirm the video device i tried

virgo@virgo-pc:~$ ls -l /dev/video*
crw-rw----+ 1 root video 81, 0 جولاي 25 16:08 /dev/video0
crw-rw----+ 1 root video 81, 1 جولاي 26 18:18 /dev/video1

so its showing two video device first is my laptop webcam and second is the external webcam it mean that the external device is supported.

you can also view the connected devices on usb by using command lsusb

virgo@virgo-pc:~$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 005: ID 0c45:6473 Microdia
Bus 001 Device 004: ID 0a5c:21e3 Broadcom Corp. HP Portable Valentine
Bus 001 Device 003: ID 0e8f:00fb GreenAsia Inc.
Bus 001 Device 010: ID 1908:2311 GEMBIRD
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

you can match you dmesg log and lsub output to find out the device. In my case that is 1908:2311

from dmesg
[ 6793.441332] usb 1-1.1: New USB device found, idVendor=1908, idProduct=2311
from lsubs
Bus 001 Device 010: ID 1908:2311 GEMBIRD

So if you want to test your CAM without installing any additional package you can use VLC[almost all pc have it :)] to view CAM output
Open vlc and click on the video devices from the list on left side i can now see two video devices here too. so why no you want to check it? watch the live capture by just clicking the cam.

This is my laptop cam live capture

and this is external cam live capture.

Ok now the external camera is working and i need a bash script to capture images automatically as i cannot record the live capturing feed with VLC because it will eat lot of disk space.you can record live capturing with the VLC if you are interested.

I am very new to bash so i searched few articles and found one useful and related.
http://www.netinstructions.com/automating-picture-capture-using-webcams-on-linuxubuntu/

this article list different methods to capture images automatically, it worth reading have a look at it, the approach use in this article is to use CRON job and unfortunately the minimum time you can schedule with CRONJOB is 1 minute means 60 seconds so in 60 seconds you can miss lot of events happening due to this i make few more searches on google and found that i can use the combination of infinite loop and sleep to capture images in seconds. This approach was in my mind but as i said i am very new to bash to i didn’t knew i can use loop and sleep in bash 🙂

After reading the above article and few other i write a code which works well and is according to my need.Here is the bash script that i wrote which is saved in a directory called webshots under my home directory as shot.sh
Directory Path:
/home/virgo/webshots/

#this will run for first time
if [ -d "/home/virgo/webshots/$(date +\%Y-\%m-\%d)" ]
then
mv /home/virgo/webshots/stop /home/virgo/webshots/start
fi
while [ -d "/home/virgo/webshots/start" ]
do
if [ -d "/home/virgo/webshots/$(date +\%Y-\%m-\%d)" ]
then
echo "shot.sh :: today dir already exits"
fswebcam -d /dev/video1 -r 640x480 --jpeg 99 -F 1 /home/virgo/webshots/$(date +\%Y-\%m-\%d)/$(date +\%Y-\%m-\%d-\%k:\%M:\%S).jpeg

#a bit log
echo /home/virgo/webshots/$(date +\%Y-\%m-\%d)/$(date +\%Y-\%m-\%d-\%k:\%M:\%S).jpeg saved >> /home/virgo/webshots/log.txt
else
echo "shot.sh :: today dir not exits trying to create"
#make today snapshot dir
mkdir $(date +\%Y-\%m-\%d)
fswebcam -d /dev/video1 -r 640x480 --jpeg 99 -F 1 /home/virgo/webshots/$(date +\%Y-\%m-\%d)/$(date +\%Y-\%m-\%d-\%k:\%M:\%S).jpeg

#a bit log
echo /home/virgo/webshots/$(date +\%Y-\%m-\%d)/$(date +\%Y-\%m-\%d-\%k:\%M:\%S).jpeg saved >> /home/virgo/webshots/log.txt
fi

sleep 5
done
echo 'Script Stoped' >> /home/virgo/webshots/log.txt

I am also uploading the code snap.

Basically i am using fswebcam to capture images after each 5 seconds.the good thing about fswebcam is that it automatically overlays date on image.
the script first check a directory named stop if that found it is renamed and  starts. I use this to control script ,to stop when it is running in background.

Next step i am querying  that  is their a directory named start in /home/virgo/webshots  ? the script will run as long as their is a directory named start once you renamed start directory to something else the script will stop running.I rename this directory to stop which stops the script. so there must be start directory to keep script running.

Next is to keep the images according to day,to do this i am querying a directory name for today if that exists that mean script had created the directory already and the date is not yet changed ,when the date changes it will automatically create directory for that day, so keeping the shots grouped by day.

that’s it. now i now run the bash script from terminal to start capturing. you must change the script mode to executable before you run it .

virgo@virgo-pc:~/webshots$ chmod +x shot.sh

Executing the code

virgo@virgo-pc:~/webshots$ ./shot.sh
shot.sh :: today dir already exits
--- Opening /dev/video1...
Trying source module v4l2...
/dev/video1 opened.
No input was specified, using the first.
--- Capturing frame...
Captured frame in 0.00 seconds.
--- Processing captured image...
Setting output format to JPEG, quality 99
Writing JPEG image to '/home/virgo/webshots/2016-07-25/2016-07-25-19:13:35.jpeg'.
shot.sh :: today dir already exits
--- Opening /dev/video1...
Trying source module v4l2...
/dev/video1 opened.
No input was specified, using the first.
--- Capturing frame...
Captured frame in 0.00 seconds.
--- Processing captured image...
Setting output format to JPEG, quality 99
Writing JPEG image to '/home/virgo/webshots/2016-07-25/2016-07-25-19:13:41.jpeg'.

Yes yes i know so if you want to run script in backgroud you have to run script like this

virgo@virgo-pc:~/webshots$ ./shot.sh &>/dev/null &
[1] 18684

so the output for this is the PID which is process id. you can use this id to terminate/kill script

You can confirm the script execution by the folder generated for today and the on going image capturing each 5 seconds, also the log file which change each 5 seconds.

Directory Created For today

Images Capturing in progress

Log for images

If you had followed along you have successfully converted and external cam to a CCTV Camera
the usage of script is not limited to only CCTV Camera you can also use this script to capture the shots using laptop camera when someone tries to access some folder or tries to login into your account 🙂 that may be my next micro project 😛

Note: this was a learning project for me in case i had made any mistake or you want to share your feedback with me ,fell free to comment.

Google VS Yandex, Yandex files complaint against Google

As you all know about Google and Yandex, both are search engines, and Google is responsible for the development of android Operating system .Yandex is the mostly used search engine in Europe and former soviet union countries. Few days ago Yandex launched complaint about Google pre-installed applications with Android OS which Russia orders Google to stop preinstalling its own Android apps.

In its response, Google said manufacturers and Android device owners may stray from the Google path if they want. “Device makers are free to use Android with or without Google applications and consumers have complete freedom to use rival applications,” a Google representative said.

Now Yandex Says Complained to EU Over Google’s Android which strengthen its complaint and asked EU to investigate about Google actions.

It’s a point to remember that Google had per-installed applications with almost every android phones which disturbs the competition between different application developers, the market should be make open so that every one have equal opportunity to make its share in market and Google avoid monopoly with pre-installed applications.