Can't read service messages in Redmi Note 3 - android

Have taken all the necessary permissions for reading SMS in android but app is still not able to detect "service messages" on Redmi Note 3. Is there a special permission in Xiaomi devices to read service messages?

If your phone with API 23 or higher (I think the same should work in lower versions also) goto Settings -> Permissions -> Other Permissions. (be sure that you asked required permissions programmatically if you're targeting API 23 or higher version of Android)
There you can find 2 tabs App and Permissions. Select Permissions tab under that select SMS and MMS option. Now choose your app and Accept/Allow to read Service SMS.
If you're using lower version than 23 use Security app (which is built in app Redmi phones) and there you can find Permissions app for the installed apps.

I am also facing same problem in my Mi Note 3. No apps reading my messages, every time i need to enter OTP.
I think it is good feature from RedMi.
Now I solved this problem with following steps.
Goto Setting->Permissions -> Permissions -> their you select app and accept Read SMS messages

Related

Nearby Connections API: Android 12 fails to advertise and discover devices with unknown status codes (8037, 8038, 8039)

I'm developing an app that uses Nearby Connections API with basic P2P strategy. Suddenly, weirdly enough I'm not able to advertise and discover devices on my Pixel 3a with newest Android 12 and Play Services. OnFailureListeners throw these exceptions:
for discovering: 8037: unknown status code: 8037
for advertising: 8038: unknown status code: 8038
Indeed they cannot be found in docs and source code.
I also checked Google's "Rock Papers Scissors" official sample and it throws the same error codes.
Of course I reinstalled the app and restarted & updated my phone. EDIT: I also did the factory reset and it didn't help. But after I downgraded to latest Android 11 using Android Flash Tool, it started working again. Moreover, everything still works fine on Android 11, 10 and 9 using different phones.
Any ideas what causes this issue? It just worked fine for last two weeks and stopped working today. I believe it needs some deep investigation in source code (Xlythe if I may ask for your help, that would be really great).
After a while I finally managed to find a solution. It looks like Nearby Connections (all Nearbys?) have a critical bug on Android 12 that happens non-deterministically (API can work fine for few weeks then suddenly will throw these errors for another few weeks).
This bug is related to Android 12's feature change related to Bluetooth. Quoting:
Android 12 introduces the BLUETOOTH_SCAN, BLUETOOTH_ADVERTISE, and BLUETOOTH_CONNECT permissions. These permissions make it easier for apps that target Android 12 to interact with Bluetooth devices, especially for apps that don't require access to device location.
In other words, some Bluetooth permissions are now legacy and there are some new permissions that are mandatory to make the API work. And you need to handle both scenarios in your code (before and after Android 12).
So here's a quick "mapper" from error codes to Manifest's permissions:
Error code 8037 while discovering - you haven't granted permission
for BLUETOOTH_SCAN
Error code 8038 while advertising - you haven't granted permission for BLUETOOTH_ADVERTISE
Error code 8039 (that's a new one as well) while onEndpointFound - you haven't granted permission for BLUETOOTH_CONNECT
More information how to implement new permissions properly can be found in documentation.
And I'm still waiting for Google to fix it in next Nearby API update as this is a little bit of workaround. Adding proper error messages to codes might be a little work to do but I would also revise if other permissions are still required after Android 12's update.

Build.GetSerial() returns unknown on API 29

I cant get serial on android 10 device.
I know about everything(permission, runtime permissions, I get serial only after the permission is granted) from here
android Build.GetSerial() throwing exception
My code works on all android versions, except 10
Do you have any ideas?
If you follow the official documentation here: https://developer.android.com/reference/android/os/Build.html#getSerial(), more info on Android 10 changes here
You will notice that starting from Android 10 this method is returning Build.UNKNOWN. You can't use it to uniquely identify a single device anymore
You need to switch to the "less" persistent version called Settings.Secure.ANDROID_ID
The only ways to bypass this restriction are:
Create a system app to be able to get the READ_PRIVILEGED_PHONE_STATE system permission (a normal app can't get this).
Be registered as a carrier (which requires you to have built the Android ROM)
Have a custom "work profile" to set your own policies in the device.
As you can imagine, all those options are not meant to be used by standard android app developers

below 23 android xiaomi devices permission

So I have camera permission in manifest , Still when app goes to start camera it crashes .this happens beacuse user had denied the permission in permission manager for camera that comes with xiaomi devices
So the app Crashes , can someone help about how to handle this.
with the normal way of getting permisions , it does not give correct result
String permission = "android.permission.CAMERA";
int res = getContext().checkCallingOrSelfPermission(permission);
res is always 0(has Permission) for below 23 devices , if user has manually denied permission by going to permission manager then also
Revoking permissions on android devices below 23 is non-standard behavior and is afaik only possible through customized OS versions (like Cyanogen mod or in your case, the Xiaomi modified version). Users should be aware, that revoking permissions that way may cause error ins apps.
Prior to Android 6.0, you could reasonably assume that if your app is running at all, it has all the permissions it declares in the app manifest.
https://developer.android.com/training/permissions/best-practices.html#testing
Therefore I suggest you run your methods that require a certain permission with a try/catch. If the api lvl is below 23 and your method call fails, you know for sure if you have the permission or not.

Android Beacon Library and Update 6.0.1

Yesterday I updated my Samsung Galaxy S5 Neo to the new Android Version 6.0.1. Since then the beacons won't be detected anymore. It does connect the Beacon Service, Updates the scan perios, etc. but it doesn't find any beacons.
Bluetooth is activated and the Beacon scanner of the Beacon Manifacturer still works fine (finds all the beacons). But not my app... It all worked before the new Android Update.
A few things to check:
Verify Location is enabled in Settings -> Location. This must be set to High Accuracy or Battery Saving. If set to Device Only, it won't work. Starting with Android 6, Location must be enabled to do bluetooth scans.
Make sure your app has been granted location permission. Check Settings -> Apps -> Your App -> Permissions, and verify the Location slider is set to on. Starting with Android 6, each app must dynamically request location access at runtime. If your app doesn't have code to do this, you'll need to add it. (Although it is possible to override in settings as described here.)
Make sure your app's manifest declares either FINE_LOCATION or COARSE_LOCATION in its declared permissions.
If the above don't help check LogCat (not just filtering on your application) for bluetooth errors.
See here for more info on the above.

Android's ContextCompat.checkSelfPermission() returns incorrect value

I am trying to check for permissions being granted/revoked by user in Android Marshmallow. Unfortunately ContextCompat.checkSelfPermission() (which is a warpper around Context.checkCallingOrSelfPermission) seems to always return PackageManager.PERMISSION_GRANTED (0) if you have included that specific permission in your manifest regardless of the current state of the permission (e.g. if the user has revoked the permission). I also tried someContext.checkCallingOrSelfPermission(), but the result is the same.
Has anyone experienced this? I am using Android Marshmallow on nVidia Shield console (using nVidia's Beta program).
As it turns out, The targetSdkVersion in the manifest must be 23, mine was 22. If your target SDK is 23 (Android 6), all of the permissions (in your manifest) are disabled by default, whereas if your target SDK is 22 (Android 5.1) and your app is running on Android 6, all of the permissions are enabled by default when the user installs the app, and even if the user revokes the permissions later on, the mentioned API returns incorrect value (which is a bug in my opinion).

Categories

Resources