• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to get phone number from my android app?

 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
i have written this simple code to get phone number programaticly

it doesnt give any output...

any idea?

 
Tim Moores
Saloon Keeper
Posts: 3326
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you verified that the code is being run?
 
Pramod P Deore
Ranch Hand
Posts: 632
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you had set permission in manifest as permission READ_PHONE_STATE
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

yes,i hav given permission in manifest.
still no output
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and is it possible to get the andriod version,model of phone and network from my app code??
if yes how?
 
Tim Moores
Saloon Keeper
Posts: 3326
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tim Moores wrote:Have you verified that the code is being run?
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i tried to run but no output....many say dat it is running while some say its not sure
 
Suzzane Pinto
Ranch Hand
Posts: 214
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and is it possible to get the andriod version,model of phone and network from my app code??
if yes how?
 
Tim Moores
Saloon Keeper
Posts: 3326
61
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
and is it possible to get the andriod version,model of phone and network from my app code?

Check android.os.Build.VERSION, android.os.Build.MODEL, android.os.Build.MANUFACTURER and android.net.ConnectivityManager.
 
Tim Moores
Saloon Keeper
Posts: 3326
61
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your first step should be to verify positively that the code runs, for example by writing something to the Log.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!