Re: [android-developers] can we know the phone no of the device.

2011-09-22 Thread kdı gjofd
READ_PHONE_STATE permission you should add...
But if it is Tablet PC or mp4 player for android(not now) it will
return null..You can try catch block for good performance

2011/9/21, TreKing :
> On Wed, Sep 21, 2011 at 2:46 AM, krishna chaitanya <
> chaitanya.ju...@gmail.com> wrote:
>
>> its showing the number in the emulator, but when ran on the device
>> its giving null..
>>
>
> http://developer.android.com/reference/android/telephony/TelephonyManager.html#getLine1Number()
>
> -
> TreKing  - Chicago
> transit tracking app for Android-powered devices
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to android-developers@googlegroups.com
> To unsubscribe from this group, send email to
> android-developers+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


Re: [android-developers] can we know the phone no of the device.

2011-09-21 Thread TreKing
On Wed, Sep 21, 2011 at 2:46 AM, krishna chaitanya <
chaitanya.ju...@gmail.com> wrote:

> its showing the number in the emulator, but when ran on the device
> its giving null..
>

http://developer.android.com/reference/android/telephony/TelephonyManager.html#getLine1Number()

-
TreKing  - Chicago
transit tracking app for Android-powered devices

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

[android-developers] can we know the phone no of the device.

2011-09-21 Thread krishna chaitanya
hi all,

I checked with one code like

  String ts = Context.TELEPHONY_SERVICE;

TelephonyManager telephonyManager = (TelephonyManager)
getSystemService(ts);


Toast.makeText(this, "Phone
no:"+telephonyManager.getLine1Number(), Toast.LENGTH_SHORT).show();

its showing the number in the emulator, but when ran on the device its
giving null..

thanks in advance

Krishna.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en