Services in Android- TecOrb Technologies

A service is part that runs inside the background to perform long-walking operations while not having to have interaction with the user and it works despite the fact that utility is destroyed. A service can basically take two states −

Sr. No. State & Description
1 Began

A service is commenced whilst an application factor, inclusive of an pastime, starts offevolved it by way of calling startService(). once commenced, a provider can run inside the history indefinitely, even though the thing that commenced it is destroyed.

2 Bound

A service is a bound when an application aspect binds to it with the aid of calling bindService(). A certain provider offers a customer-server interface that lets in additives to have interaction with the service, ship requests, get results, or even accomplish that throughout strategies with interprocess verbal exchange (IPC)

                                          Service Life Cycle

  • A service has life cycle callback methods that you may implement to monitor changes inside the provider’s country and you may carry out paintings at the appropriate level. the subsequent diagram at the left indicates the lifestyles cycle whilst the service is created with startService() and the diagram at the right suggests the existence cycle whilst the provider is created with bindService():

 Service life cycle diagram:

Untitled2

  • To create an service, you create a Java elegance that extends the service base class or one in every of its present subclasses. The service base magnificence defines numerous callback techniques and the maximum vital are given under. You do not want to enforce all of the callbacks strategies. however, it is vital that you apprehend each one and implement those that make sure your app behaves the manner users assume.

Callback & Description

  • onStartCommand(): The gadget calls this approach whilst any other thing, along with an interest, requests that the provider be commenced, by calling startService(). if you put in force this technique, it’s miles your responsibility to forestall the carrier whilst its paintings is achieved, with the aid of calling stopSelf() or stopService() techniques.
  • OnBind(): The gadget calls this technique when every other issue wants to bind with the carrier by calling bindService(). if you implement this method, you must provide an interface that customers use to speak with the carrier, through returning an IBinder object. You must always implement this approach, but in case you do not need to allow binding, then you definately should return null.
  • onUnbind(): The gadget calls this approach whilst all clients have disconnected from a particular interface posted with the aid of the service.
  • OnRebind(): The gadget calls this technique when new customers have related to the service, after it had previously been notified that all had disconnected in its onUnbind(reason).
  • onCreate(): The gadget calls this approach while the provider is first created using onStartCommand() or onBind(). This name is required to carry out one-time set-up.
  • OnDestroy():The system calls this approach while the carrier is not used and is being destroyed. Your provider should implement this to easy up any assets consisting of threads, registered listeners, receivers, etc.

Varieties of android Services

    Services in Android are components which run within the historical past. They do no longer have any person interface. One utility can begin a provider and the Service can run within the background although this application is switched with a new application via the user. There are two styles of offerings namely-

 Unbound service:   it is a form of service which runs in the history indefinitely, even though the activity which commenced this carrier ends.

sure carrier.

Bound Service: it’s miles a type of Services which runs till the lifespan of the interest which commenced this service.

Also Read- Tab Bar Controller In Swift iOS

If you are, looking to Develop and design for your project then feel free to contact us at any time

Call Us- +91 9910781148, +1 8033353593

Email: company@tecorb.com

Skype- tecorb

“We maintain transparency with our customers. Our values and business ethics has given us repeated customers. We tend are proud to be a reliable outsourcing partner for many clients across the World.”

Advertisements

Tab Bar Controller In Swift IOS

OverView:- Tab Bar Controller

The Tab Bar interface is helpful in situation where you want  to provide different perspective on the same set of data or in situation, where you want to or in situation where we want to provides your application long functional lines. The key component of a tab bar interface is the present of tab bar view along the bottom of the screen. This view is used to initiate the navigation bar b/w your application different modes and can also provide the information about the state of each mode

The manager for a tab bar interfaces is a tab bar controller objects. The tab bar controller creates and manages the tab bar view and also manages the view controller that provided the content view for each mode. Every contents of view controller is design as the view controller for one of the tabs in the tab bar view. When a tab is pressed by the user, the tab bar controller object select the tab and display the view associat with correspond content view controller.

Tab bar controller has its own container view, which encompass all of the other views, including the tab bar view. The custom is provided by the view controller of the selected tab.

Getting Start:-

