Android: Getting phone owner info - android

Since there is the permission called
android.permission.READ_OWNER_DATA
there MUST be a way to read the phone owner info on an android device.
The only thing I could find on the net is this:
Uri uri = Uri.withAppendedPath(Contacts.People.CONTENT_URI, "owner");
Cursor c = managedQuery(uri, null, null, null, null);
But 1) that doesn't work (owner path unknown) and 2) Contacts.People is deprecated (I guess this should now be ContactsContract.Contacts.CONTENT_URI)
I can't even get the mobile phone number of the device using the TelephonyManager (getLine1Number) ... even the built-in phoneinfo screen shows "unknown" for the phonenumber.
Anyway, seems like I can't figure it out on my own and can't find anything useful on the web either (except for the outdated (?) code above). Although I believe the above approach must be the right one (using some content provider that provides the owner info). There simply is no documentation about this except that Android provides the permission setting "android.permission.READ_OWNER_DATA" but no info about how to actually do that kind of thing.
Does anybody know how to get to the phone owner info (name, address, email, phone, ...) on Android? Thanks a mill!
(Background: Developing on Android SDK 2.1, Testing on Emulator and HTC Desire)

Android is open source. It seems, based on searching for READ_OWNER_DATA, that the "/people/owner" path in the contacts provider returns a cursor with some sort of owner information — assuming that information has been entered already by the user.
You'd have to double check the AOSP to see if that still applies for the newer contacts API.

this permission was removed
see :
http://developer.android.com/sdk/api_diff/9/changes/android.Manifest.permission.html

Related

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

In Android : How to listen/monitor a specific app's network activities

I want to know to write a app to monitor the default browser in Android. Is it possible?
record the URL the user visit and the time when the user visit.
get the browser bookmarks.
Short answer: 1. no, 2. short of
Longer answer:
Androids default API doesn't allow this. If you modify the device firmware (custom ROM) this might be possible by providing a modified version of the Android System WebView app. You would need to make changes to this app which allow other apps to monitor the URL's loaded.
In older versions of Android you could obtain the the browser bookmarks using the following code (Since Android 6.0 this isn't supported anymore: Android 6.0 changes):
final String[] columns = {Browser.BookmarkColumns.TITLE, Browser.BookmarkColumns.URL};
Cursor query = getContentResolver().query(Browser.BOOKMARKS_URI, columns, null, null, null);
query.moveToFirst();
while (query.moveToNext()) {
String title = query.getString(query.getColumnIndex(Browser.BookmarkColumns.TITLE));
String url = query.getString(query.getColumnIndex(Browser.BookmarkColumns.URL));
}
You do also need the following permission:
<uses-permission android:name="com.android.browser.permission.READ_HISTORY_BOOKMARKS"/>

obtaining the user name of any user

I am currently using the following code to obtain the current user name:
String username;
{
Cursor c = ctx.getContentResolver().query(Profile.CONTENT_URI,
new String[]{Profile.DISPLAY_NAME}, null, null, null);
if (c.getCount() > 0)
{
c.moveToFirst();
username = c.getString(0);
}
On my test device (Samsung Galaxy Tab Pro), with the correct permissions, this works well for the "owner" user, as well as other non-restricted users. However, things seem to fall apart for limited user profiles:
The code always returns zero cursor rows. I had hoped that enabling access to the Contacts app would allow it to work, but that has no effect.
At any rate, unlike non-limited profiles, the profile of the limited user account does not seem to be connected to the name displayed on the lock screen, so even if I could get this code to work I'm not sure how useful it would be.
Please forgive the multi-part question, but:
Is this a peculiarity of the Samsung tablet, or is this behavior consistent across devices?
Is there any way to read the profile of a limited user?
Is there a better way to obtain the current user name?
Any insight appreciated.
I have tried to search about it & can say it's not possible to get details of "Restricted Profile (User)".
In background when you try to read details for "Restricted Profile user" they are trying to change in database and throw SQLiteexception : delete then re-write existing database throws SQLiteReadOnlyDatabaseException on getWritableDatabase. due to this exception I don't think there is chance to read user name.
Without use your above code you can get directly call getUsername() of UserManager class.[API Level 17]

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.

Access Android Emails through Content Provider

I have four questions regarding Android default email program. Please help me to answer the questions respectively.
Thanks in Advance
1) How can we access the Device Database?
2) How can we setup email on Emulator?
3) Can we read Email Content Through Email Content Provider like (AttachementProvider.java)
I have found in Git
4) Can anyone tell me the correct Email URI
I have found the URI that is not working
"content://com.android.email.attachmentprovider"
1) How can we access the Device Database ?
You can't.
2) How can we setup email on Emulator ?
I would assume that you tap on the icon in the launcher and follow the prompts, the way you would set it up on a regular phone. Bear in mind that this application may not exist on all phones.
3) Can we read Email Content Through Email Content Provider like ( AttachementProvider.java) i have found in Git
There is no documented and supported API for any email client in the Android SDK.
4) can any one tell me the corret Email URI i have found the URI that is not working "content://com.android.email.attachmentprovider"
I repeat, there is no documented and supported API for any email client in the Android SDK. You have been specifically told not to use undocumented content providers, since they will be changed without warning and, again, may not exist on all devices.

Categories

Resources