Friday, August 29, 2014

Lost Phone Tracker

Hello Guys,
Please have a look at the link
https://play.google.com/store/apps/details?id=ind.kalai.lpt&hl=en



LPT (Lost Phone Tracker) will help you to track the information of the burglar in case of your mobile is stolen.
LPT will send message to the registered mobile numbers to whom the burglar information has to be sent. Message Details will contain the information of the newly inserted SIM - Phone Number, SIM ID, IMEI, current location of the burglar, etc...... Maximum of 3 recipient’s mobile number can be registered and all three will receive the burglar information.
LPT will also send e-mail messages to the registered Mail Id’s (Max. 2 e-mail Id’s can be registered). Mail Details contains the same information similar to the message details along with burglar’s photograph (applicable only for mobiles which has front camera).
Both messages and e-mails will be sent when the burglar tries to uninstall the application or while inserting a new SIM.

Saturday, January 25, 2014

Locate your Lost Device

Find Your Lost Android Device

Hi all, I hope this post will be helpful for you guys. Don't get Tensed if you have lost your device.Here is an tricky thing to locate your device.


Things to do

  • You should have your Google account  that has to be synced to your Android Device
  • The Lost device should be connected to network 
 Assume that you have kept your device somewhere and it is not connected to network.Go to the DeviceManager (Click on the reference link) . This  link will show you how many devices are synced with your Google account. Select the particular lost device from the list and there will be option to RING. The beauty of this is even if your phone is in silent it will RING.



 You can clearly see that my device is pointed with accurate location.

Check with your mobile device by putting it in silent mode


NOTE: 

This won't work if
  • Device is not connected with Network
  • Device is not synced with your Google account
 Hope you guys enjoyed this post.

  Reference https://support.google.com/accounts/answer/3265955?p=android_device_manager&rd=1



Thursday, September 19, 2013

Simple Tutorial for Fragments

Hey Folks, Let us learn a simple creation of Fragments.

Fragment is an independent component which can be used by an activity. A fragment encapsulate functionality so that it is easier to reuse within activities and layouts. 


Learn more from http://developer.android.com/guide/components/fragments.html 

Create xml for main view from layout folder
mainview.xml 

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:orientation="vertical" >

        <Button
            android:id="@+id/button1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:onClick="onClickFragment"
            android:text="Button1" />

        <Button
            android:id="@+id/button2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:onClick="onClickFragment"
            android:text="Button2" />

        <Button
            android:id="@+id/button3"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:onClick="onClickFragment"
            android:text="Button3" />
    </LinearLayout>

    <LinearLayout
        android:id="@+id/frg_container"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_weight="3"
        android:orientation="vertical" >
    </LinearLayout>

</LinearLayout>


Create xml from layout folder for fragments

fragment1.xml  
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Fragment 1"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>


fragment2.xml 
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Fragment 2"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>
 

fragment3.xml  
 <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/textView1"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Fragment 3"
        android:textAppearance="?android:attr/textAppearanceLarge" />

</LinearLayout>

 

Coding Part

Create MainActivity class from your Package name. 
 
This is the parent Activity which extends FragmentActivity

public class MainActivity extends FragmentActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        FragmentTransaction frgTrans = getSupportFragmentManager()
                .beginTransaction();
        FirstFragment firstFragment = new FirstFragment();
        frgTrans.add(R.id.frg_container, firstFragment);
        frgTrans.commit();
    }

    public void onClickFragment(View view) {

        Fragment newFragment;
        if (view == findViewById(R.id.button1)) {
            newFragment = new FirstFragment();

        } else if (view == findViewById(R.id.button2)) {
            newFragment = new SecondFragment();
        } else if (view == findViewById(R.id.button3)) {
            newFragment = new ThirdFragment();
        } else {
            newFragment = new FirstFragment();
        }
        FragmentTransaction newfrgTrans = getSupportFragmentManager()
                .beginTransaction();
        //newfrgTrans.setCustomAnimations(R.anim.pop_enter,R.anim.pop_exit); //you can also set animations
        newfrgTrans.replace(R.id.frg_container, newFragment);
        newfrgTrans.addToBackStack(null);
        newfrgTrans.commit();
    }



Create FirstFragment class:

public class FirstFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // TODO Auto-generated method stub

        return inflater.inflate(R.layout.fragment1, container, false);
    }

}


Create SecondFragment class:  


public class SecondFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        return inflater.inflate(R.layout.fragment2, container, false);
    }

}


