Friday, December 25, 2020

add dependacy

 


    implementation 'com.google.code.gson:gson:2.8.5'

    implementation 'com.squareup.retrofit2:retrofit:2.5.0'

    implementation 'com.google.android.gms:play-services-ads:18.3.0'

    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'

    implementation 'com.squareup.retrofit2:converter-scalars:2.5.0'

    implementation 'com.squareup.okhttp3:logging-interceptor:3.8.0'

    implementation 'com.squareup.okhttp3:okhttp:3.12.0'

    implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.19'


    implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'

add RestError.java

 package network;


import com.google.gson.annotations.Expose;

import com.google.gson.annotations.SerializedName;


public class RestError

{

    private boolean error;


    @SerializedName("status")

    @Expose

    private Integer status;

    @SerializedName("message")

    @Expose

    private String message;


    public RestError(String message) {

        this.message = message;

    }


    public boolean isError() {

        return error;

    }


    public void setError(boolean error) {

        this.error = error;

    }


    public String getMessage() {

        return message;

    }


    public void setMessage(String message) {

        this.message = message;

    }


}


add interface ApiInterface

 package network;


import retrofit2.Call;

import retrofit2.http.Body;

import retrofit2.http.Headers;

import retrofit2.http.POST;

import retrofit2.http.Query;


public interface ApiInterface

{

    String GET_CAT="readc.php";


   @Headers({"Content-Type: application/json","Accept: application/json"})

    @POST(GET_CAT)

    Call<contact> getdata();



}


Add StringConverter.java

 package network;



import androidx.annotation.NonNull;


import java.io.IOException;

import java.lang.annotation.Annotation;

import java.lang.reflect.Type;


import okhttp3.MediaType;

import okhttp3.RequestBody;

import okhttp3.ResponseBody;

import retrofit2.Converter;

import retrofit2.Retrofit;


class StringConverter extends Converter.Factory

{

    private static final MediaType MEDIA_TYPE = MediaType.parse("text/plain");

    @Override

    public Converter<ResponseBody, ?> responseBodyConverter(Type type, Annotation[] annotations, Retrofit retrofit) {

        if (String.class.equals(type)) {

            return new Converter<ResponseBody, String>() {

                @Override

                public String convert(@NonNull ResponseBody value) throws IOException {

                    return value.string();

                }

            };

        }

        return null;

    }


    @Override

    public Converter<?, RequestBody> requestBodyConverter(Type type, Annotation[] parameterAnnotations,

                                                          Annotation[] methodAnnotations, Retrofit retrofit) {


        if (String.class.equals(type)) {

            return new Converter<String, RequestBody>() {

                @Override

                public RequestBody convert(@NonNull String value) throws IOException {

                    return RequestBody.create(MEDIA_TYPE, value);

                }

            };

        }

        return null;

    }


}


Add TLSSocketFactory.java

 package network;


import java.io.IOException;

import java.net.InetAddress;

import java.net.Socket;

import java.security.KeyManagementException;

import java.security.NoSuchAlgorithmException;


import javax.net.ssl.SSLContext;

import javax.net.ssl.SSLSocket;

import javax.net.ssl.SSLSocketFactory;


class TLSSocketFactory extends SSLSocketFactory

{

    private SSLSocketFactory delegate;


    public TLSSocketFactory() throws KeyManagementException, NoSuchAlgorithmException {

        SSLContext context = SSLContext.getInstance("TLS");

        context.init(null, null, null);

        delegate = context.getSocketFactory();

    }


    @Override

    public String[] getDefaultCipherSuites() {

        return delegate.getDefaultCipherSuites();

    }


    @Override

    public String[] getSupportedCipherSuites() {

        return delegate.getSupportedCipherSuites();

    }


    @Override

    public Socket createSocket() throws IOException {

        return enableTLSOnSocket(delegate.createSocket());

    }


    @Override

    public Socket createSocket(Socket s, String host, int port, boolean autoClose) throws IOException {

        return enableTLSOnSocket(delegate.createSocket(s, host, port, autoClose));

    }


    @Override

    public Socket createSocket(String host, int port) throws IOException {

        return enableTLSOnSocket(delegate.createSocket(host, port));

    }


    @Override

    public Socket createSocket(String host, int port, InetAddress localHost, int localPort) throws IOException {

        return enableTLSOnSocket(delegate.createSocket(host, port, localHost, localPort));

    }


