Site Loader
Get a Quote
Rock Street, San Francisco

Q.1 How do Hybrid Apps work on the Android Platform?
Ans.Android’s implementation of a WebBrowser authority is called a WebView. WebView use the open source WebKit rendering engine to view and carry out web content. The procedur reveal as piece of the native WebView API is WebView.addJavascriptInterface(Object ob1, String st1). This procedure introduces the give Java object in to the WebView. The injected Java object which can be approach through the JS as a global variable with the very same name provide in the Java method.
This functionality opens a communication channel b/w the Java and JS (JavaScript) layers.
Hybrid applications take benefit of this abstraction layer that reveals the device capabilities to the UI layer.

This underused and powerful technique can come in handy when building hybrid apps.

We Will Write a Custom Essay Specifically
For You For Only $13.90/page!


order now

Q.2 You want to retrieve or send data using the devices network connection from the application. However, the application doesn’t know whether the user has network access.

Ans.The getActiveNetworklnfo() method of ConnectivityManager returns a Networklnfo instance representing the first connected network interface it can find or null if none of the interfaces are connected. Checking if this method returns null should be enough to tell if an Internet connection available or not.

private boolean isNetworkAvailable(){
ConnectivityManager_connectivityManager=(ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo activeNetworklnfo connectivityManager.getActiveNetworkInfo();
return activeNetworklnfo != null && activeNetworkInfo.isConnected();
}
Q.3 Cross-platform development with PhoneGap framework involves a wide variety of tools. These tools are like building blocks used together to develop the final application. Some tools are only used if the developer is targeting at a specific platform. For example, Android SDK is used only when targeting Android devices. (define and describe all the technologies and their workflow)
Ans.Apache Cordova
Apache Cordova is the open-source type of PhoneGap the prime gadget for cross-platform application development.
It’s a write-once, run-anywhere solution specially designed for mobile. But to make sure even cross-platform workflow, it helps to be aware some setup and configuration essential.

Apache Ant
This is a Java-based and open-source software making tool developed by the Apache Foundation.
It is alike to the create utility, but is major functional on the Java platform.
Dissimilar create, Ant scripts are jot down in XML to tell the build steps and its dependencies.

Node.js
The Node.js server receives our appeal and calls a method to recover that file from disk. While the Node.js server is delaying for the file to be recovered, it services the follow web request.
When the file is recovered, there is a callback method that is saved in the Node.js server’s row.

NpmNPM is a node container manager.
It is essentially used for controlling dependencies of different server side dependencies.
We can control our server side dependencies physically as well but once our project’s dependencies grow it becomes hard to install and control.

Android SDK
Android SDK is “the tool” for making and put together android application, while Android Studio is the GUI IDE for consuming Android SDK.
However, Android SDK can be start stand-alone or with the other tooll like Eclipse.

Java Development Kit
A JDK is a development environment for writing Java applets and apps.
It composed of a RE that sits on top of the OS layer as well as the tools and programming that developers need to compile, debug etc.

PhoneGap pluginsPhoneGap plugins opens door to some stunning functionalities and are simply accessible available.

Plugins are very beneficially when we need to extend the functionality given by the phonegap.

Plugins can be easily access from the npm repository and any other public repository.

Q.4 There are 4 java classes related to the use of sensors on the Android platform. List them and explain the purpose of each.

Ans.SensorEventSensorEventListenerSensor
SensorManager1.SensorEventSensorEvent class is uses to make SensorEvent object which gives detail about SensorEvent. A SensorEvent object includes the following information:
Basic Sensor information.

Timestamp for the event.

Category of Sensor that make the event.

Knowledge respecting accuracy.

2.SensorEventListenerWe can use interface to make 2 callback procedure that collect notifications when sensor values change.

SensorEventListener is used for receiving notifications from SensorManager when there is new Sensor information.

3.SensorSensor java class use to create an example of a fixed sensor. Sensor class produces different procedures that let you determine a sensor power. Sensor class represents a Sensor.

Use getSensorList(int) to receive the list of available Sensors.

3.SensorManagerSensorManager class is use to make an example (instance) of sensor service. SensorManager access the devices Sensors. Get an instance of this class by calling Contex.getSystemService() with the argument SENSOR_SERVICE.

SensorManager produces different procedures for
Accessing
Listing sensors
Registering
and Un-registering SensorsEventListeners and acquiring orientation data.

Q.5 Under that condition could the code sample below crash your application? How would you modify the code to avoid this potential problem?

Ans.It is feasible that there are no any apps that can perform your intent. In this scenario, our app will crash when we invoke startActivity() .

To avoid crash app, before calling startActivity() we should first confirm that there is at least one app registered in the mobile that can perform the intent.

To do this use resolveActivity() on our intent object:
Verify that there are applications registered to handle this intent (resolveActivity returns null if none are registered).

if (sendIntent.resolveActivity(getPackageManager()) != null)
{
startActivity(sendIntent);
}
Implicit intent states an operation that can invoke every application on the device able to perform the operation.

By using an implicit intent is functional when our app can’t execute the operation, but other applications probably can do.

If there is additional or more than one app registered that can perform this request, the user will be prompted to choose which one to use.

Post Author: admin

x

Hi!
I'm Lillian

Would you like to get a custom essay? How about receiving a customized one?

Check it out