How to access Sprint NAI programmatically - android

Sprint Android Devices have a Network Access Identifier (NAI) which can be viewed by typing in ##data# (##3282#), View and Data Profile. The NAI/UserName is the top line which looks like an email address.
Is it possible to access this information with an API programmatically?

As I understand it, this value should exist in the Android system property persist.radio.cdmi.nai. See https://stackoverflow.com/a/11623309/550808 for how to read Android system properties from your app.

Related

Cannot save Android APNSetting

I am using APNSetting API as described https://developer.android.com/reference/android/telephony/data/ApnSetting.Builder.
I am able to create the APNSetting as an object in my application, but I need to save this APN setting to the shared APN list of the device (Settings - Mobile networks – Access Point Names) . The building of the object seems is not enough. No idea how to solve this. Am I missing any permission of something else that needs to be implemented? No error or warning is raised. I am using a 28+ API level device. Thank you very much for any help.

In web-based apps, how do I call a user's IMEI / UDID to the end of my web-based app's URL?

I'm making a pair of website-based apps for both Android and iOS interfaces, and I'm struggling with a part of it. Perhaps you guys could help me out!
I'm using Android Studio and Xcode, and launching the website through WebKit and WK WebView respectively. It's super simple, just an app which calls a website into it directly. No external navigation, nothing but a full-page website. And this part is working great!
But I do have one problem! I don't want my users to get consistently logged out if they close the app, or after a few hours of not using it. I'd like it to stay logged in for them, or to automatically log-in when they use it.
The maker of the website has given me a way to do this through the URL.
Basically, my URL currently is set up like "https://URL.com/x/y/z" and it goes to the website, and that is great, but I need to set it up to be "https://url.com/x/y/z/[insert user's IMEI or UDID here]". That unique ID from their Android device will keep them logged in. I've tested it using my own device with my own IMEI and it works great, but obviously using one specific identifier for everyone will not work. I just need it to call the specific user's IMEI or UDID into the URL, to complete it.
How should I go about this?
I am assuming that you are talking about an Android app that visualizes a website in an activity. On Android, you can retrieve the device's IMEI OR MEID string by calling:
android.telephony.TelephonyManager.getDeviceId().
But be warned, this requires that you add a permission to your manifest:
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
You should inform your users why you are requesting this permission.
For iOS/Xcode, you can get the device UUID via UIDevice:
// Swift 4
let uuid = UIDevice.current.identifierForVendor!.uuidString
If you are targeting iOS 11 or newer, Apple introduced Device Check to get a device specific token. I personally haven't used it, but it sounds like it's use case is similar to what you're looking for.
Update:
From your comment, here is how'd you include it in the url string.
let urlString = "url.com/x/y/z/" + uuid

How can I know my app was previously installed on a phone?

I am trying to make an app which allows only single account per device. Now what I am trying to know is a property of a phone which never changes. At first I thought I could save MAC address of a device in my database but I read in one of the question on SO that know in android when we try to access MAC address programatically we get a constant that is same for every device.
I would like to know what never changing property of an android device can I access programatically.
Also in future I would like to develop that app for iOS, is there same non changing property of iOS phone that I can access programatically ?
Thank you.
For this purpose, you have to differentiate between devices.
For Android, you can use Device ID
For IOS, You can use vendor ID link.
For IOS : When your app deleted and reinstalled then vendor ID changes so it is better to store your vendor id in keychain using below code.
-(NSString *)getUniqueDeviceIdentifier
{
NSString *yourAppName=[[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString*)kCFBundleNameKey];
NSString *applicationUUIDStr = [SSKeychain passwordForService:appName account:#“Your_App_Name”];
if (applicationUUIDStr == nil)
{
applicationUUIDStr = [[[UIDevice currentDevice] identifierForVendor] UUIDString];
[SSKeychain setPassword:strApplicationUUID forService:appName account:#"Your_App_Name"];
}
return applicationUUIDStr;
}
Im pretty sure these days you can use mac addresses, however if not have you tried IMEI, i have no idea how this would be done.

Getting Device Info for Licensing in Android App (Xamarin)

I am working on an APP using Xamarin MonoTouch, this App requires custom licence key as provided by us. To identify each and every installation we have to store some kind of device information to control misuse of App.
After trying various ways, now the problems are:
Device Id or Android id : gets changed every time a device is factory reset or format.
Settings.System.GetString(this.ContentResolver, Settings.Secure.AndroidId);
IMEI Number: No SIM Tabs dont have. Double SIM phones have no fix slot wise imei and sends randomly chose one.
var telephonyManager = (TelephonyManager)GetSystemService(TelephonyService);
string imei = telephonyManager.DeviceId;
WIFI Mac Address: Good way but some sets like HTC and Chinese ones throwing exception while retrieving mac address, but works some time. SO not getting fix id everytime app starts.
WifiManager wm = (WifiManager)GetSystemService(WifiService);
string macid = wm.ConnectionInfo.MacAddress;
So everytime any of the above ID fails, user needs to re register app again and again. Do we have any fool proof way of doing this?
Ok, as per comment by Matt, since there is not fool-proof method of getting unique id from an android device. So I have made a provision of validating installations against WIFI Mac ID and Android ID both. If any one of these found matched then installation is genuine or spoofed.

Share WiFi-Settings as QR-Code for WPA2 Enterprise

I have found several sources describing a String Format used to describe WiFi-Access Settings in the form of:
WIFI:T:WPA;S:mynetwork;P:mypass;;
(example taken from zxing documentation)
For basic WPA-Connections, this works just fine on my Android Device using the Zxing-Barcode-Scanner-App. However, I have been unable to find a way to embed WPA2/EAP-Connection Settings (Also referred to as WPA2 Enterprise) into a scannable 2D-Code. As I expected, inserting "L" (Login), "N" (Name) or "I" (Identification) Parameters at random positions did not really bring any advance.
Has anyone here succeeded in "embedding" WiFi-Connection Settings into a 2D-Scannable Code to work with an Android device?
Thanks for your help!
I found some information on how to format the WiFi config string in the following pull request at the github page of the zxing library project: https://github.com/zxing/zxing/pull/865
The first post contains a template of the string format, including an error (the prefix AI: is wrong, it must read A:, see here). The correct format according to the source is thus:
WIFI:T:WPA2-EAP;S:[network SSID];H:[hidden?];E:[EAP method];PH2:[Phase 2 method];A:[anonymous identity];I:[username];P:[password];;
When I tried this (using the command line tool qrencode) my Barcode Scanner app crashed. After some trial and error I figured that the option for hiding the SSID can be left out:
WIFI:T:WPA2-EAP;S:[network SSID];E:[EAP method];PH2:[Phase 2 method];A:[anonymous identity];I:[username];P:[password];;
With this I'm getting a working entry in the list of known wireless networks in Android 8.
As of now there is no support for declaring a certificate and the respective domain. If this is needed, one can specify it later by adjusting the settings from inside Android's WiFi menu.

Categories

Resources