Create ThirdFragment class: 


public class ThirdFragment extends Fragment {

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        return inflater.inflate(R.layout.fragment3, container, false);
    }

}















Monday, July 29, 2013

Changing the install location of Android Application

Hi all, Today we are going to learn how to change/modify the install location of Android Application without rooting your Android-device

Some of the Android Devices has no enough space(internal memory) to install the application from google play, so here we have tricky solution for that

Steps to Follow :
1.Download Android SDK 
2.Open Command prompt in ur windows(win+r,type cmd)
3.Type th path of platform-tools where SDK is installed (eg, C:\Users\Anu\android-sdks\platform-tools)
4.Enable the USB Debbuging (Goto Settings-Developer options-USB debugging) in your Device before connecting to the system

5.Now in windows type adb devices, you will get list of devices attached to your system


6.After getting list of devices, type adb shell and you will get $ symbol(Non Rooted or # symbol(Rooted) which is ready to execute your command

7.Type set pm setInstallLocation 2 or pm-set-Install-Location 2 

8.Exit & unplug your device and Enjoy by installing your apps to your external memory.






Wednesday, January 23, 2013

Identifying Outgoing call Phone Number Through our Application

How To Identify Outgoing call Phone Number Through our Application 



1. Use BroadcastReceiver.
2. Add Permission to Your Manifest File.


1.Add the following code 

public class OutgoingCallReceiver extends BroadcastReceiver {


   @Override
   public void onReceive(Context context, Intent intent) {
           Bundle bundle = intent.getExtras();

           if(null == bundle)
                   return;


           String phonenumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);

           Log.i("GetPhoneNumber",phonenumber);
          
           String outgoingNumber =  phonenumber;

           Toast.makeText(context, outgoingNumber , Toast.LENGTH_LONG).show();
   }
}

2.In your Manifest

<receiver android:name=".OutgoingCallReceiver" >
            <intent-filter>
                <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
            </intent-filter>
        </receiver>

Friday, November 16, 2012

How to download the images and to create folder to save it

 
Hi all, here we are going to learn how to view an image in ImageView that are in the form of URL and to download that image in our own created folder.
 
