Selasa, 28 Oktober 2014

     Android Lollipop has brought with it many new features, one of which is lock screen notifications. Up until this point, lock screen media controls had to be implemented through the use of a RemoteView, and media control notifications had to be built with custom views. In this tutorial I will go over using the new MediaStyle for notifications and interacting with a MediaSession for controlling media playback states. All code for this tutorial can be found on GitHub.


    The very first thing that we're going to need to do is set the MEDIA_CONTENT_CONTROL permission in AndroidManifest.xml. This will allow us to use our lock screen notification to control media.

 <permission android:name="android.permission.MEDIA_CONTENT_CONTROL" />

    For this example we're going to use a background service to controls our media and build/interact with the new notifications. Our MainActivity is going to be very straight forward and simply start our service with an action telling the service to build a playing state notification

 Intent intent = new Intent( getApplicationContext(), MediaPlayerService.class );
intent.setAction( MediaPlayerService.ACTION_PLAY );
startService( intent );

    Next we're going to want to start fleshing out MediaPlayerService. At the top of the class we're going to define a set of strings that we will use to implement notification actions, and also define the objects that we'll use throughout the class.

 public static final String ACTION_PLAY = "action_play";
public static final String ACTION_PAUSE = "action_pause";
public static final String ACTION_REWIND = "action_rewind";
public static final String ACTION_FAST_FORWARD = "action_fast_foward";
public static final String ACTION_NEXT = "action_next";
public static final String ACTION_PREVIOUS = "action_previous";
public static final String ACTION_STOP = "action_stop";

private MediaPlayer mMediaPlayer;
private MediaSessionManager mManager;
private MediaSession mSession;
private MediaController mController;

   When the service receives an intent, it'll immediately go through onStartCommand. This method only does two simple things: if our objects have not been initialized, it'll call initMediaSession to set them up, and then the intent will be passed to handleIntent.

    initMediaSession initializes the objects that we defined earlier. MediaPlayer handles media playback (not used in this example, but in an actual app it would be), the MediaSessionManager helps maintain the MediaSession, MediaSession is used for keeping track of media states, and the MediaController handles transitioning between media states and calling MediaPlayer methods.

 mMediaPlayer = new MediaPlayer();
