Mobile App Development in Lucknow


cropped-android-apps-111.jpg

Hey,

Lucknow is being hub of software technology and mobile application development. Day by day increasing list of software companies in Lucknow, is showing that there is a lot of opportunity to grow. We are listing some mobile development companies operating in Lucknow.

1. STPL

Website: https://www.stpl.biz/

2. Laikor infosolution pvt ltd

Website: https://www.laitkor.com/

3. Unicode System

Website: http://www.unicodesystems.in/

4.  NewGenApp

Website: http://www.newgenapps.com/

5. AlcanzarSoftware

Website: http://www.alcanzarsoft.com/

6. 18Pixel

Website: https://www.18pixels.com/

7.Medma Infomatix

Website: http://www.medma.in/

8.Erectorlab

Website: http://erectorslab.com/

9.Erectorlab

Website: http://erectorslab.com/

Advertisements

Apple Shortens App Review : 2 days


Apple has cut the amount of time it takes to approve new submissions for the App Store down to just one day, claims a new report.

The initiative — which is part of Apple’s efforts to focus on improving its services at a time when iPhone sales are decreasing — means that, in the past year alone, the mean number of days it takes an app to be approved has fallen from 8.8 down to only 24 hours.

“A lot of the way that we build software for iOS is controlled around the fact that you have a one-week release cycle,” a developer who has done work for Uber and Foursquare told Bloomberg. “It can now happen within hours of submitting them, which is really awesome because it speeds up the development cycle.”

Slicing the approval time is one more way Apple can compete with Android, which doesn’t carry out extensive security or content checks on submitted apps before making them available on the Google Play store.

Phil Schiller took over running the App Store for Eddy Cue back in December. Since then, Apple has reduced its iAd advertising platforms, while moving over 100 employees to work on improving App Store search.

Strava integration in iOS


Strava is a website and  mobile app used to track athletic activity via GPS. Its headquarters are located in California. The most popular activities tracked using the software are  Cycling and running.

If we are developing a health based application , sometimes we need to fetch data from Strava for analysis .In this tutorial , we will show you how to fetch data from Strava.

Strava provide full API to fetch data from their server . for more detail https://strava.github.io/api/v3/oauth/ .

  1. Strava API work with Oauth 2.0 , go through https://www.strava.com/login and register your app and get ClientId , Client Secret .
  2. Download OAuth library from  https://github.com/OAuthSwift/OAuthSwift
  3. Download demo STRAVA app from https://github.com/msyshani/StravaDemo-for-iOS

 

Thanks

Enjoy coding

 

 


					

How to create facebook album through iOS app


1.Requirement

i) facebook accessToken

2.Code

