0

I'm using Cordova and the band would be required for display purposes. I could have the user input it, but if I can snag it programmatically that'd be preferred.

edhedges
  • 2,722
  • 2
  • 28
  • 61

2 Answers2

2

Ok , There are couple of Android implementation to accomplish that , U have to wrap that as a plugin which returns the result after onDeviceReady. The Android Implementations are

1.You can try to access their information stored in a Google account, requiring the GET_ACCOUNTS permission

2.There is also a READ_PROFILE permission and which can be done by accesing ContactsContract.CommonDataKinds` , but it gives only a possibility of finding user info. U have to check Android Version as well .

So Basically all the Android Native code would be wrapped as Cordova Plugin which returns u a possible dataset of values.

See These Links as well.

http://developer.android.com/reference/android/provider/ContactsContract.CommonDataKinds.html

https://gist.github.com/imminent/4061516

This is Android Implementation but it could me made as a plugin .

How to make a cordova plugin :- http://www.mat-d.com/site/tutorial-creating-a-cordova-phonegap-plugin-for-android-app/

Some StackOverflow links

How can I get the google username on Android?

I have done something similar with my project , it gets user details and user specific role from a private AppStore and renders Different UI and Screens Based on Roles.

Hope this Helps.

Community
  • 1
  • 1
IamKarim1992
  • 646
  • 5
  • 20
1

On iOS you'll have to create a plugin that executes this code

[[UIDevice currentDevice]name]
jcesarmobile
  • 51,328
  • 11
  • 132
  • 176