Go Back   Android Forums > Android Development > Application Development
Application Development Dev Lounge for the Coder Folks
Gamers - Check out our new sister sites!
Nintendo Wii U!    |    OUYA - $99 Android System!

test: Reply
 
LinkBack Thread Tools
Old February 8th, 2013, 05:33 AM   #1 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 25
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default whats the best way to send game moves ,between phones

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

flyhigh427 is offline  
Reply With Quote
Sponsors
Old February 8th, 2013, 05:55 AM   #2 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 25
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

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
flyhigh427 is offline  
Reply With Quote
Old February 8th, 2013, 08:12 AM   #3 (permalink)
Stand Back!
 
Rxpert83's Avatar
 
Join Date: Aug 2011
Location: MN
Posts: 11,603
 
Device(s): EVO 4g, EVO 4G LTE, Nexus S, Galaxy Nexus, S3, Nexus 7
Carrier: Not Provided

Thanks: 8,795
Thanked 8,924 Times in 5,042 Posts
Default Re: whats the best way to send game moves ,between phones

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


Using a data connection
Rxpert83 is online now  
Reply With Quote
The Following User Says Thank You to Rxpert83 For This Useful Post:
flyhigh427 (February 8th, 2013)
Old February 8th, 2013, 12:51 PM   #4 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 25
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

ive been looking at sending sms ,but ill look up that too.
thanks
flyhigh427 is offline  
Reply With Quote
Old February 10th, 2013, 07:48 PM   #5 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 25
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

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



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;
}
flyhigh427 is offline  
Reply With Quote
Old February 12th, 2013, 11:26 AM   #6 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 25
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

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

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;

}
}
flyhigh427 is offline  
Reply With Quote
Old February 12th, 2013, 11:30 AM   #7 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 25
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

how would i go about changing that so i could calll it on a button push from another class?
flyhigh427 is offline  
Reply With Quote
Old February 21st, 2013, 02:52 PM   #8 (permalink)
Junior Member
Thread Author (OP)
 
Join Date: Jan 2013
Posts: 25
 
Device(s):
Carrier: Not Provided

Thanks: 1
Thanked 0 Times in 0 Posts
Default

is the best way to send game data ,by creating your own web server?
they say sending sms is to costly..
thanks
flyhigh427 is offline  
Reply With Quote
Reply


Go Back   Android Forums > Android Development > Application Development
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 09:45 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.