Wednesday, January 8, 2020

Android Unit 4 : Location Based Services for B.C.A.,B.Sc.IT and other IT Students


--------------------------------------------------------------------------------------------------------------------------
Prepared By : Uday Shah (HOD - IT)
E-Mail : rupareleducation@gmail.com
Contact No : 9427439007

:: Location Based Services ::

Question:        What is GPS?

  • GPS stands for global positioning system.
  • It is a space based satellite navigation system that provide location and time information in all weather condition.
  • GPS system is developed by united state government defence system.
  • The main purpose of GPS is originally used in military application, but in 1980 it was allowed used for the civilian application purpose.
  • It maintain entire earth navigation and it is always work on 24 hours a day with twice around to earth.
  • Now a day’s GPS system work in civil, military as well as commercial application also.
  • The android provide SDK resource to access location using build in GPS hardware.
  • In US mobile Phone location system information is used by emergency services only.
  • They not allow all the android device to use location based services.
  • To use an android device it is require to add appropriate permission for specific features in your device.


Question:        What is GEO coding location?

  • GEO coding is a process of access location to the address that can be place as point on a map.
  • GEO coding is similar to put pins on a paper map.
  • Most typically is also known as GEO graphic co-ordinate or GEO graphic information system.
  • A simple method of GEO coding is address interpolation.
  • These methods make a use of data from a street GEO graphic information system where street network is already mapped.
  • Android provide a platform API features that return estimated street address using GEO coder get form location () method. This is returning a list of addresses.

Question 3: Explain mapping location.
  • Ans. Mapping location provides easy navigation system and also avoids large scale distribution and unnecessary server load.
  • Mapping image file is directly accessible by the user without any server load.
  • Android provide API for location in the android location packages.
  • The Google Location Service API is a part of Google play service.
  • Android gives user’s application to access the location services supported by the device through the classes in android location packages.
  • The central frame work or the component of the location is location manager system service, which provides API to determine location and behavior of the basic device.
  • Once your application has location manager your application is able to do following things that is query for list all the location, update the current location, register the current location.

Question 4: Many more with location based services
  • Android System gives the opportunity to determine the current geographical location and to build location-aware applications, without focusing on the details of the underlying location technology.
  • To obtain the user location, we can use one of:
  • GPS Provider
  • Android’s Network Location Provider availability of cell tower and WiFi access points or both of them.
  • Every provider has its cons and pros and can be used depending on the circumstances at each situation.
  • For example GPS, is exact and more appropriate for outdoors, but it consumes a lot of battery power.
  • On the other hand, network provider works for indoors as well for outdoors and has lower battery consumption and a faster response.
  • This becomes possible with the help of Google Play services, which facilitates adding location awareness to your app with automated location tracking, geofencing, and activity recognition.

Question 5: What is API?
  • Answer: in a computer programming a interface is a set of run time protocols and tools for building software application and API provides software component in terms of its operation inputs, outputs and different types of function which allow a good programming to the developer.
  • API provides a facility to interact with new features into existing application.
  • API often comes in the form of library that includes specification for routines data structure, object and classes.
  • Most of the procedure language is specify a set of function or routines.
  • API is usually related to software library the API describe and prescribe the expected behavior at the time of actual implement of the program.
  • API can also help to implement a protocol that can be based on some proxy method.

Question 6: Android networking API.
  • Answer:  android content the standard java network packages which can be use to access network resources.
  • To use any web in android it requires HTTP.
  • The base class for http network access used with the help of java.net packages using HTTP_URL_connection class.
  • Android also content apache http client library but it is not recommended to use it.
  • Most of the network connected API use HTTP to send and receive data.
  • Android include to HTTP clients that is
          1.      HTTP URL connection
          2.      Apache http client
  • That is support streaming upload and downloads.
  • Before any application attempt to connect to the network it is good practice to check weather a network connection is available or not.
  • With the help of get Apache network info () method and isconnected () method which return a Boolean value.
  • Android manifest file provide user permission to access network related application like WIFI or mobile data access.
  • Network application can in walk unpredictable delay to parent this form causing the poor network connection.
  • Always perform network operation on separate thread.
  • User can also manage network usage if your application consume a lot of network resources in their operation then you should provide user settings that allow user to control your application.
  • A device can have various types of network connections like WIFI and data connectivity.
  • Before perform any network operation it is a good practice to check the state of network connectivity using the connectivity manager class.

