Mobile Application Development Tutorials

Friday, 21 August 2015

After a long delay, Google has finally announced its next android version named "Marshmallow".

So now "M" is for MARSHMALLOW.

“Today with the final Developer Preview update, we’re introducing the official Android 6.0 SDK and opening Google Play for publishing your apps that target the new API level 23 in Android Marshmallow,” Jamal Eason, Product Manager, Android writes in a blogpost.

Here are the features you can expect from Android 6.0.

Android Pay:

Android Pay is Google's new mobile payments system designed to make the checkout process easier and faster. Compatible with phones running on Android KitKat and above, Android Pay will let you walk into stores and tap on an NFC terminal to pay for products.

According to Google, Android Pay will be pre-installed on AT&T, Verizon and T-Mobile devices and will be accepted in around 700,000 stores in the US which accept contact-less payment. Android Pay will replace the Google Wallet app. Android Pay can also be used to make in-app payments provided developers integrate Pay into their apps.

Google Now on Tap:

Google Now on Tap will give Google — with your permission, of course — even more insight into your life. If you're, say, texting someone about dinner plans at some hot new restaurant, a quick press of the home button will bring up more information about that restaurant. No more having to hop out of one app and into another to look up information. This is going to be big.

App permissions:

Permissions will now be requested the first time you try to use a feature, not at the point of installation. You don't have to agree to permissions that don't make sense to you.

Additionally, if you want to have a better idea of what app permissions you've granted, you'll now be able modify permissions within the phone settings.

Fingerprint support:

While fingerprint technology is not really widespread on Android phones, Google is opening the necessary APIs to allow developers to add fingerprint support with any app. That improved biometric authentication will also be extended to Android Pay to authorise payments, making it work a lot like Apple Pay.

Of course, your device will need a hardware fingerprint scanner to begin with, but with Google's full support, expect to see these appear on many more devices in the future.

Power management - Doze:

Doze is a new feature that aims to solve or mitigate this issue to a certain extent by reducing the power consumed by the device when in idle state. This feature works by letting system optimally manage the background processes. The OS keeps a tab on the motion detection sensor and if there is no activity for a long time, the system shuts down some processes.

According to Google, this feature has helped increase the standby-time on the Nexus 9 by almost two times over the Android 5.0 Lollipop.

USB Type C:

Android M will also support USB Type-C for charging. And considering USB Type-C is has a bi-directional port, you can use this port to either charge the phone as welll as charge another device.

App Linking:

Android M will let developers add in an auto-verify feature within their code, which will help open the link within the respective app (provided the app is installed on your phone). In the background, the Android M OS will verify the link with the app’s server and post-authentication will proceed to open the link within the app itself, without asking you where you want to open the link.

Direct Share and Floating Toolbar:

Direct Share can learn who you share content with frequently from different apps and turn the process into the press of a single button. With the floating toolbar, it'll also improve the way you can copy and paste content from web pages or documents.

RAM Manager:

There is a new and updated RAM Manager in the settings menu that lets the user see what the average amounts of RAM being used over a specific duration. The user can choose from 3 hours, 6 hours, 12 hours or one day. It also rates the performance and shows you the amount of free RAM. You can also view the applications and the amount of RAM they use in detail.

Thursday, 19 December 2013

How to start and stop service in android.

Here we see how to start and stop a service dynamically.

What is Service ?

A service is a
component which runs in the background without direct interaction with the
user. As the service has no user interface, it is not bound to the lifecycle of
an activity.

As there are two methods
by which we start and stop service :

startService (Intent service)

stopService (Intent service)

In order to start a service
we need to call a method name onStartCommand(Intent
intent, int flags, int startId)and to stop a service call a method name
onDestroy() . All this work we do in
class which extends Service class.

Create a project with
the following details :

·ProjectName: StartStopServicee

·PackageName: sat.tuts4mobile.startstop

·ActivityName: MainActivity

In the MainActivity.java file, copy the following code :

package
sat.tuts4mobile.startstop;

import
android.os.Bundle;

import
android.app.Activity;

import
android.content.Intent;

import
android.view.Menu;

import
android.view.View;

import
android.widget.Button;

public class
MainActivity extends Activity {

@Override

protected void onCreate(Bundle
savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.activity_main);

Button start = (Button)
findViewById(R.id.button1);

start.setOnClickListener(new
View.OnClickListener() {

@Override

public void
onClick(View v) {

//
TODO Auto-generated method stub

startService(new
Intent(MainActivity.this, MyService.class));

}

});

Button stop = (Button)
findViewById(R.id.button2);

stop.setOnClickListener(new
View.OnClickListener() {

@Override

public void
onClick(View v) {

//
TODO Auto-generated method stub

stopService(new
Intent(MainActivity.this, MyService.class));

}

});

}

@Override

public boolean
onCreateOptionsMenu(Menu menu) {

// Inflate the menu;
this adds items to the action bar if it is present.

getMenuInflater().inflate(R.menu.main,
menu);

return true;

}

}

Create a new class
name MyService.java file, copy the
following code :