/Android-With-JAVA

Doing some Android Development before adding in real life project

Primary LanguageJavaApache License 2.0Apache-2.0

Android-With-JAVA

What is Android?
who_i_am
Android is an open source and Linux-based Operating System for mobile devices such as smartphones and tablet computers. Android was developed by the Open Handset Alliance, led by Google, and other companies......

Why Android?
why_android

Retrofit
Retrofit is a type-safe REST client for Android, Java and Kotlin developed by Square. The library provides a powerful framework for authenticating and interacting with APIs and sending network requests with OkHttp. See this guide to understand how OkHttp works.

Broadcast Receiver
A broadcast receiver (receiver) is an Android component which allows you to register for system or application events. All registered receivers for an event are notified by the Android runtime once this event happens.
The following example demonstrates the registration for the BOOT_COMPLETED event in the Android manifest file.

            <action android:name="android.intent.action.BOOT_COMPLETED"/>
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE"/>

ProGruad to prevent Reverse Engineering

buildTypes {
    debug {
        shrinkResources true
        minifyEnabled true
        useProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }

    release {
        shrinkResources true
        minifyEnabled true
        useProguard true
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
    }
}

Can multiple android application access same firebase database?

  1. Yes, it is possible. Go to your firebase console. Select home tab. Click on Add App. Select Add firebase to your Android App. Provide the necessary details for the package name. Download the latest config file and add it to all the android apps connected to this firebase project.

  2. With Android Studio 2.2 and upwards you can easily create and add apps to you Firebase project without leaving your work environment and no need to download google-services.json

From Android Studio go to Tools->Firebase and create, add apps to project of choice :)
kbqcc

Build unsigned APK file with Android Studio
I would recommend you to build your apk file with gradle:

  1. Click the dropdown menu in the toolbar at the top
  2. Select "Edit Configurations"
  3. Click the "+"
  4. Select "Gradle"
  5. Choose your module as Gradle project
  6. In Tasks: enter assemble
  7. Press Run
    Your unsigned apk is now located in
    ProjectName\app\build\outputs\apk

WebView is not loading page in Android 9.0?

  1. Add @xml/network_security_config into your resources:
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
    <domain-config cleartextTrafficPermitted="true">
        <domain includeSubdomains="true">www.google.com</domain>
    </domain-config>
</network-security-config>
  1. Add this security config to your Manifest like this:
<application
    ...
    android:networkSecurityConfig="@xml/network_security_config"
    ...>

    ...
</application>
  1. Now you allowed using HTTP connection on www.google.com subdomains.

How can I open a URL in Android's web browser from my application?

Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(browserIntent);

As for the missing "http://" I'd just do something like this:

if (!url.startsWith("http://") && !url.startsWith("https://"))
   url = "http://" + url;

Android webview displaying blank page :

wbView.getSettings().setDomStorageEnabled(true);

Picasso Image:

Picasso.with(context).load(product.getImage()).into(holder.imageView);