爲跳過繁瑣的用戶登錄註冊而存在

背景:最近一個項目希望有評論功能,而又不希望添加繁瑣的註冊登錄模塊。

做法:尋找針對每臺手機的唯一串號,保存下來作爲用戶的唯一標示。

 Context context = getWindow().getContext();        
 
 TelephonyManager telephonemanage = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);              
 
  try{     
 
   Toast.makeText(this, "MIEI碼爲:"+telephonemanage.getDeviceId(), 1000).show();      
 
  }    
 
  catch(Exception e){     
 
   Log.i("error", e.getMessage());  
 
  }
 
權限:
 
   <uses-permission android:name="android.permission.READ_PHONE_STATE"></uses-permission>


 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章