Jumat, 28 November 2014

Building a Widget to Silence a Phone

    One of the key parts of Android is the ability to customize your experience through components like widgets. In this tutorial I will go over creating a widget to silence a phone with one click, and in Lollipop (at least with the Nexus 4) it will place the phone into priority mode and silence the ringer, allowing the user to still get their notifications without a vibration. All code for this app can be found on GitHub.


    The first thing we're going to want to do is set up our manifest. Under the applications node, we'll add a receiver and service.

 <receiver android:name=".SilenceRingerWidget">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/silence_ringer_widget" />
</receiver>

<service android:name=".SilenceRingerService" />

    SilenceRingerService is responsible for the actual background work that our widget performs. The receiver is an extension of AppWidgetProvider, which is a special extension of BroadcastReceiver for app widgets. This allows it to be set to listen for APPWIDGET_UPDATE from the system. The meta-data provided is an appwidget-provider xml file that simply sets the layout for the widget, refresh rate and size.

<?xml version="1.0" encoding="utf-8"?>
<appwidget-provider
xmlns:android="http://schemas.android.com/apk/res/android"
android:minWidth="40dp"
android:minHeight="40dp"
android:updatePeriodMillis="0"
android:initialLayout="@layout/widget_silence_ringer"/>

    The only other additions we need to make to our manifest is to set the permissions that our widget will need in order to silence the phone.

 <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />

    SilenceRingerWidget only has one method in this example, onUpdate, which is called when the widget is placed on the home screen and when the widget updates (which, in this case, won't happen since the updatePeriodMillis is set to 0 in silence_ringer_widget.xml). This method starts up the background service that builds the widget and silences the device.

@Override
public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
context.startService(new Intent(context, SilenceRingerService.class));
}

    SilenceRingerService is where the bulk of this widget is handled. onStartCommand silences the phone, builds the remote view and then kills the service until the widget button is pressed again.

@Override
public int onStartCommand(Intent intent, int flags, int startId) {

silencePhone();
RemoteViews views = buildViews();
updateWidget( views );

stopSelf();
return START_NOT_STICKY;
}

    silencePhone() uses the AudioManager to silence the device, and because of Lollipop we also include a thread that starts up after a second and does the same action a second time, because Lollipop first places the device into Priority mode without silencing the device, then silences the ringer after the second setRingerMode call.

private void silencePhone() {
setPriorityAndSilence();
new Thread( new Runnable() {
@Override
public void run() {
try {
Thread.sleep( 1000 );
} catch( InterruptedException e ) {

}

setPriorityAndSilence();

}
} ).run();
}

private void setPriorityAndSilence() {
AudioManager audioManager;
audioManager = (AudioManager) getBaseContext().getSystemService( Context.AUDIO_SERVICE );
audioManager.setRingerMode( AudioManager.RINGER_MODE_SILENT );
}

    The last part of onStartCommand that we need to look at has to do with RemoteViews. We simply grab the button from our layout file and set a pending intent to it that will start up SilenceRingerService again, and associate it with our widget.

private RemoteViews buildViews() {
RemoteViews views = new RemoteViews( getPackageName(), R.layout.widget_silence_ringer );
PendingIntent silenceIntent = PendingIntent.getService( this, 0, new Intent( this, SilenceRingerService.class ), 0 );
views.setOnClickPendingIntent( R.id.button_silence, silenceIntent );
return views;
}

private void updateWidget( RemoteViews views ) {
AppWidgetManager manager = AppWidgetManager.getInstance( this );
ComponentName widget = new ComponentName( this, SilenceRingerWidget.class );
manager.updateAppWidget( widget, views );
}

    Now we have a simple widget put together that can be expanded on to fit other situations that may come up for you as a developer. Enjoy!



Read More..

Senin, 24 November 2014

Odia Santa Banta

One & Only Santa Banta Page of #Odisha,Thare like kari dekhantu asakare apana nku nischaya bhala lagiba...
http://www.odiasantabanta.in/
Description
Odisha ro eko matra Odia Santa Banta Android Apps
Ehi Android Apps ro udyeso khali apono nku tike haseiba .....
Dhanyabad


Odia Santa Banta - screenshot thumbnailCover art Odia Santa Banta - screenshot thumbnail












Read More..

Oriya Pride Oriya Editor

Oriya Editor is a helpful tool to write in Oriya and update your status, prepare notes in Oriya.
The good thing is it uses your english keyboard and automatically converts your english to Oriya.
In a way its Oriya Keyboard in your English Keyboard.
The words are converted to Oriya after hitting space. Maja Karo.
1. Write in Oriya using English Keyboard and use it like Oriya Keyboard
2. Copy the message to post it somewhere.
3. Share message on social network or on SMS
Note : The App fonts are not supported in Sony Xperia and Micromax Canvas Series device
Coming soon with Notepad app to save notes in Oriya :-)
This is better than any Oriya IME Input Method Editor (IME)
Oriya Pride is part of Indian Pride group of Apps


Oriya Pride Oriya Editor - screenshot thumbnailCover art











Read More..
Odinglish - Oriya in English editor allows to to type Oriya words in English.
Once you have typed you can share it via Twitter, Email and other supporting apps. You also can copy and paste it into any apps of your choice.
Keymap and live keymap support provided.
NOTE: Disable auto suggest/predictive text in keyboard setting to get accurate conversion.









































Cover artOdinglish - Type In Oriya - screenshot thumbnailOdinglish - Type In Oriya - screenshot thumbnail








Read More..

Odia Recipes ANDROID APP FREE DOWNLOAD

Odia Recipes App is an application under Android platform which provide our odia food recipes.
Cuttack Puri, Bhubaneswar, east India, fish curry, chicken curry all favorite foods of odisha (orissa).
 
Cover art 
Odia Recipes - screenshot thumbnailOdia Recipes - screenshot thumbnailOdia Recipes - screenshot thumbnail 
 
 





Read More..

Odia video app by fullodisha.com
You can watch Odia Comedy Videos, Odia video songs, odia film videos, Odia trailers and odia full movies
Oriya video app, oriya movie app, oriya films
Cover art




Odia Videos - fullorissa - screenshot thumbnailOdia Videos - fullorissa - screenshot thumbnailOdia Videos - fullorissa - screenshot thumbnail








Read More..

Minggu, 23 November 2014

Oriya Android app free download

A Micromax - Funbook Tablet only touch keyboard for Oriya using unicode with a unique layout which could be learnt and operated even by a person who is new to touch devices in under 1 minutes.
Features
- You have to type in the same sequence as you write it on paper. Anyone who has written oriya can use this application in under one minute.
- You can make the oriya text posted in Twitter, Facebook, Email.
Additionally dictionary, custom words and autocompletion will be available in coming weeks.

Oriya - screenshot thumbnail



DOWNLOAD
Read More..