Open a xcode  and create a new project. Use the Single View Application as starting point :-

  1. Create Single View Application and Click on the Next button
  2. Give the Product name and click  on the next button
  3. After that click on the create button

After Xcode  has created the project

  • The new project consist of two classes AppDelegate , ViewController and main.storyboard file.
  • Click Main.Storyboard in the project navigator to open it in the Interface Builder editor.
  • Select the ViewController and goto Editor click on the editor

untitled

  • Then goto the Embed in And Seclect the tab bar Controller
  • The you will see that in your project embedded a tab bar controller like this

ios-apps-development-companyIn your project of the Main.Storyboard file you will see that add a new tabbar controller and your main .Storyboard file look  like this your project inter face builder

iphone-application-development

if you want embedded  more ViewController with this tab bar controller then you select the ViewController from the object library and Drag the ViewController in the interface builder

  • Now you see that in your project have two  ViewController in the Main.StoryBoard
  • If you want join second ViewController with the tab bar controller then do this  Control + Drag on the secondViewController then you see a pop view like this

iphone-apps-development-company

Then you select the view controller from this view

Now then you see after complete this job in your project  a tab bar controller connect with your secondViewController.

tab-bar-controller

  • Now you can run your project but how to decide that , which View controller is first view Controller and which Second View Controller
  • Now you drag uilabel drag from the object library set in the first and second View Controller
  • You can write on this label as like for First View Controller “ This is my fist View Controller” and same as for second View Controller name “This is my second View Controller”.
  • And set label color White And you want change the view controller background color
  • then select the view Controller
  • and go to attribute inspector select Backgroung color
  • set the background color
  • Now, run your project

viewcontroller-bar

Now click on the simulator second item you see  the second view Controller .

second-view-controller

Also Read- Cron Job With Sidekiq

If you are, looking to Develop and design for your project then feel free to contact us at any time

Call Us- +91 9910781148, +1 8033353593
Email: company@tecorb.com
Skype- tecorb
“We maintain transparency with our customers. Our values and business ethics has given us repeated customers. We tend are proud to be a reliable outsourcing partner for many clients across the World.”

User Interface For Android Application Development

UI stands for User Interface. In Every project, UI (User Interface) is very important because it gives look and feel to the application and also makes the application user interactive and user friendly.

With the help of UI, user can interact with the application easily and can become friendly in a very less time that’s why we can also say that User Interface (UI) in the industrial field of human-computer interaction is the space where interactions between machines and human occur.

The objective of this interaction is designing of the application or project to which a user has to interact.

Generally, the objective of UI design is to produce a user interface which makes it easy, efficient and enjoyable i.e. user-friendly to operate a machine or application in a very less time.

With the increased use of personal computer in today world and the relative decline in societal awareness of heavy machinery, the term interface is generally assumed to mean the graphical user interface.

User Interface can be different for different applications and it can be according to the need of user that how the user wants to see the application or how user wants to see it.

In android we use different tools, to make the UI of application or project, there are a lot of tools available in android like edit Text for taking or editing message, button for submit or saving the message, password field for taking password, email for email, phone number for number, rating bar for rating the application and many more are available.

There is an example of user interface given below by which you can easily understand how our application looks like and how it provides usability to the user. It can be a number of different screens to present data or to flow the information.

mobile-app-free-ui-kit-template-06

Building  a Simple User Interface:

The graphical user interface for an Android App is built a hierarchy of view and ViewGroup objects are usually UI widgets such as buttons, edit texts or text field. ViewGroup objects are invisible view containers that define how the child views are laid out.

Android provides an XML to the subclasses of View and ViewGroup so you can define your UI in XML using a hierarchy of UI elements.

