Total Pageviews

Monday 7 October 2013

Broadcast reciever using apps launch by dial number


Hello guys this is Broad cast receiver for hide application from menu
With The help of this  below code your application can be launch from dial no from key-pad
In this I set  5624 no from calling on this no my application will launch
This is my MainActivity

package com.example.hideapps;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

public class MainActivity extends BroadcastReceiver {
private static final String TAG = "secrete code";
public void onReceive(Context context, Intent intent) {
// TODO Auto-generated method stub
if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) {
String phoneNumber = intent.getExtras().getString(Intent.EXTRA_PHONE_NUMBER );
Log.i(TAG , "Received Outgoing Call");
String cum_number="5624";
if(phoneNumber.equals(cum_number)) {

Intent intent1 = new Intent(context , SpashActivity.class);
Log.i(TAG , "Starting ShaDoW Main Activity");
intent1.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK );
context.startActivity(intent1);
setResultData(null);
abortBroadcast();
                            }
}
}
}

There is some change in manifest
 <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.hideapps"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <uses-permission android:name="android.permission.CALL_PHONE" />
    <uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
    <uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.hideapps.SpashActivity"
            android:label="@string/title_activity_spash" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
            </intent-filter>
        </activity>
       <receiver android:name="com.example.hideapps.MainActivity" >
            <intent-filter android:priority="0" >
                <action android:name="android.intent.ACTION.DIAL" />
                <action android:name="android.intent.action.NEW_OUTGOING_CALL" />
            </intent-filter>
        </receiver>
  </application>

</manifest>

at the place of SplashActivity U can your firstactivity


thanks to read my blog
one more important and good tutorial for folder fetching from sdcard in our application
.http://rajeshvijayakumar.blogspot.in/search/label/file%20explorer