安装应用程序的位置我想检索该电话的电话号码,然后将其发布到服务器上。这可能吗?检索电话号码
TelephonyManager tMgr = (TelephonyManager)mAppContext.getSystemService(
Context.TELEPHONY_SERVICE);
mPhoneNumber = tMgr.getLine1Number();
这会得到我的应用程序的安装位置..?
安装应用程序的位置我想检索该电话的电话号码,然后将其发布到服务器上。这可能吗?检索电话号码
TelephonyManager tMgr = (TelephonyManager)mAppContext.getSystemService(
Context.TELEPHONY_SERVICE);
mPhoneNumber = tMgr.getLine1Number();
这会得到我的应用程序的安装位置..?
这个PROG为我工作
我认为这将帮助ü....
import android.app.Activity;
import android.os.Bundle;
import android.telephony.TelephonyManager;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
public class GetSimActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button tmpbtn = (Button) findViewById(R.id.button1);
tmpbtn.setOnClickListener(new View.OnClickListener() {
public void onClick(View arg0) {
// TODO Auto-generated method stub
TelephonyManager telMgr = (TelephonyManager)getSystemService(TELEPHONY_SERVICE);
Toast toast = Toast.makeText(getApplicationContext(), "Mobile Number : "+ telMgr.getLine1Number(), Toast.LENGTH_SHORT);
toast.show();
toast = Toast.makeText(getApplicationContext(), "Sim Serial Number : "+ telMgr.getSimSerialNumber(), Toast.LENGTH_LONG);
toast.show();
}
});
}
}
而且u必须在明显
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
@Radha库马尔:提到这一点 – Naresh 2012-04-25 07:41:14
添加权限检索电话后号码,你可以通过请求发送给服务器。
Request request = new Request("your-server/your-file?your-parameters);
是的,这是可能的。你有什么尝试? Google是你的朋友。 – Cristian 2012-04-23 03:40:31
你能帮我解决这个问题..代码部分.. – 2012-04-23 03:41:08
如果你努力解决你的问题,人们只会付出努力。要求编写代码的代码可能会被忽略,请求在特定区域或特定样本中获得帮助的人可能会有更好的回应机会。 – 2012-04-23 04:00:01