2012-09-12 2 views
1

사용자가 내 서비스에 등록 할 수있는 앱을 만들려고합니다. 문제는 각 사용자를 단일 계정으로 제한 할 수 있다는 점에서 매우 중요하다는 것입니다. 전화 고유 ID 및 창 ID로이 작업을 수행 할 수 있습니다. 애플 리케이션,하지만 지금은 내 문제는 어떻게 그들을 나에게 가져갈 것입니다! 누구든지 내 이메일 주소로 원하는 사용자 이름으로 전화 ID를 보내는 방법을 알려주십시오. 감사합니다고유 한 전화 ID를 이메일로 보내기

편집

나는

public static class ExtendedPropertyHelper 
{ 
    private static readonly int ANIDLength = 32; 
    private static readonly int ANIDOffset = 2; 
    public static string GetManufacturer() 
    { 
     string result = string.Empty; 
     object manufacturer; 
     if (DeviceExtendedProperties.TryGetValue("DeviceManufacturer", out manufacturer)) 
      result = manufacturer.ToString(); 

     return result; 
    } 

    //Note: to get a result requires ID_CAP_IDENTITY_DEVICE 
    // to be added to the capabilities of the WMAppManifest 
    // this will then warn users in marketplace 
    public static byte[] GetDeviceUniqueID() 
    { 
     byte[] result = null; 
     object uniqueId; 
     if (DeviceExtendedProperties.TryGetValue("DeviceUniqueId", out uniqueId)) 
      result = (byte[])uniqueId; 

     return result; 
    } 

    // NOTE: to get a result requires ID_CAP_IDENTITY_USER 
    // to be added to the capabilities of the WMAppManifest 
    // this will then warn users in marketplace 
    public static string GetWindowsLiveAnonymousID() 
    { 
     string result = string.Empty; 
     object anid; 
     if (UserExtendedProperties.TryGetValue("ANID", out anid)) 
     { 
      if (anid != null && anid.ToString().Length >= (ANIDLength + ANIDOffset)) 
      { 
       result = anid.ToString().Substring(ANIDOffset, ANIDLength); 
      } 
     } 

     return result; 
    } 
} 

지금 내가 전송 한 후 (난 정말 출근하지 못할 것) 변수 살전 저장하고 필요 필요한 값을 얻기 위해이 코드를 사용 그 (것)들을 추출하는 나의 PHP 원본에 그 (것)들을

이외에 나는 사용자에게 그의 이메일 주소를 입력하고 이것을 POST에 역시 포함하도록 요구할 필요가있다, 할 수있다 y 도움이 필요하십니까?

답변

0

DeviceExtendedProperties.DeviceUniqueIdMicrosoft.Phone.Info 네임 스페이스에서 가져올 수 있습니다.

var emailComposeTask = new EmailComposeTask 
{ 
    To = "[email protected]", 
    Subject = "Test Message using EmailComposeTask", 
    Body = deviceId 
}; 
emailComposeTask.Show(); 
: 당신이 당신의 이메일이 ID를 보낼 수 있습니다, 그리고 here

을 MSDN에

<Capabilities> 
    <Capability Name="ID_CAP_IDENTITY_DEVICE"/> 
    <Capability Name="ID_CAP_IDENTITY_USER"/> 
</Capabilities> 

링크 : 이 같은 WMAppManifest.xml

에 선언하는 것을 잊지 마세요

하지만 이메일 클라이언트가 열리 며 그 사용자가 친절하게 이메일을 보낼 수 없습니다. 그래서, 당신은 더 나은 전자 메일에 대해 서버

 private void Button_Click(object sender, RoutedEventArgs e) 
    { 
     //collect all data you need: 
     var deviceId = Convert.ToBase64String(ExtendedPropertyHelper.GetDeviceUniqueID()); 
     var userName = ExtendedPropertyHelper.GetWindowsLiveAnonymousID(); 
     var manufatcurer = ExtendedPropertyHelper.GetManufacturer(); 
     //create request string 
     //[see the explanation on MSDN][2] 
     var requestUrl = string 
    .Format("http://myPageUrlAddress.com/script.aspx?deviceid={0}&user={1}&manufacturer={2}", 
    deviceId, userName, manufatcurer); 


     System.Uri myUri = new System.Uri(requestUrl); 
     //create a request instance 
     HttpWebRequest myRequest = (HttpWebRequest)HttpWebRequest.Create(myUri); 
     myRequest.Method = "POST"; 
     myRequest.ContentType = "application/x-www-form-urlencoded"; 
     //and it will be sent. 
     //Also you need to create GetRequestStreamCallback method to 
     //handle server responce. 
     myRequest.BeginGetRequestStream(new 
     AsyncCallback(GetRequestStreamCallback), myRequest); 
    } 
    //this method is empty. You can show tha dialog box about successful sending. 
    public void GetRequestStreamCallback(IAsyncResult result) { ; } 

무엇에 POST 요청을 보낼 것 - 그냥 같은 페이지에 텍스트 상자를 만들고 변수에 사용자 입력을 저장합니다.

0

"내 서비스"가 웹 서비스 인 경우 메일 시스템 대신 웹 서비스를 사용할 수 있습니다.

Convert.ToBase64String (phoneId)을 사용하여 전화 ID를 문자열로 변환 할 수 있습니다.

WP7에서 메일을 통해 문자열을 보내려면 EmailComposeTask를 사용해야합니다.

관련 문제