How to get IMEI of a device post API level 29 - Java for Android App Development

In the Android developer documentation here https://developer.android.com/reference/android/telephony/TelephonyManager#getImei() it says that one of five requirements needs to be met in order for the IMEI to be returned with getImei
1. If the calling app has been granted the READ_PRIVILEGED_PHONE_STATE permission; this is a privileged permission that can only be granted to apps preloaded on the device.
2. If the calling app is the device owner of a fully-managed device, a profile owner of an organization-owned device, or their delegates (see DevicePolicyManager.getEnrollmentSpecificId()).
3. If the calling app has carrier privileges (see hasCarrierPrivileges()) on any active subscription.
4. If the calling app is the default SMS role holder (see RoleManager.isRoleHeld(java.lang.String)).
5. If the calling app has been granted the Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER permission.
For #1, I need to install an app on a device and get the IMEI, is this method not possible?
For #2, I successfully ran the command adb shell dpm set-device-owner on an installed app and getIMei() still returned null, but the device was not a fully-manged device. What is the easiest way to make a device fully-managed without having to pay a fee?
For #3, How do you get carrier privileges for an app?
For #4 How do you set the app as the default SMS role holder?
For #5 How do you get granted the Manifest.permission#USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER permission.

Related

[How-To]Simpler Unknown Sources Checkbox

Hey everyone. I saw that there's a whole topic on this, with some INSANE methods for enabling this. (Such as bringing something over to your computer, and what-not)
Required:
SQLite from Market
Root (SuperOneClick, z4Root, whatever)
1. Go into SQLite
2. Scroll to com.motorola.android.providers.settings (Settings Storage)
3. Tap settings.db
4. Tap settings
5. Scroll down to _id70 force_only_market_apps
6. Set the 1 in the value field to 0
Voila. Unknown Sources. All done from your phone.
That's a quick fix. So that is the only file that we need to modify? Do we need to change permissions or anything? Im waiting for the phone to get here, will try it when it get here.
The only one. No permissions needed. The SQLite app takes care of everything for you. Only turn-off some people might have is that this is a paid app.
I was able to sideload this app and edit the DB with it to allow non-market apps.
Works wonders...had been waiting forever to do this to my wife's phone...just waiting on ROM now...*excited*
I tried to use and phone said do not have permision. Yes I have root.
Sent from my MB508 using XDA App

Uninstallilng BitDefender Anti-Theft application from Samsung Galaxy S2

How to remove BitDefender Anti-Theft application from Samsung Galaxy S2
Presuming you have BitDefender Anti-Theft application with password enabled:
1) install Root App Delete from Google Play on your phone.
2) Open the Root App Delete application and select the BitDefender Anti-Theft application and click on Uninstall button. It will prompt you that in order to be able to uninstall this app, you need to remove its Device Administrator rights. This application might take you to the Device Administrators settings but if it doesn't then go to: Settings -> Security -> Device Administrators.
3) There you will find the BitDefender Anti-Theft application enabled through a radio button. Unchecking that radio button will prompt you with a pop-up to Deactivare it or Cancel the action. Click on Deactivate.
This action will open the BitDefender Anti-Theft application prompt asking you for the PIN you setup earlier in order to allow you to deactivate it. Just hit Cancel (if the general Back button from the bottom left of your phone doesn't work) and it will automatically skip the PIN identification and it will deactivate the application.
4) Go back and open the Root App Delete application and select the BitDefender Anti-Theft application and click on Uninstall button. This time, will uninstall it for sure
Enjoy.
MENTION: I'm not sure if this procedure requires ROOT. Ive done it on my S2 which is rooted but it might as well work for non rooted devices. Please leave feedback.
Thanks.
This also works on my rooted S4 using normal android uninstall and because of this I won't use Bitdefender aymore. It took me literally 1 min after I've installed the app to figure this out.

Question: Is it safe to log into gmail after rooting?