We can say that layouts are subclasses of the ViewGroup and layout can be linear layout, vertical layout or relative layout.

  1. Create a linear layout
    1. Open Android studio, select your project and open Android studio’s project window, you have to go to the app >res>layout>activity_main.xml.
    2. When you open a layout file, you are first shown the design editor in the layout Editor.
    3. Delete everything whatever is written over there and insert the following XML in the XML file:rsz_linear_layout
    4. Linear Layout is subclass of View Group or View that lays your child views in either a orientation as vertical or horizontal, as specified by the android: orientation attribute.

    There are two other attributes, android: layout_width and the android:layout_height, which are required for all views in order to specify the size of layouts.

    Because the linear layout is the root view in the layout, it should fill the entire screen area and by setting the width and height to “match_parent”.

    Add a Text field

    If you want to add a text field in your project then you have to go to the activity_main.xml file, within the <Linear Layout> element and add the following <EditText> elements in then XML file.

    rsz_add_edit_text

  2. Add String Resources

    Your Android project includes a string resource file by default at res>values>strings.xml. Here, you can add two new strings in the strings.xml file.

    1. From the project window, you have to go res>values>strings.xml

    2. Add two strings by which your file looks like this

    rsz_1adding_string_resource

    Add a Button

    First go to the activity_main.xml file and add a button according to the way you want and description for button XML is given below.

     rsz_button

    Make the input box fill in the screen width

    Go to activity_main, modify the edit text according tom your need which will look like given below:

     rsz_input_box_fill

    Now here is a small view of your complete activity_main.xml layout file in which there is a layout which is linear, an edit text in which your text will appear and a button which can be used according to your need whether for save or submit.

    rsz_complete_look

    Also Read- Google Map Integration in IOS

    If you are, looking to Develop and design for your project then feel free to contact us at any time

    Call Us- +91 9910781148, +1 8033353593
    Email: company@tecorb.com
    Skype- tecorb

    “We maintain transparency with our customers. Our values and business ethics has given us repeated customers. We tend are proud to be a reliable outsourcing partner for many clients across the World.”

                                                                     

Google Map Integration in Swift IOS

OverView:-

Google Map Integration in iOS and SDK, Google Maps is a web mapping service developed by Google. It offer satellite imagery, street maps 360 degree panoramic views of streets, real- time traffic condition, and route planning for travelling by foot, car, cycle, or public transportation

Working with maps in consists of an entire programming as there are tons of things that a developer can do with them. From just presenting a location on a map to drawing a journey’s route with intermediate positions, or even exploiting a map’s possibilities in totally different approach, dealing with all these undoubtly may be a great experience that leads to superb results.

Getting Start

Step 1:- Get the latest version of Xcode

Step 2:- Install the SDK

Create a Podfile for the Google Maps SDK for IOS and use it to install the API and its dependencies:

  1. If you do not have an Xcode project yet, create one now and save it to your local machine. (If you are new to iOS development, create a Single View Application.)
  1. Create a file named Podfile in your project directory. This file defines your project’s dependencies.
  1. Edit the Podfile and add your dependencies. which includes the dependencies you need for the Google Maps SDK for iOS and Places API for iOS (optional):
  1. Add this pod in Podfile in your application
  2.            do

                       pod ‘GoogleMaps’

                       pod ‘GooglePlaces’

                    end

 6. Save the podfile

7.Open a terminal and go to the directory containing the Podfil

 8. Cd <path-to- project>

 9. Run pod install command

     Pod install

10. Close Xcode, and then open (double-click) your project’s .xcworkspace file to launch Xcode. From this time onwards, you must use the .xcworkspace file to open the project.

Step 3:- Get an API key

1.Go to the Google API Console.

2.Create or select a project.

3.Click Continue to enable the Google Maps SDK for iOS.

4. On the Credentials page, get an API key.

Note: If you have a key with iOS restrictions, you can use that key. You can use the same key with any of your iOS apps within the same project.

5. From the dialog displaying the API key, select Restrict key to set an iOS restriction on the API key.

6.In the Restrictions section, select iOS applications, then enter your app’s bundle identifier. For example: example.hellomap.

you get the bundle identifier from your project go to project then click on the project name folder then select project-> target-> general-> identity->bundle identifier -> copy your that bundle identifier then paste that identifier those restriction section

  1. Click Save.

Your new iOS-restricted API key appears in the list of API keys for your project. An API key is a string of characters, something like this:

AIzaSyBdVl-cTICSwYKrZ95SuvNw7dbMuDt1KG0

Step 4:- Add API key in your application

Add your API key to your AppDelegate.swift

  1. Import GoogleMaps
  2. Add the following to your application(_:didFinishLaunchingWithOptions:) method,

replacing YOUR_API_KEY with your API key:

