Category: Mobile Development

Singleton class  which is created in java for  global point of view. Singletons are useful to provide a unique source of data or functionality to other Java Objects. In android Singleton class creates only one instance.

Benifit  to use of Singleton class in android:

Purpose to use  Singleton class is control to create number of object  creation in project and limiting the number of objects.

Suppose you made a app to play song through service,In this case you can use singleton class concept.Inwhich media player declare in service as a globally and use media player in any where of app,by using concept of singleton class concept.Means you create object of singleton class in activity inwhich you want to use singleton class value .And use mediaplayer globally you don’t need to create another object of media player.

Here is the process to use Singleton class:

This is Arraylist which is globally declare in Singleton class

public ArrayList<String> arraylist  = new ArrayList< String >();
Singleton class is:

// File Name: Singleton.java

    public class Singleton {
private static final Singleton instance = new Singleton();
public ArrayList<SubCatogry_Pozo> arraylist = new ArrayList<SubCatogry_Pozo>();
// /* A private Constructor prevents any other    * class from instantiating.    */
public Singleton() {
}

/* Static ‘instance’ method */
public static Singleton getInstance() {
return instance;
}
}

Here is  SubCatogry_Pozo  is  your pozo class of app.And arraylist which is globally declared in singleton class and use this arraylist through singleton class object.

And then use this singleton class in any activity in project ,To use this Singleton class in another Activity just create object of Singleton class

//Create object of Singleton class
Singleton singleton =Singleton.getInstance( );

And use arraylist through object of Singleton class i.e.

singleton. arraylist.add(value);

value which you want to add in arraylist and here is class inwhich you want to use arraylist of singleton class.

// File Name: MainActivity.java

public class MainActivity extends Activity{

Singleton singleton =Singleton.getInstance( );   

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
   singleton. arraylist.add(value);

}

}

The Singleton class maintains a static reference to the  singleton instance and returns that reference from the static getInstance() method.

Read More Singleton class

Android Mobile Development

What is IONIC :

It is an open source platform to make hybrid application. Hybrid applications are those who takes single language to make an app and which will run on all types of mobile devices. Some clients prefer to make hybrid application because of cost. And small applications are easy to go with hybrid.

How Start with IONIC

  • First Install Node.js package into machine.

https://nodejs.org/en/download/

  • Install IONIC, Open command prompt or terminal and use below command

npm install -g ionic cordova

  • After successfully installed, Create new app. For that, from same command prompt or terminal go to folder location where you want to create project. And run below command

ionic start app_name

After this it will ask for project type like, blank, tab, tutorial etc.

Select your option using down and up arrow keys and press Enter.

It will again take some time and will create project into that location.

  • Now Check newly created app on browser by running below command.

ionic serve

It will run project on browser with full screen. And If you want to run project like mobile device interface then       

run below command

ionic serve –lab

It will open project into mobile interface screen with ios, android and windows.

  • Now you can check project structure from project location. You will get

Config.xml : Here if you need any plugin to be install then you can add. Or any  hardware setting should be go here.

Resources : We need to add all resources inside this folder.

Src       : Our all functionality will go from this folder. You can find various folders inside it. Check those you will get an idea what it does.

  • Now try to create new views.

ionic g page page_title

It will generate all necessary files into “page_title” folder like its model, view and controller

But to access it you need to import file into “app.component.ts” and “app.module.ts”. After checking  those files you will come to know where to change.

  • Now you can edit those view as per your requirement.
  • Run your app on android device

ionic cordova run android –device

But make sure you have enable USB debugging and Developer Mode on your android device

  • To make production build, you need to run below command

ionic cordova run android –prod –release
# or
ionic cordova build android –prod –release

  • In this way you can successfully create your first app in ionic

 

If you feel this blog is really helpful for you then do comment. Thank you.

 

 

Read More Beginning with IONIC 2

Mobile Development

e-commerce

Thinking about starting an eCommerce startup but you simply don’t know how?

Does it seem like an impossible challenge for you?

…you’re not alone.

So before anything just make proper plan and then execute in better way.

One of the major reasons, why online eCommerce startups succeed its  because of the right development / consultant partner selection.

So being a startup you need to be very careful while selecting the team or company  for your online eCommerce web portal development as well as Mobile Application. So you need to select best team to handle all the development process from scratch and make proper plan to execute.

Four parameters for your startup eCommerce business:

  1. Ecommerce Development Expertise: Start the ecommerce web portal development expertise before you handover your project development work by discussing their work examples in detail. You can also ask about their client references and just to be sure does a reference check that whatever they are claiming as their developed web portals are originally delivered by them only. Also refer a few resumes/portfolio /profile to assess their expertise in ecommerce  development and short list top talents to compare with few other IT companies / consultants/freelancers.
  2. E-commerce Consulting Experience or Expertise: Apart from the technical expertise, being a startup company, it is most important for you to review their(companies/freelancer) domain expertise in the ecommerce field. You should choose a company which not only delivers technically but also understands the ecommerce depth and can consult you with respect to further steps which can take your online business to the next level. It means you need technical person as well as ecommerce adviser they can give you advice.
  3. Support & Maintenance( after product delivery until its stable): The team must be ready to provide support after initial ecommerce development, third party integrations, bug fixing and maintenance tasks. They should also know about payment integration methodologies
  4. Marketing :  Marketing of any product play vital role in product success. 90% of product success and failure is depends on marketing stuffs. So Choose wisely a marketing team If the company know  how to market the products online and how they reach the goal , it is an added advantage for you to select them However before allocating your business projects to them. you should review their past projects and the growth of their past clients with their efforts.

 

