Android Unit 6
Android Unit 6
Audio Capture
Android has a built in microphone through which you can capture audio and
store it , or play it in your phone : There are many ways to do that but the most
common way is through MediaRecorder class :
Android provides MediaRecorder class to record audio or video : In order to
use MediaRecorder class ,you will first create an instance of MediaRecorder
class : Its syntax is given below :
MediaRecorder myAudioRecorder = new MediaRecorder();
Now you will set the source , output and encoding format and output file :
Their syntax is given below :
Camera
You will use MediaStore :ACTION_IMAGE_CAPTURE to launch an existing
camera application installed on your phone : Its syntax is given below
Intent intent = new Intent(android :provider :MediaStore
:ACTION_IMAGE_CAPTURE);
startActivityForResult(intent,0)
Bluetooth
Among many ways, Bluetooth is a way to send or receive data between two
different devices : Android platform includes support for the Bluetooth
framework that allows a device to wirelessly exchange data with other
Bluetooth devices :
Android provides BluetoothAdapter class to communicate with Bluetooth :
Media Player
Android provides many ways to control playback of audio/video files and
streams : One of this way is through a class called MediaPlayer :
Android is providing MediaPlayer class to access built-in mediaplayer services
like playing audio,video e :t :c : In order to use MediaPlayer, we have to call a
static Method create() of this class : This method returns an instance of
MediaPlayer class : Its syntax is as follows −
MediaPlayer mediaPlayer = MediaPlayer :create(this, R :raw :song);
mediaPlayer :start();
mediaPlayer :pause()
2 : Navigation:
Get Directions:
For navigation, you can use the Google Maps Directions API to get directions
between two points :
Add Dependency:
Add the Google Maps Directions API dependency in your build :gradle
file :
Get Directions:
Use the Directions API to obtain directions :
Display Directions on Map:
Plot the obtained directions on the map :
Custom Permissions:
Android allows developers to define custom permissions to control
access to specific features or data within an app : Custom
permissions enhance app security by limiting access to sensitive
functionality :
1 : Create a Developer Account:
Set up a Google Play Developer account by signing in with your Google
account : Follow the prompts to provide necessary information and pay
the one-time registration fee :
2 : Prepare Your App:
Ensure your app is ready for release : Conduct thorough testing, fix bugs,
optimize performance, and ensure all necessary features are included :
3 : Compile a Release Version:
Build a signed release version of your app using Android Studio : This
version will be the one you submit to the Google Play Store :
4 : Generate a Signing Key:
Create a keystore and generate a signing key : This key fis used to sign
your app, ensuring its authenticity : Keep the key secure and remember
its password :
5 : Configure Build Settings:
Update the build :gradle file with release-specific configuration,
including the signing configuration : Specify the keystore details and
signing information :
6 : Upload APK to Google Play Console:
Access the Google Play Console, go to "App releases," and create a new
release : Upload the signed APK file : Fill in details such as release notes,
and choose to publish immediately or stage a gradual rollout :