mManager = (MediaSessionManager) getSystemService(Context.MEDIA_SESSION_SERVICE);
mSession = mManager.createSession("sample session");
mController = MediaController.fromToken( mSession.getSessionToken() );

    The next thing initMediaSession does is add TransportControlCallbacks that we can call in order to control the MediaPlayer and display new notifications.

 mSession.addTransportControlsCallback( new MediaSession.TransportControlsCallback() {
@Override
public void onPlay() {
super.onPlay();
Log.e( "MediaPlayerService", "onPlay");
buildNotification( generateAction( android.R.drawable.ic_media_pause, "Pause", ACTION_PAUSE ) );
}

@Override
public void onPause() {
super.onPause();
Log.e( "MediaPlayerService", "onPause");
buildNotification(generateAction(android.R.drawable.ic_media_play, "Play", ACTION_PLAY));
}

@Override
public void onSkipToNext() {
super.onSkipToNext();
Log.e( "MediaPlayerService", "onSkipToNext");
//Change media here
buildNotification( generateAction( android.R.drawable.ic_media_pause, "Pause", ACTION_PAUSE ) );
}

@Override
public void onSkipToPrevious() {
super.onSkipToPrevious();
Log.e( "MediaPlayerService", "onSkipToPrevious");
//Change media here
buildNotification( generateAction( android.R.drawable.ic_media_pause, "Pause", ACTION_PAUSE ) );
}

@Override
public void onFastForward() {
super.onFastForward();
Log.e( "MediaPlayerService", "onFastForward");
//Manipulate current media here
}

@Override
public void onRewind() {
super.onRewind();
Log.e( "MediaPlayerService", "onRewind");
//Manipulate current media here
}

@Override
public void onStop() {
super.onStop();
Log.e( "MediaPlayerService", "onStop");
//Stop media player here
NotificationManager notificationManager = (NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel( 1 );
Intent intent = new Intent( getApplicationContext(), MediaPlayerService.class );
stopService( intent );
}

@Override
public void onSeekTo(long pos) {
super.onSeekTo(pos);
}

@Override
public void onSetRating(Rating rating) {
super.onSetRating(rating);
}
});

    These control methods are called in handleIntent. When an intent is received by the service, handleIntent extracts the action associated with that intent to determine which transport control method should be called

 private void handleIntent( Intent intent ) {
if( intent == null || intent.getAction() == null )
return;

String action = intent.getAction();

if( action.equalsIgnoreCase( ACTION_PLAY ) ) {
mController.getTransportControls().play();
} else if( action.equalsIgnoreCase( ACTION_PAUSE ) ) {
mController.getTransportControls().pause();
} else if( action.equalsIgnoreCase( ACTION_FAST_FORWARD ) ) {
mController.getTransportControls().fastForward();
} else if( action.equalsIgnoreCase( ACTION_REWIND ) ) {
mController.getTransportControls().rewind();
} else if( action.equalsIgnoreCase( ACTION_PREVIOUS ) ) {
mController.getTransportControls().skipToPrevious();
} else if( action.equalsIgnoreCase( ACTION_NEXT ) ) {
mController.getTransportControls().skipToNext();
} else if( action.equalsIgnoreCase( ACTION_STOP ) ) {
mController.getTransportControls().stop();
}
}

    As can be seen in the TransportControlCallbacks, we call buildNotification with another method called generateAction. Actions are used by the MediaStyle notification to populate the buttons at the bottom of the notification and launch intents when pressed. generateAction simply accepts the icon that the notification will use for that button, a title for the button and a string that will be used as the action identifier in handleIntent. With this information, generateAction is able to construct a pendingIntent before assigning it to an action that is then returned.

 private Notification.Action generateAction( int icon, String title, String intentAction ) {
Intent intent = new Intent( getApplicationContext(), MediaPlayerService.class );
intent.setAction( intentAction );
PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 1, intent, 0);
return new Notification.Action.Builder( icon, title, pendingIntent ).build();
}

    buildNotification is where we actually implement the MediaStyle notification. The first thing we do is create a new Notification.MediaStyle style, then start building the rest of the notification through using Notification.Builder. This notification simply contains a pendingIntent that would stop our media when the notification is dismissed, a title, content text, a small icon and the style.