GMSServices.provideAPIKey(“YOUR_API_KEY ”)

  1. if you are also using the Places API

GMSPlacesClient.provideAPIKey(“YOUR_API_KEY ”)

 Step 5:- ADD Map

Now, add or update a few methods inside your app’s default ViewController to create and initialize an instance of GMSMapView.

import UIKIT

import GoogleMaps

class GoogleMapViewController: UIViewController{

override fun loadView(){

//Mark:- Create a GMSCameraPosition there tells the map to displaying the Map

// coordinate set you want suppose Coordinate latitude -33.86, longitude – 151.20 at zoom level 10.

let camera = GMsCameraPosition.Camera(withLatitude: -33.86, longitude: 151.20, zoom: 10.0)

let mapView = GMSMapView.map(withFrame: CGRect.Zero, camera: camera)

// Mark:- Create a Marker in the Centre of the map you are designing

let marker = GMSMarker()

marker.position = CLLocationCoordinate2D(latitude: -33.86, longitude: 151.20)

marker.tittle = “Sydney”

marker.snippet = “Australia”

marker.map = mapView

  }

}

Step 6:- Declare the URL scheme used by API

Application must be declare the URL schemes that they intend to open, by specifying the schemes in the app’s Info.plist file.

To declare the URL schemes used by the Google Maps SDK for iOS add the following lines to your Info.plist

<key>LSApplicationQueriesSchemes</key>

<array>

<string>googlechromes</string>

<string>comgooglemaps</string>

</array>

Step 7:- Run your project

untitled

Also Read-Swift Tips for Those Getting Started

If you are, looking to Develop and design for your project then feel free to contact us at any time

Call Us- +91 9910781148, +1 8033353593
Email: company@tecorb.com
Skype- tecorb
“We maintain transparency with our customers. Our values and business ethics has given us repeated customers. We tend are proud to be a reliable outsourcing partner for many clients across the World.”

Swift Tips for Those Getting Started

Start developing iOS Apps (Swift) is that the excellent start line for learning to make apps that runs on iPhone and iPad. Get through this set of progressive lessons as a target-hunting introduction to putting together your initial app-including the tools, major ideas, and best practices that may ease your path.

Each chapter contains a tutorial and also the abstract info you wish to complete it. The teachings hinge on one another, walking you thru a step-wise method of making an easy and Real-world iOS app.

As you create your means through the teachings and build the app, you’ll study ideas in iOS app development, gain a deeper understanding of the

Swift programming language, and inform yourself with the numerous valuable options of Xcode, Apple’s integrated development surroundings (IDE).

Since its 1.0 release in September 2014, Savvy Apps’ development team has been experimenting with and using Swift in iOS projects.

Though the majority of our current projects remain in OC (Objective-C) because of the relative youth of Swift, we have started coding new projects in Swift since its 2.0 release in September 2015.

Swift Tips for Those Getting Started

ios-apps-development-comapmy

Clean Up Asynchronous Code

Swift had got a neat syntax for writing off the completion functions. We had completion blocks in the Objective-C, but they were delayed in the language’s development process.

untitled

Control Access to Our Code

We should always use the appropriate access control modifier to encapsulate the code. Good encapsulation helps us to understand how pieces of code interact with each other.

sw

Perform experiment and validation

Playground is an interactive and easy coding environment in Swift. We can also create playgrounds in order to test and validate the ideas, learn Swift and share concepts to each other.

ios-application-develoment

Leave NSNumber Behind

Here the Objective-C uses the C primitives for numbers, also the Foundation Objective-C API provides the NSNumber type for boxing and unboxing the primitives as well.  We can actually add Int / Float / AnyObject values for Swift dictionaries and array.

The most common Swift type that are used instead of NSNumber:

Swift: Objective-C

Int: [NSNumber integerValue]

UInt: [NSNumber unsignedIntegerValue]

Float: [NSNumber floatValue]

Bool: [NSNumber boolValue]

Double: [NSNumber doubleValue]

Download

downlad

To download the latest version of Xcode

-Open the App Store app on your Mac (by default it’s in the Dock).

-In the SF (search field) in the top-right corner, type Xcode and press the Return key.

-The Xcode app shows up as the first search result.

-Click Get and then click Install App.

