¾ÛÅøÁî
46.¢½.168.138
46.¢½.168.129
46.¢½.168.161
46.¢½.168.136
46.¢½.168.145
46.¢½.168.162
46.¢½.168.144
46.¢½.168.140
115.¢½.135.198
46.¢½.168.139
 
°Ô½Ã¹° 88°Ç
   
¿øº»ÀÌ ¼öÁ¤ÀÌ ¾ÈµÇ´Â°ü°è·Î...(±¸±Û Ķ¸°´õ ¸®½ºÆ®JSON±Ü¾î¿À±â+ µî·Ï)
±Û¾´ÀÌ : ±èº´ÁÖ                   ³¯Â¥ : 2011-12-03 (Åä) 04:21 Á¶È¸ : 6931
1. ¿ì¼± Á¶»çÇغ»°á°ú ÀÌÀü¿¡ ¾Ë·Áµå¸°¹æ¹ýÀº. GDATA´Â ¾²±â,»èÁ¦ µîÀÇ À̺¥Æ®¸¸ »ç¿ë°¡´ÉÇϽʴϴÙ.
 
2. GDATA·Î´Â ¸®½ºÆ®¸¦ ½ºÄµºÒ°¡´ÉÇÕ´Ï´Ù. ¶ÇÇÑ ¾²±â »èÁ¦ µîÀÌ °¡´ÉÇÏ´Ù°í Çصµ ResponeÀ̳ª RequestÄڵ带 ¹ÞÀ» ¼ö ¾ø½À´Ï´Ù. (ÆÄ½Ì ¿ö´× ³ª¿É´Ï´Ù.)
 
3. µû¶ó¼­ À§ÀÇ ¸®½ºÆ® ½ºÄµ¹æ¹ý°ú + ¾Æ·¡ÀÇ GDATA ±Û µî·Ï¹æ½ÄÀ» ÇÕÄ£¹æ¹ýÀ» ³Ö¾îµ×½À´Ï´Ù.
 
À§ÀÇ ¼Ò½º¿Í ³»¿ëÀÌ ÀüüÀûÀ¸·Î ºñ½ÁÇϹǷÎ, µû·Î ÁÖ¼®À» ´ÞÁø ¾Ê°Ù½À´Ï´Ù.
<¼Ò½º>
package com.corea.Gdata;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParserFactory;
import org.json.JSONArray;
import org.json.JSONException;
import org.xml.sax.SAXNotRecognizedException;
import org.xml.sax.SAXNotSupportedException;
import org.xmlpull.v1.XmlPullParserException;
import org.xmlpull.v1.XmlPullParserFactory;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.TextView;
import android.widget.Toast;
import com.google.gdata.client.calendar.CalendarService;
import com.google.gdata.data.DateTime;
import com.google.gdata.data.Person;
import com.google.gdata.data.PlainTextConstruct;
import com.google.gdata.data.calendar.CalendarEventEntry;
import com.google.gdata.data.calendar.CalendarEventFeed;
import com.google.gdata.data.extensions.When;
import com.google.gdata.data.extensions.Where;
import com.google.gdata.util.AuthenticationException;
import com.google.gdata.util.ContentType;
import com.google.gdata.util.ServiceException;
public class Google_Gdata_Test extends Activity {
    /** Called when the activity is first created. */
 static String USER_ID;
 static String USER_Pass;
 static String APP_NAME;
 TextView text;
 static ArrayList<String> items;
 static ArrayList<String> items2;
 static ArrayList<String> items3;
 JSONArray arr;
 String ar;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
 
        USER_ID = "Áö¸ÞÀÏ °èÁ¤";
        USER_Pass = "ºñ¹Ð¹øÈ£";
        APP_NAME = "¾ÛÀ̸§";
        items = new ArrayList<String>();
        items2 = new ArrayList<String>();
        items3 = new ArrayList<String>();
        text = new TextView(this);
        text = (TextView)findViewById(R.id.text);
     