private void buildNotification( Notification.Action action ) {
Notification.MediaStyle style = new Notification.MediaStyle();

Intent intent = new Intent( getApplicationContext(), MediaPlayerService.class );
intent.setAction( ACTION_STOP );
PendingIntent pendingIntent = PendingIntent.getService(getApplicationContext(), 1, intent, 0);
Notification.Builder builder = new Notification.Builder( this )
.setSmallIcon( R.drawable.ic_launcher )
.setContentTitle( "Media Title" )
.setContentText( "Media Artist" )
.setDeleteIntent( pendingIntent )
.setStyle( style );

    Next we can add our buttons to the notification through the use of Builder.addAction. It should be noted that MediaStyle notifications only support up to five different actions. Each of our actions will be generated through the generateAction method described above.

 builder.addAction( generateAction( android.R.drawable.ic_media_previous, "Previous", ACTION_PREVIOUS ) );
builder.addAction( generateAction( android.R.drawable.ic_media_rew, "Rewind", ACTION_REWIND ) );
builder.addAction( action );
builder.addAction( generateAction( android.R.drawable.ic_media_ff, "Fast Foward", ACTION_FAST_FORWARD ) );
builder.addAction( generateAction( android.R.drawable.ic_media_next, "Next", ACTION_NEXT ) );

    The last thing this method does is actually construct the notification and post it to the system

 NotificationManager notificationManager = (NotificationManager) getSystemService( Context.NOTIFICATION_SERVICE );
notificationManager.notify( 1, builder.build() );

    Now that the notification and sessions are implementing and working, the final thing we need to take into account is releasing our MediaSession once the media player and service have been stopped.

 @Override
public boolean onUnbind(Intent intent) {
mSession.release();
return super.onUnbind(intent);
}

    And with that we now have a fully working MediaStyle notification on our lock screen and in the notification drawer that takes advantage of MediaSession for playback control. Enjoy!
Read More..

Senin, 20 Oktober 2014

Download Android App Field Trip

Field Trip

Field Trip is your guide to the cool, hidden, and unique things in the world around you. Field Trip runs in the background on your phone. When you get close to something interesting, it pops up a card with details about the location. No click is required. If you have a headset or bluetooth connected, it can even read the info to you.
Field Trip-1 Field Trip-2

Field Trip can help you learn about everything from local history to the latest and best places to shop, eat, and have fun. You select the local feeds you like and the information pops up on your phone automatically, as you walk next to those places.
The hyperlocal history experts of Arcadia and Historvius will unveil local lore in places you never expected. Trend-setting publications like TimeOut, Thrillist, Spotted by Locals, Zagat, and Eater will point out the best places to eat and drink. Experts at Sunset, Cool Hunting, WeHeart, Inhabitat, and Remodelista will guide you to the latest unique stores and products. Atlas Obscura, Dezeen and Spotted by Locals help you uncover hidden gems no matter where you are. Songkick and Flavorpill guide you to local music.
What did you discover today? Enrich yourself with a Field trip during your commute. Live like a local when you travel to new places. Eat and shop off the beaten path. Or simply discover the obscure history about your neighborhood during your next walk to the park.
Get ready to see this world with new eyes!
NOTE: This app is optimized for smartphones, not tablets.
Highlights:
. Discover thousands of interesting places/experiences that fall under the following categories: Architecture, Historic Places & Events, Lifestyle, Offers & Deals, Food Drinks & Fun, Movie Locations, Outdoor Art and Obscure Places of Interest around you.
. Choose from three different modes to set frequency of Field Trip notifications. See �Field Trip� worthy places around you on a map, by tapping on cards in map view to pull up enthralling points of interest around you.
. Go on a Field Trip while you drive. Field Trip can detect when you�re driving and automatically �talk� about interesting places and experience around you.
. Came across an amazing story or restaurant? Mark it as a favorite to easily come back to it at any point.
. Capture the memory of a special place, by sharing a wondrous discovery through email and social networks such as Google+, Twitter and Facebook.
. Wondering where the gem that you recently discovered is? Find your discovered field trip cards in the �recent� section.
For more information about how to use Field Trip, visit our help center at : support.google.com/fieldtrip
Size : 4.5M
Current Version : 1.22
Requires Android : 2.3 and up
Download




CLICK TO MORE
Read More..

Download Android app Launcher Manager

Launcher Manager

 Launcher manager is the simplest tool to manage multiple launchers.
You can switch between the launchers and uninstall them using the icon to right of the launcher info.

Launcher Manager App

This is open source application: bitbucket.org/RankoR/launcher-manager
Size : 945k
Current Version : 1.2
Requires Android : 2.2 and up
Download



CLICK TO MORE
Read More..

Fast Clean � Speed Up&Boost

 This garbage cleaning tool was chosen by million people of twelve countries, It can make the cell phone process swifter, more clear and efficient, it can also improve the phone property if you use it everyday.
Since Fast Clean burned in 2010, it has been stand steadily in top 50 of the electric market, and top 10 of the tools. It was loved by the users on the clean, simple and easy used, very small internal memory.

Fast-Clean-Speed-Up&Boost-1 Fast-Clean-Speed-Up&Boost-2

It can scan the kinds of garbage of the cell phone, and clean away the trail of the search and browser by the unique clean system, and it just need a softly click and the garbage will be all gone and nothing left.
Reasons to choose us:
1.Compact and Convenient
Our APK is only less than 2MB, saving your Android device�s RAM and storage.
2.Great clean effect
Our abundant Junk database contains thousands of APPs. Efficient and Fast.
3.Speed Up
we can terminate useless process and accelerate your Android device for more than 30%.
4.Privacy protection
Scanning and Cleaning SMS, call, browse history and some other privacy information.
Size : 983k
Current Version : 3.1.0
Requires Android : 2.1 and up
Download



CLICK TO MORE
Read More..

AmbientTime Live Wallpaper

 A cool Live Wallpaper released by Sony Mobile Communications.
AmbientTime Live Wallpaper is a Live Wallpaper which consist of easy-to-see time expression and smoothly animating objects.

AmbientTime Live Wallpaper-1 AmbientTime Live Wallpaper-2

Size : 263k
Current Version : 1.2.11
Requires Android : 2.1 and up
Download



CLICK TO MORE
Read More..

Download Android app Maps 3D and Navigation

Maps 3D and Navigation

We are extremely pleased to introduce live 3D maps android app for you that help you know about the live satellite maps right through your android phone in fraction of seconds, anywhere you stay and at any point of time you need.
Maps 3D and navigation-1 Maps 3D and navigation-2

Following are some of the great features of this app:
� Deroutes optimized for car, bicycle and pedestrian.
� Simple Routes: Press and hold on the map to generate route.
� Satellite GPS navigation and WiFi.
� Map rotates in the driving direction.
� Travel goods and photos.
� Find addresses.
� All shops, bars, gas stations, etc.
Size : 1.3M
Current Version : 1.4
Requires Android : 2.3 and up
Download



Read More..

Jumat, 17 Oktober 2014

A Guide to the Android Wear Message API

I originally wrote this post for the good folks over at Binpress.com

While Android Wear provides a lot of great features, such as notifications, out of the box, its real potential lies in the ability to create native apps that communicate with a paired smartphone. Luckily, Android Wear comes with a few new APIs to help make this communication a lot smoother for developers: the Message API, Node API and DataLayer API. Each of these has their own unique purpose; the Message API is designed for "fire and forget it" types of messages, the DataLayer API supports syncing data between a smartphone and a wearable, and the Node API handles events related to local and connected device nodes.

For this tutorial I'll cover using the Message API to send data from a smartphone to an Android Wear device. We'll start a watch activity by using a WearableListenerService and display text in a ListView through the MessageApi.MessageListener interface, though all three APIs are used in a similar way. All sample code for this tutorial can be found on GitHub.

To start, create a project in Android Studio that has both a mobile and wear module:


Once your project and modules are created, you can start building the mobile side of your application. The sample project contains simple ListView, EditText and Button views that allow the user to enter text and, when the Button is pressed, display it in the ListView while also sending that text to the wearable.


To start, open AndroidManifest.xml in the mobile module and add a meta-data tag for Google Play Services

<meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />

Next, we can focus on the mobile MainActivity class. The first thing we need to do is connect the GoogleApiClient and implement the GoogleApiClient.ConnectionCallbacks interface:

private void initGoogleApiClient() {
mApiClient = new GoogleApiClient.Builder( this )
.addApi( Wearable.API )
.addConnectionCallbacks( this )
.build();

if( mApiClient != null && !( mApiClient.isConnected() || mApiClient.isConnecting() ) )
mApiClient.connect();
}

When the GoogleApiClient has finished connecting, onConnected will be called. When it is, we'll send a message through the Message API to a WearableListenerService (implemented later in this tutorial) running on the Wear in order to start our watch activity.

@Override
public void onConnected(Bundle bundle) {
sendMessage( START_ACTIVITY, "" );
}

...where START_ACTIVITY is a string value that must begin with /, denoting a message path.

private static final String START_ACTIVITY = "/start_activity";

Aside from our initial message, we also want a message to be sent when our 'send' button is pressed. This is done through a simple OnClickListener that uses a different path value of /message and sends the text present in the EditText at the bottom of the screen.

mSendButton.setOnClickListener( new View.OnClickListener() {
@Override
public void onClick(View view) {
String text = mEditText.getText().toString();
if (!TextUtils.isEmpty(text)) {
mAdapter.add(text);
mAdapter.notifyDataSetChanged();

sendMessage(WEAR_MESSAGE_PATH, text);
}
}
});

The sendMessage method is where we really start to see how we interact with the new Android Wear APIs. In order to send a message to the Wear, we must first use the Node API to get a list of nodes connected to the device. Once we have this list, we send a message to each node using MessageAPI with references to the GoogleApiClient, node ID, the path used to determine the type of message being sent, and the message payload as a byte array. A MessageApi.SendMessageResult is returned that can be used to determine if a message was successfully sent to the current node. Once the message is sent, we clear the EditText view to allow the user to enter more text.

private void sendMessage( final String path, final String text ) {
new Thread( new Runnable() {
@Override
public void run() {
NodeApi.GetConnectedNodesResult nodes = Wearable.NodeApi.getConnectedNodes( mApiClient ).await();
for(Node node : nodes.getNodes()) {
MessageApi.SendMessageResult result = Wearable.MessageApi.sendMessage(
mApiClient, node.getId(), path, text.getBytes() ).await();
}

runOnUiThread( new Runnable() {
@Override
public void run() {
mEditText.setText( "" );
}
});
}
}).start();
}


Finally in onDestroy, we need to disconnect from GoogleApiClient.

@Override
protected void onDestroy() {
super.onDestroy();
mApiClient.disconnect();
}


Now that the mobile MainActivity is ready, it's time to move into the wear module. First we'll want to create a class that extends from WearableListenerService, which is a service that implements the three Wear communication APIs. For our purposes we only need to override the onMessageReceived method. In this method we check the path that was sent over the MessageApi to determine the type of message, and then, if appropriate, fire off an intent to our wear MainActivity to bring our application to the forefront.

private static final String START_ACTIVITY = "/start_activity";

@Override
public void onMessageReceived(MessageEvent messageEvent) {
if( messageEvent.getPath().equalsIgnoreCase( START_ACTIVITY ) ) {
Intent intent = new Intent( this, MainActivity.class );
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
startActivity( intent );
} else {
super.onMessageReceived(messageEvent);
}
}

Once we're done implementing our service, we need to add it into the wear AndroidManifest.xml file.

<service android:name=".WearMessageListenerService">
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>

As mentioned earlier, there are two ways to receive a message on Android Wear. The next way is implementing MessageApi.MessageListener in our Wear MainActivity. To start, we need to connect GoogleApiClient in the same way as our mobile application. In the onConnected callback, we add our wearable listener to the api client

@Override
public void onConnected(Bundle bundle) {
Wearable.MessageApi.addListener( mApiClient, this );
}


Next, we simply override the onMessageReceived method from the MessageListener interface, check the path value to determine if we want to take action, and then add the payload text to our adapter to display the text in our wear ListView

@Override
public void onMessageReceived( final MessageEvent messageEvent ) {
runOnUiThread( new Runnable() {
@Override
public void run() {
if( messageEvent.getPath().equalsIgnoreCase( WEAR_MESSAGE_PATH ) ) {
mAdapter.add(new String(messageEvent.getData()));
mAdapter.notifyDataSetChanged();
}
}
});
}

This will display the text from our mobile app on the wearable, as seen below (the screen shot was taken from a Moto 360, hence the cut off portion at the bottom).

And with that we now have a working communication channel from a smartphone to a paired Android Wear device. I hope this tutorial helps you build your own applications. Good luck!

Read More..

Kamis, 16 Oktober 2014

Cricket Live TV Android App free Download

Description
Watch live Cricket streams on your handy for FREE in your AndroidThe app will also inform you if there are great matches are coming up.
All great leagues are included:
Caribbean Premier League
Big Bash League
Champions League Twenty20
Indian Premier League
and a lot more.

http://www.bibhutv.com/Application/Muna/Live_Cricket_TV.apk

Some of the included teams you can watch live:
India
Australia
Sri Lanka
South Africa
more!












And my other TV application


http://www.bibhutv.com/Application/Muna/Live_Indian_TV.apk
CLICK TO MORE
Read More..

Indian Live TV Andorid app Download


Watch your favorite TV channels Live in your mobile phone with this free Android application on your Android device.

Watch streaming 2G/3G Indian TV Channels free on your Phone for free from across the world. �2G/3G Indian TV� app shows you the way to see Live TV on mobile. Enjoy watching Online TV for free.Key Features:







------------------
[?] No need to have �Adobe Flash Player�
[?] No sign-up required
[?] 100% working...
[?] Streams the Live Tv Channel in your default video player like "MX Player, Wonder Share"
[?] More than 180 Indian TV channels
This app provides links for FREE Live streaming of 2G Indian TV. You can enjoy viewing your favorite � Hindi TV channels,  Music,  Movies,  Sports, Kids,  Infotainment,  News,  Regional,  Odia, ,  Malayalam,  Bangla, Tamil, Telugu,  Kannada, NEWS, Movies, Talk shows, Cartoons,and much more on your Android Phone.
It is just fun watching TV on your Android based phone or tablet.



 http://www.bibhutv.com/Application/Muna/Live_Indian_TV.apk






And other Live TV application










http://www.bibhutv.com/Application/Muna/Live_Cricket_TV.apk

CLICK TO MORE
Read More..