whats the best way to send game moves ,between phones


  1. flyhigh427

    flyhigh427 Well-Known Member

    whats the best way to send and reseve game moves between phones,
    like text messages ,is this possible?
    thanks

    Advertisement
    :
  2. flyhigh427

    flyhigh427 Well-Known Member

    can text messages be used ,like chess moves between to phones ,i mean can a game pick out text messages pointed to the games in some way so you dont have to be online all the time?
    thanks
  3. Rxpert83

    Rxpert83 Dr. Feelgood Moderator

    Look at how any of the "with friends" games do it.


    Using a data connection
    flyhigh427 likes this.
  4. flyhigh427

    flyhigh427 Well-Known Member

    ive been looking at sending sms ,but ill look up that too.
    thanks
  5. flyhigh427

    flyhigh427 Well-Known Member

    hey i want to call this function in another class but im having a bit of trouble,everything i read on reading a sms message ,loads first but i want it to load later .
    how do i go about calling that function later?
    im supposed to be able to call it from main with this>>
    getAllSms("inbox"); // Get all sms from inbox



    [HIGH]
    public List<Sms> getAllSms(String folderName) {
    List<Sms> lstSms = new ArrayList<Sms>();
    Sms objSms = new Sms();
    Uri message = Uri.parse("content://sms/"+folderName);
    ContentResolver cr = mActivity.getContentResolver();

    Cursor c = cr.query(message, null, null, null, null);
    mActivity.startManagingCursor(c);
    int totalSMS = c.getCount();

    if (c.moveToFirst()) {
    for (int i = 0; i < totalSMS; i++) {

    objSms = new Sms();
    objSms.setId(c.getString(c.getColumnIndexOrThrow("_id")));
    objSms.setAddress(c.getString(c
    .getColumnIndexOrThrow("address")));
    objSms.setMsg(c.getString(c.getColumnIndexOrThrow("body")));
    objSms.setReadState(c.getString(c.getColumnIndex("read")));
    objSms.setTime(c.getString(c.getColumnIndexOrThrow("date")));

    lstSms.add(objSms);
    c.moveToNext();
    }
    }
    // else {
    // throw new RuntimeException("You have no SMS in " + folderName);
    // }
    c.close();

    return lstSms;
    }
    [/HIGH]
  6. flyhigh427

    flyhigh427 Well-Known Member

    i got it to work on the emulator but i cant tell if it saved the data into the file ,do yall know of a way to look at the files on a emulator sd card?
    thanks

    [HIGH]
    package com.pareshmayani.smsinbox;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io_OutputStreamWriter;
    import java.util.ArrayList;
    import android.app.Activity;
    import android.database.Cursor;
    import android.net.Uri;
    import android.os.Bundle;
    import android.os.Environment;
    import android.widget.ArrayAdapter;
    import android.widget.ListView;
    /**
    * @author Paresh N. Mayani
    * (w): TechnoTalkative | Paresh Mayani's Techno worldTechnoTalkative | Paresh Mayani's Techno world
    */
    public class SMSInboxActivity extends Activity {
    private static final String DOMXX = "DOMXX";



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

    ListView lViewSMS = (ListView) findViewById(R.id.listViewSMS);

    if(fetchInbox()!=null)
    {
    ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, fetchInbox());
    lViewSMS.setAdapter(adapter);
    }
    }
    public ArrayList<String> fetchInbox()
    {
    ArrayList<String> sms = new ArrayList<String>();

    Uri uriSms = Uri.parse("content://sms/inbox");
    Cursor cursor = getContentResolver().query(uriSms, new String[]{"_id", "address", "date", "body"},null,null,null);
    cursor.moveToFirst();
    while (cursor.moveToNext())
    {
    String body = cursor.getString(3);

    if(body.startsWith(DOMXX)){

    System.out.println("=====> SMS Text => "+body);
    sms.add("\n SMS => "+body);
    try{
    String baseDir = Environment.getExternalStorageDirectory().getAbsolutePath();
    String fileName = "mynewFile.txt";


    File myFile = new File(baseDir + File.separator + fileName);
    myFile.createNewFile();
    FileOutputStream fOut = new FileOutputStream(myFile);
    OutputStreamWriter myOutWriter =new OutputStreamWriter(fOut);
    myOutWriter.append(body);
    myOutWriter.close();
    fOut.close();



    }
    catch(Exception exc){
    }
    break;
    }else{


    }

    }
    return sms;

    }
    }
    [/HIGH]
  7. flyhigh427

    flyhigh427 Well-Known Member

    how would i go about changing that so i could calll it on a button push from another class?
  8. flyhigh427

    flyhigh427 Well-Known Member

    is the best way to send game data ,by creating your own web server?
    they say sending sms is to costly..
    thanks
Loading...

Share This Page