Activity lifecycle
Activity Component는 3종류의 상태자 있다.
1) Acvite or Running: 사용자 화면에 나와있는 상태
2) paused: 다른 Activity가 forground일 경우이며 system에 의해 shut down될 수도 있음. (Linux 기반이므로 가능할 듯)
3) stopped

안드로이드는 위와 같은 상태의 변화에 대해 다음과 같은 method를 호출함으로써 Activity에 알려준다.
void onCreate(Bundle savedInstanceState)
void onStart()
void onRestart()
void onResume()
void onPause()
void onStop()
void onDestroy()
개발자는 상태 변경 시 위의 protected method를 override하려 사용할 수 있다.
모든 Activity 개발 시 onCreate()는 반드시 명시해야 한다.

Activity의 lifetime은 다음과 같이 3가지 경우로 나눌 수 있다.
1) entire lifetime: onCreate()에서 onDestroy()까지
2) visible lifetime: onStart()에서 onStop()까지
3) foreground lifetime: onResume()에서 onPause()까지


Service lifecycle
Service도 상태 변화를 확인할 수 있는 method를 가지고 있다.
void onCreate()
void onStart(Intent intent)
void onDestroy()


Service의 lifetime은 다음과 같이 2가지 경우로 나눌 수 있다.
1) entire lifetime: onCreate()에서 onDestroy()까지
2) active lifetime: onStart()





Posted by 피의복수

안드로이드의 주요한 기능은 하나의 Application이 다른 Application의 elements를 사용할 수 있다는 것입니다. (단 다른 Application이 elements 사용을 허용한다는 전제조건 하에서 가능합니다.)
안드로이드 Application은 single entry point를 가지고 있지 않고 필요할 때 instance를 생성하여 실행할 수 있는 주요 Components를 가지고 있습니다. (single entry point는 예를 들어서 프로그램을 실행하기 위한 main함수가 없다는 얘기라네요)
이러한 Component는 4가지의 Type을 제공되고 있는데, 이에 대해서 하나씩 살펴보기로 하겠습니다.

1. Activities
  - Activity는 Visial User Interface를 표현합니다.
  - 각 Activity에 대해서는 그려지는 Window가 주어지게 되며, 이 Window의 visual한 content는 View Class에서 파생되는 다양한 view Object들이 제공됩니다. (button, TextView 등)
  - WIPI에서의 Card 또는 J2ME의 Canvas를 생각해 보면 쉬울 듯...
2. Services
  - Service는 Visual User Interface가 아닌 Background에서 실행됩니다.
  - 내 생각에는 기존 WIPI에서 Thread 같은것을 구현하여 Network 접속 등을 처리했을 경우와 유사한 것 같다.
3. Broadcast receivers
  - broadcast announcements를 수신하고 이에 적절한 react를 하는 Component입니다.
  - WIPI를 예로 들자면 Platform Event나 SMS Event 및 Call Event등이 해당될 것 같다.
4. Content Providers
  - 하나의 Application의 Data를 다른 Application에서 사용가능하도록 설정합니다.

위의 4가지 타입의 Component중 특정 Component에의해 제어되어야 하는 요구사항이 발생할 경우, 안드로이드는 필요하다면 Process를 실행하고, Component의 instance를 만들고 사용하게 됩니다.
아래는 각각의 경우에 따라 각 Component들에 대해 어떻게 사용이 되는지 정리합니다.

Activating components
Content Provider는 ContentResolver에 요청이 있을 경우에 활성화가 됩니다.
하니만 이외의 Activity, Service 및 Broadcast receiver의 경우는 intents라고 불리는 비동기화 메시지에 의해 활성화되게 됩니다. (Intent란 메시지 컨텐트를 보유하고 있는 Intent Object를 말합니다.)

각각의 Component에 따라 활성화 시키는 방법이 다른데 아래에 정의합니다.
  • Activity는 Intent Object를 Context.startActivity()나 Activity.startActivityForResult() method에 전달함으로써 시작됩니다.
  • Service는 Intent Object를 Context.startService() method에 전달함으로써 시작됩니다. 안드로이드는 Service의 onStart() method를 호출하고 이를 Intent Object에 전달합니다.
  • Broadcast는 Context.sendBroadcast(), Context.sendOrderedBroadcast(), Context.sendStickyBroadcast() 와 같은 method에 Intent Object를 전달함으로써 초기화될 수 있습니다.
