Hi Guys, Welcome to Proto Coders Point, In this tutorial, we will learn about what is SHA1 key and SHA256 fingerprint and how to generate SHA-1 fingerprint certificate for your firebase android project.
What is the SHA1 key?
SHA1 key Stands for (Secure Hash Algorithm 1) is a cryptographic hash function that takes an input and generates a 160-bit (i.e 20-byte) hash value known as a message digest – This message digest is rendered as a hexadecimal number, which is if 40 digits long.
Hi Guys, Welcome to Proto Coders Point, In this tutorial, we will create our own API server using DENO JS scripting language and we will also create a flutter app that will fetch image data from our Deno API server script and display the Images in flutter deno application by making use of Flutter Builder and ListView Builder.
Brief Introduction on what is DENO ?
Deno is new Implementation of Node.js, We can call it as alternative of Node.js, The Creator of Deno and Node.js is the same “Ryan Dahl“, He it the original Creator of Node.js.
A Deno is a runtime JavaScript and TypeScript that is built on Version 8 of JavaScript engine and Deno is writter in Rust Programming language.
Creating API server using Deno Script | Deno js tutorial
Video Tutorial to create deno API
Step 1: Editor VSCode or Atom
I prefer to make use of vscode editor or Atom editor to write back-end scripts.
In my case i am using vscode editor.
Step 2: Create New project / New Folder
File > Open Folder (new folder) > “deno http server”
Then, Select Folder.
Step 3: Creating .ts files under deno http server folder
In vscode go to Files > New File here create 2 files and name it as index.ts and ImageData.ts
Step 4: index.ts deno script code and ImageData.ts
Then, In index.ts file copy paste the below lines of deno code
index.ts
// we need denotrain module to create routes and application
import { Application, Router } from "https://deno.land/x/denotrain@v0.5.0/mod.ts";
import { imagedata } from "./imagesdata.ts";
const app = new Application({hostname:"192.168.0.7"}); // replace with you localhost IP Address
const routes = new Router();
// lets create router to the api server
app.use("/api",routes);
routes.get("/imagedata",(ctx)=>{
return {
// lets pass imagesdata interface here
"imagedata":imagedata
}
});
app.get("/",(ctx)=>{
return "Hello World";
}); //this is the root of the server
await app.run(); // then finally run the app press ctrl + ` to open terminal
As we are we are making network call we need to use flutter http library to fetch data from our deno api server.
open pubspec.yaml file and add the flutter http library under dependencies section.
http: ^0.12.1 #kindly check official site for latest version
Step 3: Method to Fetch Image Data from Server
//function to fetch image data from deno script server
fetchImageData() async{
final url = "http://192.168.0.7:3000/api/imagedata"; // replace with your IP url
var res = await http.get(url);
return jsonDecode(res.body)["imagedata"];
}
The above method is making use of http call to get data from deno script and return data in json decoded format.
Step 4 : Display image Data using Future builder and Listview widget
This is just a snipcode, Complete flutter code is given at the end.
FutureBuilder : Making use of FutureBuilder because loading/fetching data from server may take some time. Here snapshot will hold all the data received from server.
Until data from server is completely loaded we will display CircularProgressIndicator() and once data is received we will show the data using ListView.builder that has Image widget to load url.
Complete Flutter Source Code | Flutter Deno Example
Copy paste below lines of Flutter Deno Example Source in main.dart file.
main.dart
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.symmetric(vertical: 20.0),
height: 200.0,
child: FutureBuilder(
future: fetchImageData(),
builder: (context,snapshot){
if(snapshot.connectionState == ConnectionState.done)
{
if(snapshot.hasData)
{
return ListView.builder(itemBuilder: (context,index){
return ClipRRect(
borderRadius: BorderRadius.circular(8.0),
child: Image.network(snapshot.data[index]["url"],fit: BoxFit.cover,),
);
},itemCount: snapshot.data.length,);
}
}else if (snapshot.connectionState ==ConnectionState.none)
{
return Text("Something went Wrong");
}
return CircularProgressIndicator();
},
),
);
}
}
//function to fetch image data from deno script server
fetchImageData() async{
final url = "http://192.168.0.7:3000/api/imagedata";
var res = await http.get(url);
return jsonDecode(res.body)["imagedata"];
}
Done now your Flutter applications is ready to fetch data from your own deno API script.
install deno js deno script http server hello world
Hi Guys, Welcome to Proto Coders Point, In this tutorial, we will install Deno JS in Windows OS & learn some basics of denojs scripting language.
What is Deno? Who is the creator of Deno?
Deno is the new Implementation of Node.js, We can call it an alternative of Node.js, The Creator of Deno and Node.js is the same “Ryan Dahl“, He is the original Creator of Node.js. A Deno is a runtime JavaScript and TypeScript that is built on Version 8 of the JavaScript engine and Deno is written in Rust Programming language. Deno explicitly takes on the role of both runtime and package manager within a single executable, rather than requiring a separate package-management program. Ryan Dahl during his talk says “10 Things I Regret About Node.js” ( You can Watch His talk in below video )
and is intended to fix design problems in Node.js, Ok so straight Start Installing Deno on Windows OS.
How to Install Deno on Windows?
Note: This steps are only for windows user.
Video Tutorial Watch :
Step 1: Scoop/Chocolatey must be Installed
You required any of this Scoop or Chocolatey that will help you in Installing Deno on windows,
a) How to install Scoop on windows
Run Command Prompt as Admin: just copy paste below lines of commands & hit enter.
After you have installed scoop or chocolately, now you can use then to install deno
Then in Command Prompt just enter any of the below command.
scoop install deno
OR
choco install deno
Step 4 : Test Deno
Then,Once you install deno, you to check if deno is installed successfully just in command prompt type : deno, This will run deno.
In above Screenshoot, i have used deno to perform basic arithmetic operations.
Deno script to perform basic HTTP server
Use any Code Editor, In my Case, I am making use of VSCode to write my Deno Script. This Script is will basically print “Hello World” text on the Browser screen.
In VSCode editor Create a new Folder and name it as “Deno_http_server”.
Under this folder you need to create a new index.ts file
creating file in vscode for deno scripting
Copy the Below Deno Script HTTP server ” deno Hello World” in index.ts
import { serve } from "https://deno.land/std@0.50.0/http/server.ts";
const s = serve({ port: 8000 });
console.log("http://localhost:8000/");
for await (const req of s) {
req.respond({ body: "Hello World\n" });
}
Ok then, to run this index.tx file.
Open Terminal in VsCode itself by pressing ctrl + Then run below command,
Hi Guys, Welcome to Proto Coders Point, In this Flutter Tutorial we will build a Flutter application by making use of Flutter Video Player Widget Plugin to display/play videos in our Flutter App with example.
Introduction to video player flutter widget
Flutter Video Player is a plugin developed by the flutter team for Android, iOS, and Web development so that developers can easily make use of this video pkg widget library in integrating playing videos in their apps.
Important Note: As mentioned in official site that, This plugin is still under development, some latest API version of this video player library may give some kind of bugs.
let’s Start with installation of this widget in our flutter project
Flutter Video Player Widget Tutorial
Video Tutorial
Step 1: Create a new Project
offCourse you need to create a new Flutter Project or Open any existing project, all depends to you.
In my case, I m making use of Android Studio to Develop Flutter application.
Files > New > New Flutter Project
Step 2: Installation of Video Player Plugin
Adding dependencies
Open pubspec.yaml file and add the below video_player flutter dependencies version
dependencies:
video_player: ^2.1.1 // version might change so check the official site
Import the video_player.dart
Once you have added the video player plugin, now you will be able to use video pkg by importing the library file where required.
import 'package:video_player/video_player.dart';
In my case i have imported video_player.dart file in main.dart file
Step 3: Adding Internet permission in android and iOS
Android
Please make sure to add the following Internet permission in your Android project manifest file.
Naviget to : <project root>/android/app/src/main/AndroidManifest.xml:
This Step is optional, do this only if you are facing any problem in loading the video.
Create a directory names ” xml ” under the following path:
<project root>/android/app/src/main/res
In this xml folder you need to create a new xml resource file
xml(dir) > (Right click) New > xml Resource file > and name the file as networkconfig.xml
Then, add the following Network Config code:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">commondatastorage.googleapis.com</domain> //here replace with you localhost server or your domain name
</domain-config>
</network-security-config>
Here is example of the directory structure:
Step 5 : The Complete Code for Flutter Video Player
main.dart
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
VideoPlayerController controller; // used to controller videos
Future<void> futureController; // network takes time to load video, so to control future video data
@override
void initState() {
//url to load network
controller = VideoPlayerController.network("http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4");
futureController = controller.initialize();
controller.setLooping(true); // this will keep video looping active, means video will keep on playing
controller.setVolume(25.0); // default volume to initially play the video
super.initState();
}
@override
void dispose() {
controller.dispose(); // when app is been closed destroyed the controller
super.dispose();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Flutter Video Player Example"),
),
body: Column(
children: <Widget>[
Center(
child: FutureBuilder(
future: futureController,
builder: (context,snapshot){
// if video to ready to play, else show a progress bar to the user
if(snapshot.connectionState == ConnectionState.done)
{
return AspectRatio(
aspectRatio: controller.value.aspectRatio,
child: VideoPlayer(controller)
);
}else{
return Center(child: CircularProgressIndicator(),);
}
},
),
),
//button to play/pause the video
RaisedButton(
color: Colors.transparent,
child: Icon(
controller.value.isPlaying? Icons.pause : Icons.play_arrow
),
onPressed: (){
setState(() {
if(controller.value.isPlaying)
{
controller.pause();
}
else
{
controller.play();
}
});
},
)
],
)
);
}
}
Hi Guys, Welcome to Proto Coders Point, In this android tutorial we will build an application that can recognize text in image with Firebase ML Kit.
Introduction to Firebase Machine Learning(ML) Kit
Firebase ML Kit is an mobile SDK that helps you in building an android or iOS apps that can help developer to add Machine Learning feature into there mobile application, This ML Kit is very powerfull and very easy to use.
Whether you’re new to Machine Learning or you have experienced in ML, you can easily implement the ML functionality that you need that too in just few lines of firebase ML Codes.
So as the title says that we gonna build an simple application that can read text from a image and display it to use.
RESULT OF FINAL OUTPUT OF APPLICATION
Firebase ML Kit text Recognition
Let’s start this Firebase ML Kit Android Project to read text from image, Just follow the below Steps
Step 1: Create a new android project in android studio
ofcourse you need to create a new android project or you may just open any existing android project
File > New > New Project ( here select Empty Activity )
Hit Next Button
Then Give a Good name to your android project, In my case i have named it as “TextRecognitionMLFirebase” you may name it as per your choice
Then, Hit the Finish Button, your android project will get built in few minutes.
Step 2 : Connect your android app to firebase console
First you need to be signedIn with Google Account in your android Studio.
Then, Go to Tools > Firebase a Android Assistant will open a side window from where you can connect your app to firebase console. Here select Analytics
In place of Connected in above image you may see Connect to Firebase Button, Click on it and it will open a default Browser so that you can connect android application to firebase console, Then In browser you need to follow some steps
1: Add project
Now, on your browser with Firebase website opened click on Add Project
This page will get Loaded
Project Name will automatically get here you just need to hit Continue button
2: Config Google Analysis
Here you need to accept all the terms and conditions of firebase console & then Hit Create Project.
Therefore your android studio project is successfully connected to Firebase Console
Now, Come back to Android Studio IDE.
Step 3 : Add Firebase Dependencies
Add Firebase ml vision and firebase core dependencies into yor android studio project.
Open built.gradle(Module:app) then in dependencies section just add below Implementation code
Hi Guys, Welcome to Proto Coders Point, In this Android Tutorial we will implement Scratch Card in android studio, an android app same like Google Pay(Tez app) reward scratch card in our android application.
I found the Source code in GitHub developed by Shubham Mahalkar, Credit to him
Result of the Final built app
Scratch Card like google pay reward card in android studio
Step 1 : Create a new android project in android studio
offcourse you need to create a new android project or open any of your existing android project where you want to add Scratch card reward.
Give a name to your android project as “Scratch Card Google Pay” or anything as per you choice.
Step 2 : create a attrs xml file in values folder
go to res->values-> and create new file name it as attrs.xml
This class is used to create Graphical objects in xml layout. Even this class will keep track of any event happens such as user scratch the card to check his reward points.
We will implement this class in xml file to display a square box which we will be able to check the google pay reward point after the card is been scratched.
Utils.java this class will help you randomly generate as number from 1 – 100 and we will be able to display in a form of rewards point some like google Play app.
Utils.java
import android.content.Context;
import java.util.Random;
public class Utils {
static Random random = new Random();
public static float dipToPx(Context context, float dipValue) {
float density = context.getResources().getDisplayMetrics().density;
return dipValue * density;
}
//Generate random number(Prize)
private static String generateCodePart(int min, int max) {
int minNumber = 1;
int maxNumber = 100;
return String.valueOf((random.nextInt((maxNumber - minNumber) + 1) + minNumber));
}
public static String generateNewCode() {
String firstCodePart = generateCodePart(1000, 9999);
return "You Won\nRs." + firstCodePart;
}
}
Step 5: Now Open activity_main.xml file and add the below lines of code