Posts

Showing posts from May, 2016
Android Get IP Address Android application for fetching network IP address of the android device Create new android project and add below code changes on MainActivity.java  Source SVN: Android IP Address  Zipped Source : IPAddressDisplay.zip package com . javaorigin . ipdisplay ; import java . net . InetAddress ; import java . net . NetworkInterface ; import java . util . Enumeration ; import android . app . Activity ; import android . os . Bundle ; import android . util . Log ; import android . widget . TextView ; public class MainActivity extends Activity { @Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ); setContentView ( R . layout . activity_main ); try { for ( Enumeration en = NetworkInterface . getNetworkInterfaces (); en . hasMoreElements ();) { NetworkInterface intf = en . nextElement (); for ( Enumeration enumIpAddr = intf . ge
Android Notification LED sample Note : You should lock(screen) the phone before run this project(via android IDE) , because notification LED will be highlighted only when screen is off Source SVN: LEDNotification   Zipped Source : LEDNotification   public class LEDNotification extends Activity { @Override protected void onCreate ( Bundle savedInstanceState ) { super . onCreate ( savedInstanceState ); setContentView ( R . layout . activity_main ); NotificationManager notif = ( NotificationManager ) getSystemService ( Context . NOTIFICATION_SERVICE ); for ( int i = 0 ; i < 8 ; i ++) { notif . cancel ( 1 ); // clear previous notification final Notification notification = new Notification (); if ( i == 0 ){ notification . ledARGB = Color . MAGENTA ; } else if ( i == 1 ){ notification . ledARGB = Color . BLUE ; } else if ( i == 2 ){ notification . ledARGB = Color . CYAN ; } else if (
Blocking Incoming call - Android Step 1: Create Broadcast receiver class for incoming call package com . javaorigin . android . sample ; import java . lang . reflect . Method ; import com . android . internal . telephony . ITelephony ; import android . content . BroadcastReceiver ; import android . content . Context ; import android . content . Intent import android . telephony . TelephonyManager ; import android . util . Log ; public class PhoneCallReceiver extends BroadcastReceiver { Context context = null ; private static final String TAG = "Phone call" ; private ITelephony telephonyService ; @Override public void onReceive ( Context context , Intent intent ) { Log . v ( TAG , "Receving...." ); TelephonyManager telephony = ( TelephonyManager ) context . getSystemService ( Context . TELEPHONY_SERVICE ); try { Class c = Class . forName ( telephony . getClass (). getName ()); Metho