Hello!
So I recently rooted my Samsung Galaxy S5 (SM-G900i)
I flashed the kltedd .tar.md5 file through odin (downloaded the .tar.md5 file through Chainfire's CF Auto Root Website)
Everything worked, after going through the whole process my phone rebooted and everything seems normal.
All my data has been preserved and it all works fine.
The only problem is to check that my phone actually has root access I need to download one of those root-checker apps from the play store, but I need to sign into my Gmail account to get to the play store in the first place.
I just wanted to know if it is safe to log into my gmail account on a rooted device - is it possible in any way shape or form that I might have a sneaky keylogger or some spy-ware that could potentially see my Gmail password?
Any help would be appreciated
Sincerely, a noob to XDA Forums.
If you have rooted then there should be a SuperSU app or similar, and when you enter it it should tell you somewhere if root is working fine.
There's an easy way to check for root, which doesn't involve any app, but you need to be able to connect the phone to a PC and you will need USB drivers, and to get your hands on adb.exe (or android-tools-adb package on Linux). Assuming you've done that:
* Enable developer options. (Settings > About Phone, tap Build number 10 times, you will get a popup telling you that Settings > Developer options has appeared.)
* Enable "USB debugging mode".
* Connect via USB to the PC.
* Run `adb devices`.
* You will be asked if you want to accept the debug connection, and possible if you want to enable MTP, say "yes" to both.
* Run `adb shell`.
* Once inside the shell you can type "su[ENTER]". The terminal should freeze and you should get a popup from your SuperSU app asking if you want to grant root access to ADB. If you don't get a popup and "su" fails in the terminal, you don't have root. If you don't get a popup but you get a "#" prompt in the terminal, you have root, but you don't have a root controller app, which is not good (anybody can get root).
Another even simpler method would be to use a terminal app... provided you already have one installed. Most custom ROMs do, stock ROMs don't. Then you just use the same "su[ENTER]" stuff in the terminal.
also, you can bypass the whole thing of logging into your gmail acct and go directly into your phones main screen, go into menu, settings, about phone and tap on the build number until you see the message stating that you are now a developer, back up one step, go into developer options, check the box to allow the installation of third party apps and just download the root checker apk from elsewhere. Sounds compllicated, but its easier than CLI stuff for the uninitiated
---------- Post added at 08:45 AM ---------- Previous post was at 08:45 AM ----------
also also, ive never heard of anyone getting a keylogger after merely rooting their phones
It's technically possible if you get your "root app" from random websites. It's a golden opportunity for a hacker, you're practically begging them "please exploit my phone, I'm gonna help by running your app and bypassing all safety measures".
security should be fine as long as you dont lose your device or download apps from unsafe sites.
as for whether it is rooted or not, already answered above.
Good to see another aussie here.
I'm still a bit of a noob too but happy to help with any endevours regarding phone, especially model specific ones (I have G900I too).
wirespot said:
It's technically possible if you get your "root app" from random websites. It's a golden opportunity for a hacker, you're practically begging them "please exploit my phone, I'm gonna help by running your app and bypassing all safety measures".
Click to expand...
Click to collapse
really mate!?
i have my rooted S5 with my 3 gmail accounts logged in
and i didnt have any secuirty issue at all in past and now

OxygenOS Data Mining User Information

It was recently discovered by a security researcher that OxygenOS is hoarding loads of user information, including: application open and close timestamps, screen on and screen off timestamps, the phone’s IMEI(s), phone numbers, MAC addresses, mobile network(s) names and IMSI prefixes, wireless network ESSID and BSSID and the phone’s serial number.
OnePlus' Twitter support was not able to offer a good explanation for this. To those wanting to disable the data mining, you can do so in a few ways.
Without Root:
Using ADB, remove the application.
Activate ADB on your phone and install it on your computer
adb devices to see if you device is attached
adb [-d | -e | -s {serial_number}] shell pm uninstall -k --user 0 net.oneplus.odm
With Root:
You can freeze the services using Titanium Backup (or the like). In addition, you can use an application like AdAway to block the specific host: open.oneplus.net
Of course, installing a custom ROM is another option to remove this data mining.
For full details, check out the entire blog post, here: https://www.chrisdcmoore.co.uk/post/oneplus-analytics/
There's a magisk module too for it.
https://forum.xda-developers.com/oneplus-5/themes/magisk-oneplus-analytics-disabler-t3686636

Google Play Services Error: Wants Permissions

I've been using my Essential phone for over a year without any real problems. From the very beginning I limited the permissions that GPS has access to. I've been using Android phones for a few years, but this is the first time that I haven't rooted my phone and removed GPS pretty quickly. Last week I signed out of my Google account on my phone. I immediately started getting Google Play Services Error messages asking me to enable every single permission for GPS. I don't want to do this. I don't use any Google apps, and I don't think any of the apps that I do use rely on GPS.
I ended up signing back into my account (at which time Google immediately downloaded every Google app that I'd removed from my phone already), but I'm still getting constant permission error notifications from GPS. Seems mostly related to when I'm using the built in dialer. Is there an option short of giving Google permission to my life to stop these error messages? The phone seems to work fine (although reception may be even worse than normal), but could using a 3rd party dialer fix things? Or should I just stop Play Services from being able to give notifications? Or, do I need to just bite the bullet and root and put Lineage on my phone?
Have you considered going the microG route? And maybe it was just frustration speaking, but you don't need to root to install a custom ROM. Just unlock the bootloader ?
ktmom said:
Have you considered going the microG route? And maybe it was just frustration speaking, but you don't need to root to install a custom ROM. Just unlock the bootloader
Click to expand...
Click to collapse
Thanks for that. I'd looked at NoGApps a few years ago, but it wasn't finished enough at the time to work on my device, so I just went without. Had not kept up to date on the evolution, so appreciate you linking me to this.
And I had thought that the bootloader was unlocked on Essential, but you still had to root. Which would have been easier I think, since unlocking the bootloader is usually the difficult step. Will take a look at the instructions and maybe take a stab at this next weekend. Thanks.
The bootloader is unlockable on the PH-1, but you still have to unlock it. If you are using a windows computer, everything you need is on the Essentials developer page. At the bottom of the linked page, is a link to the ADB/Fastboot binaries for windows. If you click through to the current builds, the instructions to unlock are at the bottom, part of the fastboot instructions. Once you're unlocked, you don't need to follow the fastboot flash image instructions.
However, if you're unfamiliar with A/B slot devices, please make sure to read and understand about them. It's different than non-slot services. While long in the tooth, you can start with read the docs - Mata document. Recovery is no longer a separate partition, but when flashed, is embedded into the boot.img. That's also where root goes, and so anytime you flash something that overwrites boot, you lose recovery and root. All manageable, but requires understanding.
An anti-Google ROM alternative might be /e/. It's based on an older build, but it's designed to run without Google. I have no personal experience with this ROM.
Change dialer or root fix
For some reason, Google phone dialer is mad because Play Services doesn't have access to the microphone or body sensors, etc. The solution seems to be changing dialers. I'd like to know what receiver or service triggers this interaction.
Ok, I found something here https://nzeid.net/samsung-galaxy-s10e-root-guide
"Disabling Notifications That Are Grayed Out
If you open the details for an app under "Apps" in "Settings", you will see a "Notifications" button that accesses a menu of all the notifications that the given app is allowed to broadcast. Some system apps have notification settings under this menu that are grayed out. Now that the phone is rooted, you can defeat these restrictions.
Copy the file containing these notification settings to a computer:
Code:
adb shell
su
cp /data/system/notification_policy.xml /sdcard/
exit
exit
adb pull /sdcard/notification_policy.xml
Using any text editor, open the file. You will notice the following XML structure for each app:
Code:
<package name="com.google.android.dialer" show_badge="true" app_user_locked_fields="0" uid="10263">
...
<channel id="com.google.android.gms.availability" name="Google Play services availability" importance="4" sound="content://settings/system/notification_sound" usage="5" content_type="4" flags="0" show_badge="true" deleted="true" />
...
</package>
Notice the attribute "name" with the value "Google Play services availability". That name matches the grayed out item on your phone. Next to it is another attribute called "importance" whose value is "4". If you want the notifications to stop, set "importance" to "0".
In short: set "importance" to "0" to stop notifications. Set "importance" to "4" if you want the notifications.
Once you are done, copy the file back:
Code:
adb push notification_policy.xml /sdcard/notification_policy.xml adb shell su cp /sdcard/notification_policy.xml /data/system/notification_policy.xml
Reboot the phone for good measure."
It works. But I just used a root file manager and text editor to edit the "importance" value to "0". I also changed the "locked" value from "4" to "0" so I can easily turn it back on from the system settings menu for the Phone app and is no longer greyed out.:good:

Categories

Resources