Shutting down components
Content Provider는 ContentResolver의 요청에 응답하는 동안에만 활성화가 됩니다. Broadcast Receiver는 Broadcast message에 응답하는 동안에만 활성화가 됩니다. 따라서 이 두가지의 Component는 특별히 걱정하지 않아도 됩니다.)
하지만 Activity나 Service의 경우는 별도의 method를 제공하여 shut down할 수 있도록 합니다.
  • Activity는 finish()를 호출하여 shut down할 수 있습니다. 또한 하나의 Activity가 다른 Activity(물론 자신이 실행한 Activity입니다.)를 finishActivity()를 호출하여 shut down할 수도 있습니다.
  • Service는 stopSelf()나 Context.stopService() method를 호출하여 shut down할 수 있습니다.
manifest File
manifest는 Application의 Component에 대해 안드로이드에 정보를 제공한다.
아래와 같은 형식으로 XML로 구성되어 있으며 각각의 Component 타입에 따라서 하단의 bold 부분을 변경해 주면 된다.
<?xml version="1.0" encoding="utf-8"?>
<manifest . . . >
    <application . . . >
        <activity android:name="com.example.project.FreneticActivity"
                  android:icon="@drawable/small_pic.png"
                  android:label="@string/freneticLabel"
                  . . .  >
        </activity>
        . . .
    </application>
</manifest>

Activity, Service, Content Provoder의 경우 manifest에 등록되지 않으면 실행할 수 없지만, Broadcasr receiver의 경우는 코드 안에서 동적으로 생성이 가능하며 Context.resisterReceiver()를 통해 System에 등록이 가능하다.






 
Posted by 피의복수