    @Override

    public Socket createSocket(InetAddress host, int port) throws IOException {

        return enableTLSOnSocket(delegate.createSocket(host, port));

    }


    @Override

    public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException {

        return enableTLSOnSocket(delegate.createSocket(address, port, localAddress, localPort));

    }


    private Socket enableTLSOnSocket(Socket socket) {

        if (socket != null && (socket instanceof SSLSocket)) {

            ((SSLSocket) socket).setEnabledProtocols(new String[]{"TLSv1.1", "TLSv1.2"});

        }

        return socket;

    }


}


get data from Api Using Retrofit2 ApiClient.java

package network;


import java.security.KeyManagementException;

import java.security.NoSuchAlgorithmException;

import java.util.concurrent.TimeUnit;


import okhttp3.OkHttpClient;

import okhttp3.logging.HttpLoggingInterceptor;

import retrofit2.Retrofit;

import retrofit2.converter.gson.GsonConverterFactory;

import retrofit2.converter.scalars.ScalarsConverterFactory;



public class ApiClient

{

    private static final String BASE_URL="http://www.gkmaza.com/apps/gujarati_suvichar/";

    private static Retrofit retrofit=null;

    private static OkHttpClient client;

    public static Retrofit getClient()

    {

        if(retrofit==null)

        {

            HttpLoggingInterceptor interceptor=new HttpLoggingInterceptor();

            interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);

            try

            {

                client = new OkHttpClient.Builder()

                        .followRedirects(true)

                        .followSslRedirects(true)

                        .sslSocketFactory(new TLSSocketFactory())

                        .retryOnConnectionFailure(true)

                        .addInterceptor(interceptor)

                        .connectTimeout(30, TimeUnit.MINUTES)

                        .readTimeout(30, TimeUnit.MINUTES)

                        .addInterceptor(interceptor)

                        .build();


            }catch (KeyManagementException e)

            {

                e.printStackTrace();

            }catch (NoSuchAlgorithmException e)

            {

                e.printStackTrace();

            }

            retrofit=new Retrofit.Builder()

                    .baseUrl(BASE_URL)

                    .client(client)

                    .addConverterFactory(new StringConverter())

                    .addConverterFactory(ScalarsConverterFactory.create())

                    .addConverterFactory(GsonConverterFactory.create())

                    .build();


        }


        return retrofit;

    }

}

 

Thursday, November 19, 2020

PREMIUM Quotes App With Android Studio And Admob Ads

 


Quotes App Is An Android Application.Quotes App Has User-Friendly Interface With Easy To Manage. The Quote App Or Sayari App Are Stored In Firebase For Easy Editing And Better Performance.

Best Quotes App Is An Android Application. Quotes App Has User-Friendly Interface With Easy To Manage. The Quotes App Are Stored In Firebase For Easy Editing And Better Performance. Sayari App In Android Studio With Admob Ads And Firebase Realtime Database.



Premium Quotes APP

Only Rs. 499/-

Features


Android Side

  • Quotes With Category Wise
  • Latest Quotes
  • Copy or Share Quote with your friends and on Social Networks
  • Share Image with Quotes
  • Add to Favorite Mode
  • Latest UI with Material Design
  • Admob with Banner and Interstitial ads Integrated
  • App comply with GDPR
  • You can also change frequency on interstitial ad to show after number of click
  • Firebase Analytics
  • Easy Admin Panel – Firebase Backend
  • All Device Combability
  • Check Network Availability
  • MultiLanguage Supported (if your phone supports particular language)
  • Android Code Migrated to AndroidX
  • Android Studio Code (Recommended Android Studio Version – 3.3)


Admin Side

  1. Simple Admin Panel
  2. Easily Add Category
  3. Easily Add Quotes
  4. Quote of the day
  5. Edit and Delete Quotes, Author and Category
  6. Upload Unlimited Category and Quote
  7. Firebase Backend

What You Get:


  1. Full Android Source Code
  2. Full PHP Code of Server Side
  3. Document with Screen Shot
  • App Features
  • Amazing Swiping Cards View
  • Share As Screenshots With Branding
  • Swipe Right Save To Read Offline
  • Supports Video Embeds
  • Supports HTML tags & Links
  • Latest Admob Integrated
  • App Tour With How To Use App
  • Multi language Support
  • Post By Language And Categories
  • OneSignal Push Notifications
  • Easy To Make App In Minutes