One of the important aspect of eCommerce success is Mobile application. Because of my generation, everything they want in smart phone. So mobile application is also play very important role for product success.

We also provide end –to –end Web and mobile application support and maintenance as well as development To more about my service and solutions drop us an email at  info@kodesoft.in

Read More Four Things You Need To Know Before Ecommerce Startups:

Mobile Development Trends Web Development

Following example shows step-by-step process to  how to integrate an AdMob advertisement into your Android application:

Step 1 If you are not already registered at AdMob, just visit the AdMob Website and create a new account. After the registration process you can see your empty AdMob dashboard. The screenshot below shows an empty AdMob dashboard:

Click on monetize new app then bellow screen will appear:

admob1

Step 2: Click on Add your app manually.Bellow Screen will show

admob2

Step 3: Click on Add App Button :next screen look like is as bellow:

admob3

Step 4:   Download Admob Android sdk: The AdMob Android SDK allows the developer to seamlessly integrate an advertisement within an Android based application. Download and unzip the Android jar archive (googleadmobadssdkandroid.zip). The archive contains the AdMob Android SDK for integrating an ad view into your Android user interface layouts (GoogleAdMobAdsSdk-6.1.0.jar).

Step 5: Let add admob jar file in your native application:googleadmobadssdkandroid.zip  unzip it and copy in lib folder in your anroid application:   Start Eclipse and create a new Android based Java application.   Create a /libs folder directly within the root folder of your Android project folder and copy the AdMob Android SDK jar into that folder. Right click on your project and add this library to your projects build path by selecting Build Path > Add External Archive…

The sample application consists of a simple main layout that contains a single TextView. Now we are going to modify this simple layout to contain an AdView. Therefore we add a new AdView as it is shown below:

<?xml version=”1.0″ encoding=”utf-8″?>

<LinearLayout xmlns:android=”http://schemas.android.com/apk/res/android”

xmlns:ads=”http://schemas.android.com/apk/lib/com.google.ads”

android:layout_width=”fill_parent”

android:layout_height=”fill_parent”

android:orientation=”vertical” >

<TextView

android:layout_width=”fill_parent”

android:layout_height=”wrap_content”

android:text=”@string/hello” />

 

<com.google.ads.AdView

android:id=”@+id/adview”

android:layout_width=”fill_parent”

android:layout_height=”wrap_content”

ads:adSize=”BANNER”

ads:adUnitId=”a1501676c633fac”

ads:loadAdOnCreate=”true”

ads:testDevices=”TEST_EMULATOR, TEST_DEVICE_ID”

/>

</LinearLayout>

 

Step 6: Go to the AndroidManifest.xml file file open it and give the required permission:

Now add the Google AdActivity as well as both necessary permissions ACCESS_NETWORK_STATE and INTERNET to your AndroidManifest.xml file as it is shown here: 

<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE”/>

<uses-permission android:name=”android.permission.INTERNET”/>

Code will look like bellow in AndroidManifest.xml

<?xml version=”1.0″ encoding=”utf-8″?>

<manifest xmlns:android=”http://schemas.android.com/apk/res/android”

package=”at.smartlab.androidbook.AdMobTest”

android:versionCode=”1″

android:versionName=”1.0″ >

 

<uses-sdk android:minSdkVersion=”15″ />

 

<application

android:icon=”@drawable/ic_launcher”

android:label=”@string/app_name” >

<activity

android:name=”.AdMobTestActivity”

android:label=”@string/app_name” >

<intent-filter>

<action android:name=”android.intent.action.MAIN” />

<category android:name=”android.intent.category.LAUNCHER” />

</intent-filter>

</activity>

<activity android:name=”com.google.ads.AdActivity”

android:configChanges=”keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize”/>

</application>

 

<uses-permission android:name=”android.permission.ACCESS_NETWORK_STATE”/>

<uses-permission android:name=”android.permission.INTERNET”/>

</manifest>

 

Step 7:To receive ads from AdMob you have to create an AdRequest instance within your own Activity and hand it over to your AdView layout element, as it is shown below:  

 

package at.smartlab.androidbook.AdMobTest;

 

import com.google.ads.AdRequest;

import com.google.ads.AdView;

 

import android.app.Activity;

import android.os.Bundle;

 

public class AdMobTestActivity extends Activity {

/** Called when the activity is first created. */

@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

 

setContentView(R.layout.main);

 

// Look up the AdView as a resource and load a request.

AdView adView = (AdView)this.findViewById(R.id.adview);

adView.loadAd(new AdRequest());

}

}

Step 8: Copy the bellow code in layout/main.xml file 

<com.google.ads.AdView

android:id=”@+id/adview”

android:layout_width=”fill_parent”

android:layout_height=”wrap_content”

ads:adSize=”BANNER”

ads:adUnitId=”a1501676c633fac”

ads:loadAdOnCreate=”true”

ads:testDevices=”TEST_EMULATOR, your test device ID goes here”

/>

 

To know the your test device ID goto the logcat file and copy it

The resulting Android app shows the demanded advert in combination with a HelloWorld TextView:

admob4

Read More AdMob Advertising in Android Application/Game Step wise process

Android iPhone Mobile Development