Showing posts with label android. Show all posts
Showing posts with label android. Show all posts

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 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;

    }


}


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;

    }

}

 

Saturday, February 25, 2017

How To Setup Android Eclipse And Extract The File SDK & Eclips And Download

A Download The Android Eclipse And Sdk The Folllow Link...




 
             









And How Setup In Pc-Laptop Download It Pdf Now.....



Saturday, November 26, 2016

How To Root Any Android Mobile


 A Root Is Super User Permission To Access All The  System File And System Application.
     


       *  A Following Setp TO use  Root Any Android Device

         Step:1
                           
                   
                       A Download King Root Apps.
                                             (Play Store or Any Other)
        Step:2
                               
                                Install The Application And On The Internet Connection
   
                 To Open The Apps  And Starting Root Process
      Step:3
                                   
                 After ComPlate Root Your Android Mobile..

Note :
IT IS RISK WORK  FOR MOBILE DIRECT AND INDIRECT