한국어

Coding

온누리070 플레이스토어 다운로드
    acrobits softphone
     온누리 070 카카오 프러스 친구추가온누리 070 카카오 프러스 친구추가친추
     카카오톡 채팅 상담 카카오톡 채팅 상담카톡
    
     라인상담
     라인으로 공유

     페북공유

   ◎위챗 : speedseoul


  
     PAYPAL
     
     PRICE
     

pixel.gif

    before pay call 0088 from app



https://stackoverflow.com/questions/8847876/android-sms-intent-filter



I tried this code in my android application for the SMS message but it is not working , the application does not appear in the messaging list. Should I add something to make it work?

             <action android:name="android.intent.action.SENDTO" />
               <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="sms" />
            <data android:scheme="smsto" />
                <data android:mimeType="text/plain" />

          </intent-filter>



I am providing you a detailed desc to do that in different case(with contacts, text shares etc).

Manifest Entry for you Message Activity

<!-- Defines also the app name in the Android menu -->
    <activity
    android:name="it.rainbowbreeze.smsforfree.ui.ActSendSms"
    android:label="@string/common_appName"
    >
    <!-- Sends sms for someone  -->
    <intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <action android:name="android.intent.action.SENDTO" />
    <category android:name="android.intent.category.DEFAULT" />
    <category android:name="android.intent.category.BROWSABLE" />
    <data android:scheme="sms" />
    <data android:scheme="smsto" />
    </intent-filter>

    <!-- Sends text to someone .This will enable any Text Share functionality-->
    <intent-filter>
    <action android:name="android.intent.action.SEND" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:mimeType="text/plain" />
    </intent-filter>
    </activity>

Now we have made a processIntentData method as shown below to be applied in Message Activity:

private void processIntentData(Intent intent)
{
    if (null == intent) return;

    if (Intent.ACTION_SENDTO.equals(intent.getAction())) {
        //in the data i'll find the number of the destination
        String destionationNumber = intent.getDataString();
        destionationNumber = URLDecoder.decode(destionationNumber);
        //clear the string
        destionationNumber = destionationNumber.replace("-", "")
            .replace("smsto:", "")
            .replace("sms:", "");
        //and set fields
        mTxtDestination.setText(destionationNumber);

    } else if (Intent.ACTION_SEND.equals(intent.getAction()) && "text/plain".equals(intent.getType())) {
        //in the data i'll find the content of the message
        String message = intent.getStringExtra(Intent.EXTRA_TEXT);
        //clear the string
        mTxtBody.setText(message);
    }
}

Use as shown in Message Activity:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ...

    mTxtDestination = (EditText) findViewById(R.id.actsendsms_txtDestination);
    mTxtBody = (EditText) findViewById(R.id.actsendsms_txtMessage);

    ...

    //executed when the application first runs
    if (null == savedInstanceState) {
        processIntentData(getIntent());
    }
}

The attached snap for results: enter image description here

Try this code to send SMS, In your activity manifiest file grand android.permission.SEND_SMS permission.

Main.xml

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
   android:orientation="vertical"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   >
<TextView 
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text="@string/hello"
   />
<TextView 
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text="Enter Phone Number:"
   />
<EditText 
   android:id="@+id/smsnumber"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:inputType="phone"
   />
<TextView 
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text="Enter Phone SMS Text:"
   />
<EditText 
   android:id="@+id/smstext"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   />
<Button 
   android:id="@+id/sendsms"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text=" Send SMS "
   />
<Button 
   android:id="@+id/sendsms_intent"
   android:layout_width="fill_parent"
   android:layout_height="wrap_content"
   android:text=" Send SMS using Intent.ACTION_SENDTO "
   />
</LinearLayout>

Now the Activity class is,AndroidSMS.java

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.telephony.SmsManager;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class AndroidSMS extends Activity {
   /** Called when the activity is first created. */
   @Override
   public void onCreate(Bundle savedInstanceState) {
       super.onCreate(savedInstanceState);
       setContentView(R.layout.main);

       final EditText edittextSmsNumber = (EditText)findViewById(R.id.smsnumber);
       final EditText edittextSmsText = (EditText)findViewById(R.id.smstext);
       Button buttonSendSms = (Button)findViewById(R.id.sendsms);
       Button buttonSendSms_intent = (Button)findViewById(R.id.sendsms_intent);

       buttonSendSms.setOnClickListener(new Button.OnClickListener(){

   @Override
   public void onClick(View arg0) {
    // TODO Auto-generated method stub
    SmsManager smsManager = SmsManager.getDefault();
    String smsNumber = edittextSmsNumber.getText().toString();
    String smsText = edittextSmsText.getText().toString();
    smsManager.sendTextMessage(smsNumber, null, smsText, null, null);
   }});

       buttonSendSms_intent.setOnClickListener(new Button.OnClickListener(){

   @Override
   public void onClick(View arg0) {
    // TODO Auto-generated method stub

    String smsNumber = edittextSmsNumber.getText().toString();
    String smsText = edittextSmsText.getText().toString();

    Uri uri = Uri.parse("smsto:" + smsNumber);
    Intent intent = new Intent(Intent.ACTION_SENDTO, uri);
    intent.putExtra("sms_body", smsText);  
    startActivity(intent);
   }});
   }
}
조회 수 5308
조회 수 5204
FCM 푸시 메세지 전송
admin
2019.09.27
조회 수 5561
조회 수 7308
조회 수 7903
조회 수 6316
조회 수 7147
조회 수 7679
조회 수 7216
조회 수 11085
조회 수 6594
조회 수 7693
조회 수 6986
조회 수 6829
android apk 패키징 v1, v2
admin
2018.12.05
조회 수 7356
조회 수 7073
조회 수 6825
조회 수 6959
조회 수 7903
SDK Platform Release Notes
admin
2018.05.13
조회 수 7279
sdk-tools list
admin
2018.05.13
조회 수 7268
조회 수 7735
조회 수 7642
조회 수 7167
조회 수 7311
Firebase용 Cloud 함수
admin
2018.04.26
조회 수 7683
안드로이드 알람
admin
2018.02.23
조회 수 7849
조회 수 7804
조회 수 7739
gcm 코딩 사례
admin
2018.01.09
조회 수 7615
조회 수 12296
조회 수 8009
조회 수 8665
조회 수 8063
조회 수 10113
FCM PHP Curld
admin
2018.01.01
조회 수 8590
FCM 과 GCM 차이
admin
2018.01.01
조회 수 10192
조회 수 7939