Here we are creating a folder to save an image in SDcard.
 
 
private class DownloadTask extends AsyncTask<String, Void, Void> {


private final ProgressDialog dialog = new ProgressDialog(ImageDownloaderActivity.this);


// can use UI thread here

protected void onPreExecute() {

this.dialog.setMessage("Loading...");

this.dialog.show();

}



// automatically done on worker thread (separate from UI thread)

protected Void doInBackground(final String... a) {


try {

Thread.sleep(100);

String url1 = imageUrls[position];

URL ulrn = new URL(url1);


HttpURLConnection con = (HttpURLConnection) ulrn

.openConnection();

InputStream is = con.getInputStream();

bmp = BitmapFactory.decodeStream(is);



int widthPx = getWindowManager().getDefaultDisplay().getWidth();

int heightPx = getWindowManager().getDefaultDisplay().getHeight();

bmp = Bitmap.createScaledBitmap(bmp, widthPx, heightPx, true);



} catch (InterruptedException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

 
catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return null;

}


// can use UI thread here

protected void onPostExecute(final Void unused) {


if (null != bmp) {

imageView.setImageBitmap(bmp);

}

 
else

System.out.println("The Bitmap is NULL");


File dir = new File(Environment.getExternalStorageDirectory() + "/Example/Wallpapers/");  //path of your own folder

File[] files = dir.listFiles();

if (files == null)

{

int numberOfImages = 0;

BitmapDrawable drawable = (BitmapDrawable) imageView.getDrawable();

Bitmap bitmap = drawable.getBitmap();

File sdCardDirectory = Environment.getExternalStorageDirectory();

new File(sdCardDirectory + "/Example/Wallpapers/").mkdirs();  //creating a folder

File image = new File(sdCardDirectory + "/Example/Wallpapers/Sample" + numberOfImages + ".JPG");          // naming your image as sample1,2,3,,..and saving it in created folder

boolean success = false;


FileOutputStream outStream;

try {

outStream = new FileOutputStream(image);

bitmap.compress(Bitmap.CompressFormat.JPEG, 100, outStream);

outStream.flush();

outStream.close();

success = true;

} catch (FileNotFoundException e) {

e.printStackTrace();

} catch (IOException e) {


e.printStackTrace();

}

if (success) {

Toast.makeText(getApplicationContext(),"Image saved successfully in Sdcard/Example/Wallpapers",Toast.LENGTH_LONG).show();

} else {

Toast.makeText( getApplicationContext(), "Error during image saving", Toast.LENGTH_LONG) .show();

}

}

}

Friday, November 9, 2012

How to store and retrieve the datas from existing SQLiteDB in Android

Hi everyone, here we are going to learn how to insert and fetch the data's from existing DB.

Place your existing DB in mnt/sdcard/YourFolder /Your.db
Here my DB name is XXX.db and the folder I have used is DBFolder.
This class is for DB.

public class SqliteAdapter extends Activity {

 private static final String TAG = "DatabaseHelper";
 public static final String DATABASE_FILE_PATH = "/sdcard/DBFolder";
 public static final String DATABASE_NAME = "XXX.db";
 private Context context;
 private SQLiteHelper sqLiteHelper;
 private static SQLiteDatabase database;
 static String myPath = DATABASE_FILE_PATH + File.separator + DATABASE_NAME;

 public SqliteAdapter(Context pcontext) {

  try {
   database = SQLiteDatabase.openDatabase(myPath, null,
     SQLiteDatabase.OPEN_READWRITE);
   context = pcontext;
  }
  catch (SQLiteException ex) {
   Log.e(TAG, "error -- " + ex.getMessage(), ex);
  } finally {
  }

 }

 public SqliteAdapter openToRead() throws android.database.SQLException {

  Log.i(TAG, "Open DB");
  sqLiteHelper = new SQLiteHelper(context, DATABASE_NAME, null, 1);
  database = SQLiteDatabase.openDatabase(myPath, null,
    SQLiteDatabase.OPEN_READWRITE);
  return this;

 }

 public SqliteAdapter openToWrite() throws android.database.SQLException {

  Log.i(TAG, "Open DB");
  sqLiteHelper = new SQLiteHelper(context, DATABASE_NAME, null, 1);
  database = SQLiteDatabase.openDatabase(myPath, null,
    SQLiteDatabase.OPEN_READWRITE);
  return this;

 }

 public void close() {

  sqLiteHelper.close();

 }


 public Cursor executeSQLQuery(String sql, String[] selectionArgs) {

  Log.i(TAG, "Open DB");
  sqLiteHelper = new SQLiteHelper(context, DATABASE_NAME, null, 1);
  database = SQLiteDatabase.openDatabase(myPath, null,
    SQLiteDatabase.OPEN_READWRITE);
  Cursor cursor = database.rawQuery(sql, selectionArgs);
  Log.i("DataBaseHelper", "executeSQLQuery cursor " + cursor.getCount());
  database.close();
  return cursor;

 }

 public class SQLiteHelper extends SQLiteOpenHelper {

  public SQLiteHelper(Context context, String name,
    CursorFactory factory, int version) {
   super(context, name, factory, version);

  }

  @Override
  public void onCreate(SQLiteDatabase db) {

   // TODO Auto-generated method stub
   db.execSQL(DATABASE_NAME);

  }

  @Override
  public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
   // TODO Auto-generated method stub
  }
 }
}

Access the DB class through your main class/Activity

public static final String DATABASE_FILE_PATH = "/sdcard/DBFolder";

public static final String DATABASE_NAME = "XXX.db";

static String myPath = DATABASE_FILE_PATH + File.separator + DATABASE_NAME;

SqliteAdapter mySQLiteAdapter;   //object of DB class

SQLiteHelper sqLiteHelper;



For Inserting the data's in Existing DB:

 
SQLiteDatabase db = SQLiteDatabase.openDatabase(myPath,null, SQLiteDatabase.OPEN_READWRITE); 
String sqlQuery = "insert into tableA (bundle,subject) values (a,b)";

db.execSQL(sqlQuery ); 



To Select/Retrieve data's from DB:

mySQLiteAdapter = new SqliteAdapter(this);

mySQLiteAdapter.openToRead();

mySQLiteAdapter.openToWrite();


Cursor cursor = mySQLiteAdapter.executeSQLQuery(
"select COUNT(*) as Value from tableA where TRIM(UPPER(bundle)) =TRIM(UPPER('"
+ value.trim() + "'))", null);



To Update the Data's:

SQLiteDatabase db=SQLiteDatabase .openDatabase(myPath, null, SQLiteDatabase.OPEN_READWRITE);

String updateSql="UPDATE table_B SET logged_in_status=0";

db.execSQL(updateSql);