Send SMS from one emulator instance to another

by Devesh » Sat, 30 Aug 2008 02:25:05 GMT


Sponsored Links
 Hi,
I have read many posts on the Android developers forum, however, I am
not able to resolve the problem.

I am trying to send SMS text message from one emulator instance to
another emulator instance on the same machine, but the second emulator
instance does not display the text message. If however, I use the
telnet window and send sms from there, the second emulator instance
displays the text message.
In the first emulator instance, I am using this code:-

SmsManager sm = SmsManager.getDefault();
sm.sendTextMessage("5555", null, "Hello world", null, null, null);

where the first parameter is the sendTo address, which is actually the
port# on which the second emulator is running.
I have used several options on this parameter value, such as the
device name "emulator-tcp-5555" and even the telnet port#  "5554".
However, the second emulator instance just does not display the text
message sent from the first emulator instance.

Following is the manifest of the sms sender activity:-
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android=" http://schemas.android.com/apk/res/android" ;
    package="com.orange.mobicomm.sms">
    <uses-permission android:name="android.permission.SEND_SMS" />
    <uses-permission android:name="android.permission.WRITE_SMS" />
    <application android:icon="@drawable/icon">
        <activity android:name=".SMSSenderActivity"
android:label="@string/app_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category
android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>
</manifest>

-Devesh

--~--~---------~--~----~------------~-------~--~----~



Send SMS from one emulator instance to another

by Megha Joshi » Sat, 30 Aug 2008 02:39:04 GMT


 Please reference the SMSTest sample app uploaded in the Files section. It
shows how to send SMS between two emulators using SMSManager APIs:


Sponsored Links


Other Threads

1. Custom ListView with ItemClick listener & notifyDataSetChanged

Hello,
I tried to have a customed listview with the itemclick listener. I
followed with some small modifications the tutorials from
http://www.androidpeople.com/android-custom-listview-tutorial-example/.
If I put in comment "adapter.notifyDataSetChanged();", all work well:
when I click on an item, the listener is fired. But if I use
"adapter.notifyDataSetChanged();" (I need it because my list will be
constructed dynamically), no listener is fired when I click on any
item.
Does someone have an idea about the error I made ? Or shall I use
another way to do what I want ?

Thanks !

Here are my codes:
public class CustomListViewOnClick extends Activity {
        private CustomListView l1;


        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                l1 = new CustomListView(this);
                setContentView(l1);
        }
}

public class CustomListView extends ListView {
        private static Context context;
        private EfficientAdapter adapter;

        private class EfficientAdapter extends BaseAdapter {
                private LayoutInflater mInflater;

                public EfficientAdapter(Context context, int 
textViewResourceId) {
                        mInflater = LayoutInflater.from(context);

                }

                public int getCount() {
                        return country.length;
                }

                public Object getItem(int position) {
                        return position;
                }

                public long getItemId(int position) {
                        return position;
                }

                public View getView(int position, View convertView, ViewGroup
parent) {
                        ViewHolder holder;
                        if (convertView == null) {
                                convertView = 
mInflater.inflate(R.layout.listview, null);
                                holder = new ViewHolder();
                                holder.text = (TextView) convertView
                                                .findViewById(R.id.TextView01);
                                holder.text2 = (TextView) convertView
                                                .findViewById(R.id.TextView02);

                                convertView.setTag(holder);
                        } else {
                                holder = (ViewHolder) convertView.getTag();
                        }

                        holder.text.setText(curr[position]);
                        holder.text2.setText(country[position]);

                        return convertView;
                }

                class ViewHolder {
                        TextView text;
                        TextView text2;
                }
        }

        public CustomListView(Context context) {
                super(context);
                CustomListView.context = context;
                adapter = new EfficientAdapter(context, R.layout.listview);
                setAdapter(adapter);
                setOnItemClickListener(new OnItemClickListener() {
                        @Override
                        public void onItemClick(AdapterView<?> a, View v, int 
position,
                                        long id) {
                                AlertDialog.Builder adb;
                                adb = new 
AlertDialog.Builder(CustomListView.context);
                                adb.setTitle("LVSelectedItemExample");
                                adb.setMessage("Selected Item is = "
                                                + getItemAtPosition(position));
                                adb.setPositiveButton("Ok", null);
                                adb.show();
                        }
                });
        }

        @Override
        protected void onDraw(Canvas canvas) {
                adapter.notifyDataSetChanged();
        }

        private static final String[] country = { "Iceland", "India",
"Indonesia",
                        "Iran", "Iraq", "Ireland", "Israel", "Italy", "Laos", 
"Latvia",
                        "Lebanon", "Lesotho ", "Liberia", "Libya", "Lithuania",
                        "Luxembourg" };
        private static final String[] curr = { "ISK", "INR", "IDR", "IRR",
"IQD",
                        "EUR", "ILS", "EUR", "LAK", "LVL", "LBP", "LSL ", 
"LRD", "LYD",
                        "LTL ", "EUR"

        };

-- 

2. Is there an Android view/layout/widget that allows flinging/swiping between included views?

I'm looking for a layout that includes different views and allows
switching between them, but unlike the tab view which switches
instantly and uses a large amount of screen real estate, allows the
user to fling/swipe between the views (ideally with small images
indicating how many views are available and which one is the current
one like, forgive me, iPhone apps display).

The HorizontalScrollView view allows flinging, but does not have a
separation between screens.

If there isn't a standard component that does this, is there another
that is often used for this purpose?

I realize I could implement this myself without too much trouble using
gestures, but I'd like to avoid reinventing the wheel (if, that is,
it's already been invented in this case) and defining my own
thresholds for the fling action means my app and other apps that try
to do the same thing do not provide a consistent user experience.



-- 

3. Restlet api

4. Ym bermasalah

5. adb causing 100% cpu usage

6. Tegra 2 / GTablet does not expose reqGlEsVersion correctly...

7. Google Checkout Change - delayed bulk payments.