-(void)createFbAlbumwithName:(NSString *)AlbumName andId:(NSString *)bubbleId{

NSString *token=[[NSUserDefaults standardUserDefaults] objectForKey:@”fb_access_token”];

if(token==nil){

[self alertForfacebookAlbum:@”Your account not connected to facebook.” withActionTitle:@”Cancel”];

return;

}

NSMutableDictionary *paramsToCreateAlbum = [NSMutableDictionary dictionaryWithObjectsAndKeys:

                                               AlbumName, @”name”,

[NSString stringWithFormat:@”This album is created by YourApp app for Event ‘%@'”,AlbumName], @”message”,token,@”access_token”, nil];

[FBRequestConnection startWithGraphPath: @”me/albums”

parameters: paramsToCreateAlbum

HTTPMethod: @”POST”

completionHandler: ^(FBRequestConnection *connection,

id result,

NSError *error) {

if (!error) {

//publish content to albumID

NSLog(@”album key is %@”,[result objectForKey:@”id”]);

facebookAlbumId=[result objectForKey:@”id”];

//

}

else {

NSLog(@”error: %@”, error);

[self alertForfacebookAlbum:@”Error in creating facebook album” withActionTitle:@”Retry”];

}

                          }]; }

Few moment with Android


1. Android Core Building Blocks                                                

An android component is simply a piece of code that has a well defined life cycle e.g. Activity, Receiver, Service etc.

(i) Activity : An activity is a class that represents a single screen. It is like a Frame in AWT.

(ii) View: A view is the UI element such as button, label, text field etc. Anything that you see is a view.

(iii) Intent ::

Intent is used to invoke components. It is mainly used to:

  • Start the service
  • Launch an activity
  • Display a web page
  • Display a list of contacts
  • Broadcast a message
  • Dial a phone call etc.

For example, you may write the following code to view the webpage.

// Implicit Intent by specifying a URI

Intent i = new Intent(Intent.ACTION_VIEW,

Uri.parse(http://www.example.com”));

// Starts Implicit Activity

startActivity(i);

// Explicit Intent

  1. Intent i = new Intent(getApplicationContext(), ActivityTwo.class);
  2.  startActivity(i);

(iv) Service: Service is a background process that can run for a long time.

There are two types of services local and remote. Local service is accessed from within the application whereas remote service is accessed remotely from other applications running on the same device.

(v) Content Provider : Content Providers are used to share data between the applications.

(vi) Fragment : Fragments are like parts of activity. An activity can display one or more fragments on the screen at the same time.

(vi) AndroidManifest.xml : The AndroidManifest.xml file contains information of your package, including components of the application such as activities, services, broadcast receivers, content providers etc.

It performs some other tasks also:

  • It is responsible to protect the application to access any protected parts by providing the permissions.
  • It also declares the android api that the application is going to use.
  • It lists the instrumentation classes. The instrumentation classes provides profiling and other informations. These informations are removed just before the application is published etc.

This is the required xml file for all the android application and located inside the root directory.

(vii) Android R.java file : Android R.java is an auto-generated file by aapt (Android Asset Packaging Tool) that contains resource IDs for all the resources of res/ directory.

If you create any component in the activity_main.xml file, id for the corresponding component is automatically created in this file. This id can be used in the activity source file to perform any action on the component.

(viii) Android Hide Title Bar Example : The requestWindowFeature(Window.FEATURE_NO_TITLE) method of Activity must be called to hide the title. But, it must be coded before the setContentView method.

  1.    @Override
  2.     protected void onCreate(Bundle savedInstanceState) {
  3.         super.onCreate(savedInstanceState);
  4.         requestWindowFeature(Window.FEATURE_NO_TITLE);//will hide the title not the title bar
  5.         setContentView(R.layout.activity_main);
  6.     }
  7. }

The setFlags() method of Window class is used to display content in full screen mode. You need to pass theWindowManager.LayoutParams.FLAG_FULLSCREEN constant in the setFlags method.

  1. @Override  
  2. protected void onCreate(Bundle savedInstanceState) {
  3.     super.onCreate(savedInstanceState);
  4.     requestWindowFeature(Window.FEATURE_NO_TITLE);
  5.     //code that displays the content in full screen mode  
  6.     this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
  7.                 WindowManager.LayoutParams.FLAG_FULLSCREEN);//int flag, int mask
  8.     setContentView(R.layout.activity_main);
  9. }

(ix) ArrayAdapter : A concrete BaseAdapter that is backed by an array of arbitrary objects. By default this class expects that the provided resource id references a single TextView. If you want to use a more complex layout, use the constructors that also takes a field id. That field id should reference a TextView in the larger layout resource.

However the TextView is referenced, it will be filled with the toString() of each object in the array. You can add lists or arrays of custom objects. Override the toString() method of your objects to determine what text will be displayed for the item in the list.

To use something other than TextViews for the array display, for instance, ImageViews, or to have some of data besides toString() results fill the views, override getView(int, View, ViewGroup) to return the type of view you want.

(x) Android Activity Lifecycle : Android Activity Lifecycle is controlled by 7 methods of android.app.Activity class. The android Activity is the subclass of ContextThemeWrapper class.

An activity is the single screen in android. It is like window or frame of Java.

By the help of activity, you can place all your UI components or widgets in a single screen.

The 7 lifecycle method of Activity describes how activity will behave at different states.

Let’s see the 7 lifecycle methods of android activity.

Method

Description

onCreate

called when activity is first created.

onStart

called when activity is becoming visible to the user.

onResume

called when activity will start interacting with the user.

onPause

called when activity is not visible to the user.

onStop

called when activity is no longer visible to the user.

onRestart

called after your activity is stopped, prior to start.

onDestroy

called before the activity is destroyed.

  1. package com.example.activitylifecycle;

  2. import android.os.Bundle;

  3. import android.app.Activity;

  4. import android.util.Log;

  5. import android.view.Menu;

  6. public class MainActivity extends Activity {

  7.     @Override

  8.     protected void onCreate(Bundle savedInstanceState) {

  9.         super.onCreate(savedInstanceState);

  10.         setContentView(R.layout.activity_main);

  11.         Log.d(“lifecycle”,“onCreate invoked”);  

  12.     }

  13.     @Override

  14.     protected void onStart() {

  15.         super.onStart();

  16.          Log.d(“lifecycle”,“onStart invoked”);  

  17.     }

  18.     @Override

  19.     protected void onResume() {

  20.         super.onResume();

  21.          Log.d(“lifecycle”,“onResume invoked”);  

  22.     }

  23.     @Override

  24.     protected void onPause() {

  25.         super.onPause();

  26.          Log.d(“lifecycle”,“onPause invoked”);  

  27.     }

  28.     @Override

  29.     protected void onStop() {

  30.         super.onStop();

  31.          Log.d(“lifecycle”,“onStop invoked”);  

  32.     }

  33.        @Override

  34.     protected void onRestart() {

  35.         super.onRestart();

  36.          Log.d(“lifecycle”,“onRestart invoked”);  

  37.     }

  38.     @Override

  39.     protected void onDestroy() {

  40.         super.onDestroy();

  41.          Log.d(“lifecycle”,“onDestroy invoked”);  

  42.     }

  43. }

2) Who is the founder of Android?

Andy Rubin.

3) What are the code names of android?

  1. Aestro
  2. Blender
  3. Cupcake
  4. Donut
  5. Eclair
  6. Froyo
  7. Gingerbread
  8. Honycomb
  9. Ice Cream Sandwitch
  10. Jelly Bean
  11. Kitkat