Question 7: Explain android web API
  • Answer:  web API is a part of client application and it is a possible using web view.
  • Web view class is an extension of android view class that allow user to display web pages as a part of your activity.
  • There are generally two way to deliver and application on android.
  • As a client side application or as a web application.
  • Following is diagram denote that web API structure in android.



  
  • According to above diagram we can clearly so that web content provide a structure in a web browser or in a android web API however you should not develop android app simply as your website.
  • Web pages are embedded in android app should be design specially in their environment.
  • To design any client application must use web view.
  • Android web app helps your application to provide data anywhere, anytime, according to their requirement such as email notification.

Question 8: Android Telephonic API?
  • Answer:  In software developer for the mobile platform is interested in incorporating telephonic features.
  • User can interact application and need to notify the user to start access internet in a roaming area.
  • Telephonic manager provide access information about the telephonic service on the device.
  • Application can use this method to determine telephonic service and state as well as to access some type of subscribe application information.
  • Telephonic API provides instance class directly intended to receive a reference through get application context.
  • To work with telephonic manager user require permission to read phone details and we need to add this permission statement in android manifest file.
  • Using a telephonic manager we can retrieve current states of mobile phone and also get some basic information of about the device.
  • Telephonic API provides a different service like voice call, video call, call transfer etc related to telephonic API.
  • It also provides different types of network like CDMA, GSM etc.
  • Using the telephonic manager class we can set detail like SIM, serial number, country code, network provider code and other detail.

Question: What is Notification?
  • Answer. Notification is a message you can display to the user outside of your application normal user interface.
  • When you tell the system to issue a notification it first appears as an I-con in the notification area.
  • To see the details about the notification user open a notification window in the system and display information which is defines under notification i-con.
  • Notification is an important android OS they and over view of alert from the application.
  • It will display until the user not complete its associated action.
  • When user needs to update any application at the time system automatically provide a specific notification about the event.
  • If the user us not present alive then after they don’t miss the important news E-mail or messages.
  • Developer can notify user using different technique like vibrating the phone, ringing the phone, blinking LED etc.
  • The standard location for the display notification indicator on and android device is status bar along with the top of the screen.
  • Typically the status bar show information like current date and time and also display notification like SMS, MMS etc.
  • Developer can enhance their application by using notification from their application to inform the user of important event.
  • Following is some important component for a simple notification.
         1.      An I-Con
         2.      Ticker text
         3.      Notification title text
         4.      Notification body text and intent etc
  • Notification builder support an activity to display a message on the screen.
  • It is based on notification_compact.builder class.  
  • It provide supporting library that should be used to display notification on the screen.

Question: Define the notification Action
  • Answer. Action is optional but there is at least one action for your notification.
  • An action takes user directly from the notification activity in your application.
  • Developer must be implemented an action that cause the notification or to do further work.
  • Inside a notification the action itself is define by pending intent.
  • The pending intent depend on what type of activity that you are started.
  • Using intent we can customize a notification in an application.
  • There are some issue occurs when a notification is arrive.
  • Get and instance of notification manager.
  • Use the notify method to issue the notification.
  • Called build () method which return notification object.
  • After receiving the notification event or pending intent give you a fresh task depend the nature of activity.
  • There are two general situations to start your activity that is

1.       regular activity
2.       special activity

·         Updating a Notification

  • When you need to issue a notification multiple times for the same type of an event then you should avoid a making completely new notification.
  • Instead you create a new notification you should consider about update previous notification either by changing its value or to add new value in it.
  • Whenever user tries to update a notification they face some issues with a notification ID by the notification manager.
  • To update the notification you must update or create notification compact builder object to build a new notification is a same ID.