      authdata();
      if(ar!=null)
      {
       getList();
      
      }
      if(arr.length()!=0)
      {
       for(int i=0; i<arr.length(); i++)
       {
       try {
    text.append("\n"+arr.getString(i)+"\n");
   } catch (JSONException e) {
    // TODO Auto-generated catch block
    e.printStackTrace();
   }
       }
      }
      else{}
 
    }
   public void getList()
   {
  try {
     items3=new ArrayList<String>();
     URL url = new URL("http://www.google.com/calendar/feeds/"+USER_ID+"/private/full?alt=json");
     HttpURLConnection con = (HttpURLConnection)url.openConnection();
     con.setDoOutput(true);
     con.setRequestMethod("GET");
     con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
     con.setRequestProperty("Authorization", "GoogleLogin auth="+ar);
     InputStream un = con.getInputStream();
     BufferedReader br = new BufferedReader(new InputStreamReader(un));
     String ud;
     arr = new JSONArray();
     while((ud=br.readLine())!=null)
     {
      arr.put(ud);
     }
     br.close();
  }
  catch (MalformedURLException e) {
   // TODO Auto-generated catch block
   e.printStackTrace();
  } catch (IOException e) {
 // TODO Auto-generated catch block
 e.printStackTrace();
}  
   }
   
   public void authdata()
   {
      items = new ArrayList<String>();
      
       URL url;
    try {
     url = new URL("https://www.google.com/accounts/ClientLogin ");
    
       HttpURLConnection con = (HttpURLConnection)url.openConnection();
       con.setDoOutput(true);
       con.setRequestMethod("POST");
       OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
       out.write(
         "&Email="+USER_ID
        // +"&postId="+"1"
         //+"&commentId="+"9155368"
         +"&Passwd="+USER_Pass
         +"&source="+APP_NAME
         +"&service="+"cl");
       out.flush();
       InputStream put = con.getInputStream();
       out.close();
       BufferedReader in = new BufferedReader(new InputStreamReader(con.getInputStream()));
       String decodedString;
       while((decodedString = in.readLine())!=null)
       {
       items.add(decodedString);
       }
       in.close();
       ar = items.get(2).substring(5);
       System.out.println(ar);
    } catch (MalformedURLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    } catch (IOException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
    }  
   }

    public void AddEventSce(String Title, String Note, Date Startdate, Date EndDate, String Location)
    {
    Toast.makeText(getBaseContext(), "login..", Toast.LENGTH_SHORT).show();
    try {
  URL feedUrl = new URL("https://www.google.com/calendar/feeds/default/private/full?alt=json");
  
  CalendarEventEntry myEntry = new CalendarEventEntry();
  
  myEntry.setTitle(new PlainTextConstruct("Test_App","utf-8"));
  myEntry.setContent(new PlainTextConstruct("¾È³çÇϼ¼¿ä","utf-8"));
  Person author = new Person("Test_app",null,USER_ID);
  myEntry.getAuthors().add(author);
  DateTime startTime = new DateTime(new Date(2011-1900,12-1,3,12,0));
  startTime.setTzShift(9);
  DateTime endTime = new DateTime(new Date(2011-1900,12-1,3,13,0));
  endTime.setTzShift(9);
  When eventTimes = new When();
  eventTimes.setStartTime(startTime);
  eventTimes.setEndTime(endTime);
  myEntry.addTime(eventTimes);
  Where evLocaiton = new Where();
  evLocaiton.setValueString("¼­¿ï");
  myEntry.addLocation(evLocaiton); 
  CalendarService myService = new CalendarService("Test_App");
  myService.setUserCredentials(USER_ID,USER_Pass);
  ContentType ct = new ContentType();
//  ct.setType("application/json;charset=utf-8");
//  myService.setContentType(ct);
  myService.insert(feedUrl, myEntry);

 } catch (AuthenticationException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 } catch (MalformedURLException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 } catch (IOException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 } catch (ServiceException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
 }
     
     
    }
}
 
* ±ÛÀ» µî·ÏÇϽǶ§ ²À ÇÊ¿äÇÑ °æ¿ì°¡ ¾Æ´Ï¸é °³ÀÎÁ¤º¸¸¦ ³²±âÁö ¸¶¼¼¿ä ^^ (¿¬¶ôó,À̸ÞÀÏÁÖ¼Ò,Áֹεî·Ï¹øÈ£ µî)




±èº´ÁÖ ´ÔÀÇ Tip&Tech ÃÖ½Å±Û [´õº¸±â]


   

