UNIT-1.docx-1
UNIT-1.docx-1
Definition
Mobile application development refers to the process of creating software applications that
run on mobile devices.
Development Approaches
Development Tools
3. 5G Technology
● Apps that behave like native apps but are accessed via a browser.
● Example: Twitter Lite.
6. Blockchain Technology
8. On-Demand Apps
● Apps providing services like food delivery, transportation, and home services.
● Examples: Uber, DoorDash.
9. Low-Code/No-Code Development
1. Device Fragmentation: Ensuring compatibility across devices and screen sizes.
2. Performance Optimization: Balancing performance and battery consumption.
3. Security: Protecting user data and preventing breaches.
4. User Retention: Creating engaging and user-friendly designs.
Overview of Android
4.0 Ice Cream Sandwich October 2011 Unified UI for smartphones and tablets.
4.4 KitKat October 2013 Improved performance, "OK Google" voice search.
Android Open Stack represents the layered architecture of the Android operating
system. It ensures the smooth functioning of applications and system services by
organizing components into distinct layers.
● Key Features:
o Runs apps in Dalvik Virtual Machine (for older versions) or ART (for newer
versions).
o Provides Just-In-Time (JIT) and Ahead-Of-Time (AOT) compilation for
optimized app performance.
● Core Libraries: Support for Java-based development.
1.4Native Libraries
Native libraries are platform-specific library files, including. dll, . so, or
*SRVPGM objects, that can be configured within shared libraries.
1.5Application Framework
It is a software framework used by software developers to implement the
standard structure of application software.
1.6 Applications
● Open Source: Fully customizable and modifiable under the Android Open Source
Project (AOSP).
● Modularity: Flexible design supports various devices and hardware configurations.
s<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:gravity="center"
android:padding="16dp">
<TextView
android:id="@+id/textView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello, Android!"
android:textSize="24sp"
android:layout_marginBottom="20dp"/>
<Button
android:id="@+id/button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me" />
</LinearLayout>
package com.example.myfirstapp;
import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;
1. Connect a physical Android device (enable USB Debugging) or launch an AVD.
2. Click Run (Run > Run As > Android Application).
3. The emulator/device should display "Hello, Android!".
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
// Background task code
return START_STICKY;
}
}
Broadcast Receivers (Listening for Events)
● A Broadcast Receiver listens for system-wide events like battery low, network changes, or
incoming calls.
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Toast.makeText(context, "Broadcast Received!", Toast.LENGTH_SHORT).show();
}
}
Content Providers (Data Management)
├── app/
│ ├── src/
│ │ ├── main/
├── settings.gradle
<application
android:allowBackup="true"
android:label="My App">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
</manifest>
Java/Kotlin Files (App Logic)
dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0'
Method Descriptiontion
onResume called when activity will start interacting with the user.
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</android.support.constraint.ConstraintLayout>
package example.javatpoint.com.activitylifecycle;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Activity class
File: MainActivity.java
Prepared by M. AZHAGESAN AP/CSE-KSRCE
1. package example.javatpoint.com.implicitintent;
2.
3. import android.content.Intent;
4. import android.net.Uri;
5. import android.support.v7.app.AppCompatActivity;
6. import android.os.Bundle;
7. import android.view.View;
8. import android.widget.Button;
9. import android.widget.EditText;
10.
11.public class MainActivity extends AppCompatActivity {
12.
13. Button button;
14. EditText editText;
15.
16. @Override
17. protected void onCreate(Bundle savedInstanceState) {
18. super.onCreate(savedInstanceState);
19. setContentView(R.layout.activity_main);
20.
21. button = findViewById(R.id.button);
22. editText = findViewById(R.id.editText);
23.
24. button.setOnClickListener(new View.OnClickListener() {
25. @Override
26. public void onClick(View view) {
27. String url=editText.getText().toString();
28. Intent intent=new Intent(Intent.ACTION_VIEW, Uri.parse(url));
29. startActivity(intent);
30. }
31. });
32. }
33.}
OUTPUT
Types of Services
● Foreground Service: Runs in the foreground and requires user attention. For
example, a music player.
● Background Service: Runs in the background and performs tasks that the user may
not directly interact with. For example, syncing data.
● Bound Service: Allows components (like activities) to bind and interact with the
service.
Services in Android are a special component that facilitates an application to run in the
background in order to perform long-running operation tasks. The prime aim of a service is to
ensure that the application remains active in the background so that the user can operate
multiple applications at the same time
Content Provider is a mechanism that enables applications to share data with each other by
providing a standardized way to access and manipulate data stored in a central repository,
often using a database like SQLite.
Implementation