4) What are the advantages of android?

Open-source: It means no licence, distribution and development fee.

Platform-independent: It supports windows, mac and linux platforms.

Supports various technologies: It supports camera, bluetooth, wifi, speech, EDGE etc. technologies.

Highly optimized Virtual Machine: Android uses highly optimized virtual machine for mobile devices, called DVM (Dalvik Virtual Machine).

5) Does android support other language than java?

Yes, android app can be developed in C/C++ also using android NDK (Native Development Kit). It makes the performance faster. It should be used with android SDK.

6) What are the core building blocks of android?

The core building blocks of android are:

  • Activity
  • View
  • Intent
  • Service
  • Content Provider
  • Fragment etc.

7) What is the name of database used in android?

SQLite: An opensource and lightweight relational database for mobile devices.

8) What is AAPT?

AAPT is an acronym for android asset packaging tool. It handles the packaging process.

9) What is ADB?

ADB stands for Android Debug Bridge. It is a command line tool that is used to communicate with the emulator instance.

10) What is NDK?

NDK stands for Native Development Kit. By using NDK, you can develop a part of app using native language such as C/C++ to boost the performance.

Expert Level Question                                                                                                          

1. What is the relationship between the life cycle of an AsyncTask and an Activity? What problems can this result in? How can these problems be avoided?

Answer:: An AsyncTask is not tied to the life cycle of the Activity that contains it. So, for example, if you start an AsyncTask inside an Activity and the user rotates the device, the Activity will be destroyed (and a new Activity instance will be created) but the AsyncTask will not die but instead goes on living until it completes.

