Get SMS message in anroid
Help me ! i get an error when effort receive SMS Message...

SMSReceiveService class: (call SMSReceive class)

    public class SMSReceiveService extends Service{
	private static final String ACTION = "android.provider.Telephony.SMS_RECEIVED";
	SMSReceive receive;
	@Override
	public IBinder onBind(Intent intent) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public void onCreate() {
		// TODO Auto-generated method stub
		super.onCreate();
		final IntentFilter fliter = new IntentFilter();
		fliter.addAction(ACTION);
		receive = new SMSReceive();
		this.registerReceiver(receive, fliter);
	}
	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		this.unregisterReceiver(receive);
	}

}

SMSReceive class :

    public class SMSReceive extends BroadcastReceiver{
	StoreFile fileIO;
	int progress;
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub		
		/*try {
			FloCareActivity.increaseValue(true);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		fileIO = new StoreFile();
		String strProgress = fileIO.ReadFile("nthdata.txt");
		progress = Integer.parseInt(strProgress);
		progress += 500;
		fileIO.WriteFile("nthdata.txt", progress + "");
				
	}

}

Logcat :

   

     07-05 12:05:11.107: W/dalvikvm(8860): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
    07-05 12:05:11.107: E/AndroidRuntime(8860): Uncaught handler: thread main exiting due to uncaught exception
    07-05 12:05:11.227: E/AndroidRuntime(8860): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.provider.Telephony.SMS_RECEIVED (has extras) } in nth.flocare.demo.SMSReceive@43954dd8
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:716)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.os.Handler.handleCallback(Handler.java:587)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.os.Handler.dispatchMessage(Handler.java:92)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.os.Looper.loop(Looper.java:123)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.app.ActivityThread.main(ActivityThread.java:4203)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at java.lang.reflect.Method.invokeNative(Native Method)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at java.lang.reflect.Method.invoke(Method.java:521)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at dalvik.system.NativeStart.main(Native Method)
    07-05 12:05:11.227: E/AndroidRuntime(8860): Caused by: java.lang.NumberFormatException: unable to parse 'null' as integer
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at java.lang.Integer.parseInt(Integer.java:358)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at java.lang.Integer.parseInt(Integer.java:333)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at nth.flocare.demo.SMSReceive.onReceive(SMSReceive.java:22)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:705)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	... 9 more

Androidmanifest.xml :

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="nth.flocare.demo"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-sdk android:minSdkVersion="4" />
    	<uses-permission android:name="android.permission.RECEIVE_SMS" ></uses-permission>
    	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    	<uses-permission  android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
        <application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name" >
            <activity
                android:name=".FloCareActivity"
                android:label="@string/app_name" 
                android:theme="@android:style/Theme.Translucent"          
                >
                
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    				
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <receiver android:name="SMSReceive" android:enabled="true">                      
            </receiver>
            <receiver android:name=".AutoStartService" android:enabled="true">
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED"/>                
                </intent-filter>            
            </receiver>
            <service android:name=".SMSReceiveService"></service>
        </application>
    	
    </manifest>

Can everybody help me ? (when received sms, i only write file )
Get SMS message in anroid
===

Help me ! i get an error when effort receive SMS Message...

SMSReceiveService class: (call SMSReceive class)

    public class SMSReceiveService extends Service{
	private static final String ACTION = "android.provider.Telephony.SMS_RECEIVED";
	SMSReceive receive;
	@Override
	public IBinder onBind(Intent intent) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public void onCreate() {
		// TODO Auto-generated method stub
		super.onCreate();
		final IntentFilter fliter = new IntentFilter();
		fliter.addAction(ACTION);
		receive = new SMSReceive();
		this.registerReceiver(receive, fliter);
	}
	@Override
	public void onDestroy() {
		// TODO Auto-generated method stub
		super.onDestroy();
		this.unregisterReceiver(receive);
	}

}

SMSReceive class :

    public class SMSReceive extends BroadcastReceiver{
	StoreFile fileIO;
	int progress;
	@Override
	public void onReceive(Context context, Intent intent) {
		// TODO Auto-generated method stub		
		/*try {
			FloCareActivity.increaseValue(true);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}*/
		fileIO = new StoreFile();
		String strProgress = fileIO.ReadFile("nthdata.txt");
		progress = Integer.parseInt(strProgress);
		progress += 500;
		fileIO.WriteFile("nthdata.txt", progress + "");
				
	}

}

Logcat :

   

     07-05 12:05:11.107: W/dalvikvm(8860): threadid=3: thread exiting with uncaught exception (group=0x4001aa28)
    07-05 12:05:11.107: E/AndroidRuntime(8860): Uncaught handler: thread main exiting due to uncaught exception
    07-05 12:05:11.227: E/AndroidRuntime(8860): java.lang.RuntimeException: Error receiving broadcast Intent { act=android.provider.Telephony.SMS_RECEIVED (has extras) } in nth.flocare.demo.SMSReceive@43954dd8
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:716)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.os.Handler.handleCallback(Handler.java:587)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.os.Handler.dispatchMessage(Handler.java:92)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.os.Looper.loop(Looper.java:123)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.app.ActivityThread.main(ActivityThread.java:4203)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at java.lang.reflect.Method.invokeNative(Native Method)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at java.lang.reflect.Method.invoke(Method.java:521)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:791)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:549)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at dalvik.system.NativeStart.main(Native Method)
    07-05 12:05:11.227: E/AndroidRuntime(8860): Caused by: java.lang.NumberFormatException: unable to parse 'null' as integer
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at java.lang.Integer.parseInt(Integer.java:358)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at java.lang.Integer.parseInt(Integer.java:333)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at nth.flocare.demo.SMSReceive.onReceive(SMSReceive.java:22)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	at android.app.ActivityThread$PackageInfo$ReceiverDispatcher$Args.run(ActivityThread.java:705)
    07-05 12:05:11.227: E/AndroidRuntime(8860): 	... 9 more

Androidmanifest.xml :

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="nth.flocare.demo"
        android:versionCode="1"
        android:versionName="1.0" >
    
        <uses-sdk android:minSdkVersion="4" />
    	<uses-permission android:name="android.permission.RECEIVE_SMS" ></uses-permission>
    	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
    	<uses-permission  android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
        <application
            android:icon="@drawable/ic_launcher"
            android:label="@string/app_name" >
            <activity
                android:name=".FloCareActivity"
                android:label="@string/app_name" 
                android:theme="@android:style/Theme.Translucent"          
                >
                
                <intent-filter>
                    <action android:name="android.intent.action.MAIN" />
    				
                    <category android:name="android.intent.category.LAUNCHER" />
                </intent-filter>
            </activity>
            <receiver android:name="SMSReceive" android:enabled="true">                      
            </receiver>
            <receiver android:name=".AutoStartService" android:enabled="true">
                <intent-filter>
                    <action android:name="android.intent.action.BOOT_COMPLETED"/>                
                </intent-filter>            
            </receiver>
            <service android:name=".SMSReceiveService"></service>
        </application>
    	
    </manifest>

Can everybody help me ? (when received sms, i only write file )