°Ô½Ã¹° 88°Ç
¹øÈ£ Á¦¸ñ ±Û¾´ÀÌ ³¯Â¥ Á¶È¸
88  <Ŭ¶ó¿ìµåÇõ½Å¼¾ÅÍ> 12¿ù 1ÀÏ SW ½ºÅ¸Æ®¾÷ â¾÷ ¼º°ø Àü·« ¼¼¹Ì³ª Âü¼® ¿äû Áظð 11-30 4085
87  <Ŭ¶ó¿ìµåÇõ½Å¼¾ÅÍ> 12¿ù 1ÀÏ SW ½ºÅ¸Æ®¾÷ â¾÷ ¼º°ø Àü·« ¼¼¹Ì³ª Áظð 11-23 3940
86  °³Àΰ³¹ßÀÚ SW°³¹ßȯ°æ Áö¿ø»ç¾÷ ¾È³» Áظð 10-28 4231
85  ¸Æ¿¡¼­ ±¸±Û API key µî·Ï¹æ¹ý ¼º±âµ¿ 08-29 4597
84  [Agate Mobile] ¾Û ¼³Ä¡ ¾øÀÌ ¼­¹ö·ÎºÎÅÍ ½Ç½Ã°£ ·Îµù µÇ¾î µ¿ÀÛÇÏ´Â Cloud Native App ÇÁ·¹ÀÓ¿öÅ©ÀÔ´Ï´Ù. ¾¾Æ®¸°°³¹ß¡¦ 07-21 7872
83     [Agate Mobile] ¾Û ¼³Ä¡ ¾øÀÌ ¼­¹ö·ÎºÎÅÍ ½Ç½Ã°£ ·Îµù µÇ¾î µ¿ÀÛÇÏ´Â Cloud Native App ÇÁ·¹ÀÓ¿öÅ©ÀÔ´Ï´Ù. ±èÀºÈ£ 08-21 12266
82  ÀÚ¹Ù Ãʺ¸µé¿¡°Ô ÃßõÇÏ´Â ±âÃÊ °³³äÀ» ÀâÀ» ¼ö Àִ åµé ÀÌ°æ¿ë 06-19 5932
81  [ÆÁ] °¶·°½Ã ³ëÆ®3 °³¹ßÀÚ ¿É¼Ç ¸Þ´º ã±â ^^ ÀÌ°æ¿ë 11-09 9872
80  ¾ÛÅÛÇø´À» Á¦°øÇÏ´Â »çÀÌÆ® ¼Ò°³ÇÕ´Ï´Ù. ¾¾Æ®¸°°³¹ß¡¦ 08-21 12443
79  The content of the adapter has changed but ListView ... ¿¡·¯ ÀϹÝÀû ÇØ°á¹ý. ±èº´ÁÖ 04-16 15603
78  °£´ÜÇÏ°Ô Æнº¿öµå¿¡ ¼ýÀÚ°¡ È¥¿ëµÇ¾ú´ÂÁö ó¸®ÇÒ ¼ö ÀÖ´Â ¸Þ¼ÒµåÀÔ´Ï´Ù. ±èº´ÁÖ 01-31 6658
77  handler¸¦ ÀÌ¿ëÇØ °¡º¯½Ã°£ ¹Ýº¹ ÀÛ¾÷Çϱâ. ±èº´ÁÖ 11-26 8606
76  String -> HEX ±èº´ÁÖ 11-12 6009
75  ¸®½ºÆ® ÀÛ¾÷½Ã¿¡ ±âº»ÀûÀ¸·Î ¾Ë¾ÆµÎ¼Å¾ß µÉÁ¡. +1 ±èº´ÁÖ 10-08 7080
74  xml Á÷·Äó¸® °í¹ü¼® 09-24 4534
73  ÁÖ¼Ò·Ï Ãß°¡/»èÁ¦ °¨ÁöÇؼ­ ¾ÛÀÇ dbÃß°¡/»èÁ¦Çϱâ. ±èº´ÁÖ 09-24 12679
72  È®À帮½ºÆ®°¡ 3µª½º ÀÌ»óÀÌ µÉ±î? ¾ÈµÉ±î? +1 ±èº´ÁÖ 08-21 10355
71  ZXing ¹ÙÄÚµå ½ºÄµºÎºÐ Å©±â Á¶ÀýÇϱâ. ±èº´ÁÖ 08-06 14915
70  ÀÌŬ¸³½º¿¡¼­ ·¹À̾ƿô xml ±×·¡ÇȺκÐÀÌ °©Àڱ⠾Ⱥ¸ÀÏ°æ¿ì. +1 ±èº´ÁÖ 07-27 6647
69  °£¸¸¿¡ ±Û¾²³×¿ä À̹ø¿£ launcherShortCut (¹Ù·Î°¡±â ¾ÆÀÌÄÜ)ÀÔ´Ï´Ù. ±èº´ÁÖ 07-25 12237
 1  2  3  4  5  
 
 
 
Copyright ¨Ï wwwold.androidstudy.co.kr. All rights reserved.