Then, when the AsyncTask does complete, rather than updating the UI of the new Activity, it updates the former instance of the Activity (i.e., the one in which it was created but that is not displayed anymore!). This can lead to an Exception (of the type java.lang.IllegalArgumentException: View not attached to window manager if you use, for instance, findViewById to retrieve a view inside the Activity).

There’s also the potential for this to result in a memory leak since the AsyncTask maintains a reference to the Activty, which prevents the Activity from being garbage collected as long as the AsyncTask remains alive.

For these reasons, using AsyncTasks for long-running background tasks is generally a bad idea . Rather, for long-runningbackground tasks, a different mechanism (such as a service) should be employed.

2. There are four Java classes related to the use of sensors on the Android platform. List them and explain the purpose of each.

Answer :: The four Java classes related to the use of sensors on the Android platform areL

  • Sensor: Provides methods to identify which capabilities are available for a specific sensor.
  • SensorManager: Provides methods for registering sensor event listeners and calibrating sensors.
  • SensorEvent: Provides raw sensor data, including information regarding accuracy.
  • SensorEventListener: Interface that defines callback methods that will receive sensor event notifications.

3.What is DDMS? Describe some of its capabilities.

Answer : DDMS is the Dalvik Debug Monitor Server that ships with Android. It provides a wide array of debugging features including:

  • port-forwarding services
  • screen capture
  • thread and heap information
  • network traffic tracking
  • incoming call and SMS spoofing
  • simulating network state, speed, and latency
  • location data spoofing

4. What is Dalvik Virtual Machine?

The name of Android’s virtual machine. The Dalvik VM is an interpreter-only virtual machine that executes files in the Dalvik Executable (.dex) format, a format that is optimized for efficient storage and memory-mappable execution. The virtual machine is register-based, and it can run classes compiled by a Java language compiler that have been transformed into its native format using the included “dx” tool. The VM runs on top of Posix-compliant operating systems, which it relies on for underlying functionality (such as threading and low level memory management). The Dalvik core class library is intended to provide a familiar development base for those used to programming with Java Standard Edition, but it is geared specifically to the needs of a small mobile device.

5. What is Android Runtime?

Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language. Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included “dx” tool.

6. What is the Open Handset Alliance?

The OHA is a consortium of 84 technology and mobile companies that have joined hands to accelerate innovation in mobile technology and at the same time offer the end users a better, cost-effective and richer mobile experience. Members of this include Google, HTC, Sony, Dell, Intel, Motorola, Qualcomm, Texas Instruments, Samsung, LG, T-Mobile, Nvidia. The OHA was started on 5 November 2007 by Google and 34 other companies. Android is the main software of the alliance.

7. What is the difference between Service and Thread?

Service is like an Activity but has no interface. Probably if you want to fetch the weather for example you won’t create a blank activity for it, for this you will use a Service. It is also known as Background Service because it performs tasks in background. A Thread is a concurrent unit of execution. You need to know that you cannot update UI from a Thread. You need to use a Handler for this.

8.What is the importance of XML-based layouts?

The use of XML-based layouts provides a consistent and somewhat standard means of setting GUI definition format. In common practice, layout details are placed in XML files while other items are placed in source files.

9. What are the steps in creating a bounded service through AIDL.

1. create the .aidl file, which defines the programming interface

2. implement the interface, which involves extending the inner abstract Stub class as well as implanting its methods.

3. expose the interface, which involves implementing the service to the clients.

10. What data types are supported by AIDL?

AIDL has support for the following data types:

string

charSequence

List

Map

all native Java data types like int, long, char and Boolean

11.What is the difference between a regular bitmap and a nine-patch image?

In general, a Nine-patch image allows resizing that can be used as background or other image size requirements for the target device. The Nine-patch refers to the way you can resize the image: 4 corners that are unscaled, 4 edges that are scaled in 1 axis, and the middle one that can be scaled into both axes.