현재 문자가 오면 문자를 받아 들이는거 까지는 되는데
특정문자가 있으면 그 문자 있는 쿠폰만 걸러내서 다이알 로그 띄울려고 하는데요
그 특정문자를 지정해주고 검색은 하는데
전부다 일치하지 않는다고 뜨네요 ;;;
심지어 그 단어만 적어 보내도 없다고 뜨네요 ;;;
예) coupon 이 검색단어 // sms :  coupon 
뭐 이리저리 바꿔도 안되네요 ㅠㅠ 도와주세여 ㅠ


package ITs.socialcoupon_v2;

import java.util.regex.PatternSyntaxException;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.telephony.SmsMessage;
import android.util.Log;
import android.widget.Toast;

public class SMSReceiver extends BroadcastReceiver {
//------------------------------------------------------------------------------
//- Member Variable
//------------------------------------------------------------------------------
private static final String TAG = "SMSReceiver"; 
    private static final String ACTION = "android.provider.Telephony.SMS_RECEIVED"; 
 
//------------------------------------------------------------------------------
//- Member Method : BroadcastReceiver's Override
//------------------------------------------------------------------------------
@Override
public void onReceive(Context context, Intent intent) {
Log.i(TAG, "[inside onReceive] "); 
 if (intent.getAction().equals(ACTION)) 
 { 
             StringBuilder sb = new StringBuilder(); 
             Bundle bundle    = intent.getExtras(); 
             //String      szMsg ="";
             boolean  isMatch=false;
             
             if (bundle != null) 
             { 
                 Object[]  pdusObj = (Object[]) bundle.get("pdus"); 
                 SmsMessage[]  messages = new SmsMessage[pdusObj.length]; 
                 
                 for (int i = 0; i<pdusObj.length; i++)
                 { 
                     messages[i] = SmsMessage.createFromPdu ((byte[]) pdusObj[i]); 
                 } 
              
                 Log.i(TAG, "[SMSApp Bundle] " + bundle.toString()); 
                 
                 for (SmsMessage currentMessage : messages)
                 { 
                         sb.append("Received compressed SMS\nFrom: "); 
                         // Sender-Number 
                         sb.append(currentMessage.getDisplayOriginatingAddress()); 
                         sb.append("\n----Message----\n"); 
                         // Actual Message-Content 
                         //szMsg = currentMessage.getDisplayMessageBody();
                         sb.append(currentMessage.getDisplayMessageBody()); 
                 } 
                 
                 isMatch = searchCoupon(context, sb.toString());
              } 
              
              Log.i(TAG, "[SMSApp] onReceiveIntent: " + sb); 

              Toast.makeText(context, sb.toString(), Toast.LENGTH_LONG).show(); 

//                Consume this intent, that no other application will notice it. 
              this.abortBroadcast(); 
                  if(isMatch)
                  {
                   Intent goINT = new Intent(context, ChoiceSMS.class);
                   goINT.putExtra("SMS", sb.toString());
                   goINT.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
                   
                   context.startActivity(goINT);
                   
                  }else{
                
                   Log.i(TAG, "Coupon관련 메시지가 아님");
                  }
              
         } 
    } 
private boolean searchCoupon(Context context, String szMsg){
        boolean  isCoupon = false;
        
        String[] arrSearchWords = context.getResources().getStringArray(R.array.arrFindStr);
        String   findStr=""; // = "(?i).*" + arrSearchWords[0] + ".*";

        
        
        String szTmpMsg="";
        for(int idx=0; idx<arrSearchWords.length; idx++)
        {
         findStr = "(?i).*" + arrSearchWords[idx] + ".*";
         Log.i(TAG, findStr);
        
        try {
             isCoupon = (szMsg.matches(findStr)==true)?true:false;
             szTmpMsg = (isCoupon==true)?"Match!!!":"none";
             Log.i(TAG, "isCoupon = " + isCoupon);
             
           if (isCoupon) break;
          
        } catch (PatternSyntaxException e) { 
         Log.i(TAG, "PatternSyntaxException 정규식 에러 발생");
        }
        }
        
        Log.i(TAG, szTmpMsg);
        
return isCoupon;
}
}