지금부터 정리하는 내용은 안드로이드 개발자 사이트(http://developer.android.com/guide/)의 내용을 기초로 합니다.

전장에서 설명했듯이 안드로이드는 Java로 구현하게 됩니다. 이렇게 구현된 class및 각종 데이터, resource등은 .apk라는 확장자로 archive file로 만들어 지게 되며(이렇게 하는 tool이 aapt) 이 파일이 단말에 설치됩니다.

  • 모든 Application은 Linux Process로 실행됩니다.
  • 각 Process는 Virtual Machine을 가지게 되므로 다른 Application과 독립적으로 실행이 됩니다.
  • 각 Application은 Unique한 Linux user ID 를 할당받고, Permission이 설정됩니다. 

두개의 Application이 동일한 user ID를 공유하는 것이 가능하고, 이렇게 되면 Application이 파일을 확인할 수 있습니다.
System resource를 절약하기 위하여 동일한 ID를 가진 Application 들이 동일한 Linux Process에서 실행되도록 설정할 수 있습니다.






Posted by 피의복수
구글이 Platform에 관심을 가지고 있다고 예전에 세미나에서 들었었는데,,,,,헐..진짜로 나왔다.

안드로이드란 무엇인가?
한글로 정의한 안드로이드는 구글 및 OHA(Open Handset Alliance)에서 개발한 개방형 모바일 플랫폼이라고 한다.
Developers 사이트에서는 아래와 같이 정의하고 있다.
Android is a software stack for mobile devices that includes an operating system, middleware and key applications.

www.android.com을 통해 자세히 확인해 보기 바란다.

아래 내용은 developer.android.com에 정의된 내용이다.
1. Feature
  • Application framework enabling reuse and replacement of components
  • Dalvik virtual machine optimized for mobile devices
  • Integrated browser based on the open source WebKit engine
  • Optimized graphics powered by a custom 2D graphics library; 3D graphics based on the OpenGL ES 1.0 specification (hardware acceleration optional)
  • SQLite for structured data storage
  • Media support for common audio, video, and still image formats (MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, GIF)
  • GSM Telephony (hardware dependent)
  • Bluetooth, EDGE, 3G, and WiFi (hardware dependent)
  • Camera, GPS, compass, and accelerometer (hardware dependent)
  • Rich development environment including a device emulator, tools for debugging, memory and performance profiling, and a plugin for the Eclipse IDE

    2. Architecture

    Android System Architecture
  • Linux Kernel Android는 Linux ver 2.6에 기반한다.
  • Android Runtime  Core Library와 Dalvik Virtual Machine으로 구성
      - Dalvik Virtual Machine: Java VM의 라이선스문제를 피하기 위해 사용한다고 한다.
                                          Compile된 Java Code를 .dex 포맷으로 변경해서 실행한다고 하네요..
                                          실제로 eclipse에서 output을 보면 classes.dex가 생성되어 있습니다.





  •  

    Posted by 피의복수

    아래 내용은 microsoft의 정보를 인용한 것입니다.

    http://support.microsoft.com/kb/310259/en-us

    To use the Outlook 2002 Object Library or the Outlook 2003 Object Library to retrieve an appointment in a Visual C# .NET project, follow these steps:

    1. In Microsoft Visual Studio .NET or in Microsoft Visual Studio 2005, create a new Console Application project:
      1. On the File menu, point to New, and then click Project.
      2. Under Project Types, click Visual C# Projects.

        Note In Visual Studio 2005, click Visual C# under Project Types.
      3. Under Templates, click Console Application.
      4. Click OK. By default, a file that is named Class1.cs is created.

        Note In Microsoft Visual C# 2005, Program.cs is created by default.
    2. Add a reference to either the Outlook 2002 Object Library or the Outlook 2003 Object Library. To do this, follow these steps:
      1. On the Project menu, click Add Reference.
      2. Click the COM tab.
      3. On the COM tab, click Microsoft Outlook 11.0 Object Library if you are using Outlook 2003, or click Microsoft Outlook 10.0 Object Library if you are using Outlook 2002.
      4. Click Select.

        Note In Visual Studio 2005, you do not have to click Select.
      5. In the Add References dialog box, click OK.

        Note If you receive a message to generate wrappers for the libraries that you selected, click Yes.
    3. In the Class1.cs code window, replace all the existing code with the following code:
      using System;
      using System.Reflection;     // to use Missing.Value
      
      //TO DO: If you use the Microsoft Outlook 11.0 Object Library, uncomment the following line.
      //using Outlook = Microsoft.Office.Interop.Outlook;
      
      namespace RetrieveAppointment
      {
         /// <summary>
         /// Summary description for Class1.
         /// </summary>
         public class Class1
         {
            /// <summary>
            /// The main entry point for the application.
            /// </summary>
            public static int Main(string[] args)
            {
               try
               {
                  // Create the Outlook application.
                  Outlook.Application oApp = new Outlook.Application();
      
                  // Get the NameSpace and Logon information.
                  // Outlook.NameSpace oNS = (Outlook.NameSpace)oApp.GetNamespace("mapi");
                  Outlook.NameSpace oNS = oApp.GetNamespace("mapi");
      
                  //Log on by using a dialog box to choose the profile.
                  oNS.Logon(Missing.Value, Missing.Value, true, true); 
      
                  //Alternate logon method that uses a specific profile.
                  // TODO: If you use this logon method, 
                  // change the profile name to an appropriate value.
                  //oNS.Logon("YourValidProfile", Missing.Value, false, true); 
      			
                  // Get the Calendar folder.
                  Outlook.MAPIFolder oCalendar = oNS.GetDefaultFolder(Outlook.OlDefaultFolders.olFolderCalendar);
      
                  // Get the Items (Appointments) collection from the Calendar folder.
                  Outlook.Items oItems = oCalendar.Items;
                  
                  // Get the first item.
                  Outlook.AppointmentItem oAppt = (Outlook.AppointmentItem) oItems.GetFirst();
      
      
                  // Show some common properties.
                  Console.WriteLine("Subject: " + oAppt.Subject);
                  Console.WriteLine("Organizer: " + oAppt.Organizer);
                  Console.WriteLine("Start: " + oAppt.Start.ToString());
                  Console.WriteLine("End: " + oAppt.End.ToString());
                  Console.WriteLine("Location: " + oAppt.Location);
                  Console.WriteLine("Recurring: " + oAppt.IsRecurring);
         
                  //Show the item to pause.
                  oAppt.Display(true);
      
                  // Done. Log off.
                  oNS.Logoff();
      
                  // Clean up.
                  oAppt = null;
                  oItems = null;
                  oCalendar = null;
                  oNS = null;
                  oApp = null;
               }
      
                  //Simple error handling.
               catch (Exception e)
               {
                  Console.WriteLine("{0} Exception caught.", e);
               }  
      
               //Default return value
               return 0;
        
            }
         }
      }
    4. In this code, make any necessary changes where you see the "TO DO" comments.
    5. Press F5 to build and then run the program. Outlook security features may display additional dialog boxes before the appointment information appears. (이부분 때문에 Object Library를 사용하면 안될 것 같다. 그럼? MAPI라는게 있는데 이걸 조사해 봐야겠다.)

    For more information, visit the following Microsoft Developer Network (MSDN) Web site:

    http://msdn2.microsoft.com/en-us/library/aa188489(office.10).aspx (http://msdn2.microsoft.com/en-us/library/aa188489(office.10).aspx)

    For more information about the Outlook 2002 e-mail security features and about how those features can affect custom solutions, click the following article number to view the article in the Microsoft Knowledge Base:

    290500  (http://support.microsoft.com/kb/290500/ ) Description of the developer-related e-mail security features in Outlook 2002
    Posted by 피의복수

    BLOG main image
    일에 필요한 자료 by 피의복수

    카테고리

    분류 전체보기 (40)
    프로그램이야기 (38)
    끄적끄적 (1)
    취미 (0)
    서비스이야기 (1)
    빅데이터 (0)

    최근에 올라온 글