Question: Explain Vibrating the Phone.

  • Answer: Making android phone vibrate is good pattern to provide feedback to the user or to interact with the user with some notification.
  • This can ensure that it provide better user experience and there for increase integrity of your android application.
  • With the vibrating the phone interface you can vibrate in one of the following ways.
           Vibrate for the given length of time
           Vibrate for the given pattern
           Vibrate repeated until the cancel application.
  • Before adding a necessary code in your application must first notify that your android device provide a permission to use the vibrate.
  • If you do not this then it will generate for close error message.

Question: Blinking the light is also another great way to pass information silently.

  • Answer. android SDK provide LED flash light alert accessibility.
  • It also provide multi color indicator light when such light available on the device.
  • User might recognize this blinking the light service indicator or battery level warning.
  • Application can take the advantage of blinking the light by changing blinking rate or color the light.
  • Generally indicator lights are not available on all android devices.
·         Customize Notification

  • The notification framework allow user to define custom notification layout.
  • To ensure your notification looks its best across different versions of Android, you should always use the standard notification template to build your notification. However, if the system templates do not meet your needs, you can provide your own layout for the notification.
  • If you want to provide more content in your notification, also consider using one of the expandable notification templates instead of building a custom layout.
  • That is defining notification appearance, notification behavior and the purpose to fire a notification in their application.
  • Developer can customize that how the notification are display on the screen.
  • Remote view object is responsible to define customize notification layout.
  • Developer can use remote view object to customize the loop and the fill a notification.      


Question: Introduction about Service?
  • Answer:  A service is a component that runs in the back ground to perform long running operation without need to interact with the user.
  • E.g. a service might play music on the background while the user uses a different application or might fetch data from the network without blocking user interaction with an activity.
  • A service can categorized in two forms That is             
          1. Started service
          2. Bound service
  • Service are use for repetitive and potentially long running operation like internet downloads checking a new data etc. Service run with higher priority than inactive or invisible activities. Which are less likely that the android system terminate?


Question:  Explain started service.
  • Answer:  A service is started when an application component is start by calling start activity method. Usually started services perform a single operation and do not return result in the caller.
  • For Ex. download or upload file or network.
Question: Explain Bound Service.
  • Answer: A service is bound when an application component bind to it by calling bind service method.
  • Bound service offers a client server interface that allow component to interact with the services.
  • Send request get request and also do some across process with inter process communication (IPC).
  • A service has life cycle call back method that to can implement to monitor changes in the service state.
  • Following is a diagram of service life cycle.

  

  • According to above diagram to create a service that you create a java class is base class of the service.
  • The services base class defines various call back method and most important are that you do not need to implement all the call back methods.


Question: Explain how to connect android with PHP my SQL.
  • Answer: Android support external database connectivity to create a server application using PHP, Asp etc which allow fetching data from MYSQL database or from SQL server.
  • The data which want to transform from server to android activity is possible using JSON object.
  • After we fetch data from server using a JSON PHP script allowed CRUD operations.
  • CRUD means create read update and delete operations.
  • First of all your android application call PHP script in order to perform a data operation then PHP script connect to your database to perform the operation so the data flow from your android app to PHP script and then finally store into my SQL database.
  • Following is Steps to follow connection with android PHP MySQL.
1.      WAMP server
  • The full form of the WAMP is Window Apache MySQL PHP by installing this software we can directly communicate with PHP and my SQL.We can also use XAMPP server.
2.      Installing and Running WAMP server
  • Once install you are WAMP server then it start from local host in a web browser and there is a facility for PHP and My SQL.
3.      Create and running PHP object
  • Once you have Create a complete environment to develop such an application you require to create a simple PHP file for testing and debugging the PHP project. Once you create a simple database now you require operating all the operation in it.
4.      Connect to my SQL database using PHP
  • The actual server side coding always starts to create PHP class to connect my SQL database.
  • The main purpose of this class is to open connection to database and close the connection whenever it is not require.
5.      Create my SQL CRUD operation
  • After creating connection classes you have creating one another PHP file with create read update and delete operation.
6.      Reading a row from my SQL
  • After creating a CRUD operation user require a file to parse the entire PHP object into JSON.



https://myshopprime.com/uday.shah3/shop

Please share and comment it... Thank you.

:: Best of Luck ::