-Enter your Apple ID and password when prompted.

-Xcode is download into your Application directory.

Conclusion

ios-apps

Here in Swift we had used may update classes and methods from time to time. We need to choose the correct development methodology so that we can develop more secure and flexible application.

As the Apple CEO said, “The sidelines are not where you want to live your life. The world needs you in the arena.” Its’s just the beginning for better future and technology advancement.

We TecOrb Technologies Pvt Lmt is the best company for mobile and web application development. If you want to developed any application for mobile and web and you have any query regarding this then you contact us by our website http://tecorb.com and you also call us

Call Us- +91 9910781148, +1 8033353593
Email: company@tecorb.com
Skype- tecorb

AngularJs with Ruby on Rails Task-3

In Part-2 we have worked with the controller and model in angularJs with Ruby on Rails  and submitted the book form, add that book into the list.

Today we will discuss how to save and get and save data  from/to  the database model using API in ruby on rails with the help of AngularJs.

Lets proceed further :

Step 1: First of all we have to create a Book model in rails with name attribute. And migrate the migration.

Step 2. Now create a  books controller in rails that will contain two actions first for index (to  make an api to get all books records from the db) and another for create( to save data in Book Model). And generate the routes for both of these.

  • Assuming that you are generating the routes using resources :books  in route.rb
  • So for index action path will be ‘books/’ with GET type and for create action path will be same ‘books/’ with POST type.

 Step 3: Now we have to create the JSON Apis for index and create in our books controller like so we can call them from angularJs Controller

rsz_book8

Step 4: Now from AngularJS controller that we have defined in welcome.js we have to call these apis to fetch the book records and save the book into the database.

rsz_1book9

Now We have all done. Refresh your page add book from text-box that will save into your database and all blow listing will be fetch from database. Have fun with AngularJS

rsz_book6

Also Read- AngularJs with Ruby on Rails Task-II

If you are, looking to Develop and design for your project then feel free to contact us at any time

Call Us- +91 9910781148, +1 8033353593
Email: company@tecorb.com
Skype- tecorb
“We maintain transparency with our customers. Our values and business ethics has given us repeated customers. We tend are proud to be a reliable outsourcing partner for many clients across the World.”

AngularJs with Ruby on Rails Task-II

In Part-I we have done how to use basic AngularJs in our Ruby on Rails Project.

Now today we will work with the controller and model in angularJs and submit that book form and add that book into the list.Lets proceed further:

Step 1: Now we will define a controller into our view (index.html.erb) using a div using ‘ng-controller’ like:

rsz_book3

Step 2: Now we will define the controller in the welcome.js fil

rsz_book4

Here ‘myapp’ is same as we have defined in application.html.erb within ‘ng-app’ and ‘welcomeCtrl’ is same which we have defined in view index.html.erb.

$scope is an object by which we will use to interact with the view, we can get and set variables and functions on it.

Here we have set a books array with hashes as the elements.

Step 3: Now first of all we have to access this books array on our view and show a list of books . So come to the index.html.erb and add a list like:

rsz_2book5

Here ‘ng-repeat’ will works like as loop and return every book one by one that are available in books array.

rsz_book6

Step 4: Now we have to submit this form and add the value to the list shown below.

For this we have to add  ng-submit=”addEntry()” in our form tag. Basically ‘ng-submit’ will call the ‘addEntry()’ method when this form will submit. Like,

<form ng-submit=”addEntry()”>

Step 5: Now we have to define this ‘addEntry()’ method in our Angular controller that we have defined in welcome.js file

rsz_1book7

Here $scope.books.push($scope.newEntry) will push the newEntry object in books array. ‘newEntry’ is that object which will use to access the form fields as we have described in Part-I blog.

And after pushing the newEntry data into books array we have to reset the fields so we will initialize ‘newEntry’ with null {}

Now All Done, refresh and add some book.

Also Read- AngularJs with Ruby on Rails Task-1

If you are, looking to Develop and design for your project then feel free to contact us at any time

Call Us- +91 9910781148, +1 8033353593
Email: company@tecorb.com
Skype- tecorb
“We maintain transparency with our customers. Our values and business ethics has given us repeated customers. We tend are proud to be a reliable outsourcing partner for many clients across the World.”