Currenty, We are migrating our Android MediaCAS test application to Android-11 from Android-10.
We are running the application in both AVD-29 & AVD-30.
In AVD-29 we didn't observe any issue. While running the same application in AVD-30 we are facing following issue.
java.lang.SecurityException: Permission Denial: getCurrentUser() from pid=8373, uid=10153 requires android.permission.INTERACT_ACROSS_USERS
E/MediaCas: Failed to create plugin: java.lang.SecurityException: You either need MANAGE_USERS or CREATE_USERS permission to: query user
Sample code:
try {
mMediaCas = new MediaCas(0xF6D8);
} catch (Exception e) {
Log.d("MediacasDebug", "Error" +e);
e.printStackTrace();
}
Note: We observed the same behavior in clearkey cas also
As per the google this issue will be resolved in future android release
Pls refer: https://issuetracker.google.com/issues/179694569
Related
I am creating an app with the use of Android Enterprise.
For that, I added dependencies in the build.gradle file.
implementation 'com.google.apis:google-api-services-androidmanagement:v1-rev84-1.25.0'
I am trying to disable uninstalling application using below code from here
try{
Policy policy = new Policy();
policy.setUninstallAppsDisabled(true);
} catch (Exception e) {
e.printStackTrace();
}
But above code is not working. No any Exception or Warning arise
What I am missing? Not able to found proper documentation that how to use Enterprise Management API.
Using the client library of the Android Management API from an Android app is not enough the manage the device the app is running on. You need to first set up the device as managed. For that you can follow the instructions in the quickstart guide.
1) I implement firebase crashlytics in my react native project.
2) I used below npm
npm install #react-native-firebase/app#alpha
react-native link #react-native-firebase/app
npm install #react-native-firebase/crashlytics#alpha
react-native link #react-native-firebase/crashlytics
3) I can do crash app by programmatically using
async forceCrash() {
firebase.crashlytics().crash();
await firebase.crashlytics().setAttributes({ something:
"something" });
firebase.crashlytics().log("A woopsie is incoming :(");
firebase.crashlytics().recordError(new Error("Error Log"));
}
but i can't error log report in firabase console.
Please give me your value able suggestion. where i am wrong.
React native is not officially supported but developers have been able to use crashlytics with React native. From your snippet of code, it seems that you are try trying make a test crash and send a non-fatal exception at the same time.
If you want to see logs on your crash report, the code should look something like this:
Crashlytics.log("Crash occurred! Bailing out...");
Make sure that you set these logs before your app crashes.
If you want to send non-fatal exception:
try {
throw new NullPointerException("It is Pointer No-Fatal Error");
} catch (Exception e) {
Crashlytics.logException(e);
// handle your exception here!
}
Logs will also appear with non-fatal exceptions as long as they were set before the exception occurs.
Using volley for basic network operations,getting no connection handshake error when adding the project as an module.
While the module works fine in some another project.
On R&D, added retrypolicy but no use still getting the same error.
Here is my code.
https://gist.github.com/fizzysoftware/a895bc2cbd1ad9a048277859f3f23963
It could be one of these two cases:
You try to connect to an HTTP url but it's actually an HTTPS url, or
You try to connect to an HTTPS page but the certificate is not valid.
These are at least the cases I've encountered so far...
Changing the url from Https to Http will work.
In my project also same issues are faced. In Marshmallow its work suffecfully. But in Kitkat version it raised the issue
"com.android.volley.NoConnectionError: javax.net.ssl.SSLHandshakeException: Handshake failed"
For Handling this I used google's auth dependencies. Kindly add the following dependency in your Gradle
compile 'com.google.android.gms:play-services-auth:11.0.2'
And Implement the method for Installing Security Provider in Lower versions, If instalation's required
private void updateAndroidSecurityProvider(Activity callingActivity) {
try {
ProviderInstaller.installIfNeeded(this);
} catch (GooglePlayServicesRepairableException e) {
// Thrown when Google Play Services is not installed, up-to-date, or enabled
// Show dialog to allow users to install, update, or otherwise enable Google Play services.
GooglePlayServicesUtil.getErrorDialog(e.getConnectionStatusCode(), callingActivity, 0);
} catch (GooglePlayServicesNotAvailableException e) {
Log.e("SecurityException", "Google Play Services not available.");
}
}
Then call the method in your activity, before making network operations.
I have an app that uses Android AccountManager (package name: com.mycompany.accounts), that adds accounts to the device and provides a login screen. I have another app (com.mycomp.actualapp), that uses the first app to add/remove accounts.
I can successfully add and remove accounts on Pre Marshmallow devices, using the following permissions in the manifest:
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
When compiling with sdk 22 and targetting sdk 22, these permissions should be automatically granted. The following code:
accountManager.removeAccount(getAccount(), activity, new AccountManagerCallback<Bundle>() {
#Override
public void run(AccountManagerFuture<Bundle> accountManagerFuture) {
try {
Bundle bundle = accountManagerFuture.getResult();
boolean success = bundle.getBoolean(AccountManager.KEY_BOOLEAN_RESULT);
if (success) {
Toast.makeText(activity, activity.getString(R.string.successfully_loggedout), Toast.LENGTH_LONG).show();
afterLogoutSuccess(activity);
} else {
Toast.makeText(activity.getApplicationContext(), activity.getString(R.string.failed_to_logout), Toast.LENGTH_LONG).show();
}
onLogoutListener.onLogoutFinished(success);
return;
} catch (OperationCanceledException e) {
Log.e(TAG,"Operation cancelled exception:", e);
} catch (IOException e) {
Log.e(TAG, "IOException:", e);
} catch (AuthenticatorException e) {
Log.e(TAG, "AuthenticatorException:", e);
}
onLogoutListener.onLogoutFinished(false);
}
}, null);
Fails with the following exception:
java.lang.SecurityException: uid 10057 cannot remove accounts of type: com.mycompany.accounts
at android.os.Parcel.readException(Parcel.java:1599)
at android.os.Parcel.readException(Parcel.java:1552)
at android.accounts.IAccountManager$Stub$Proxy.removeAccount(IAccountManager.java:897)
at android.accounts.AccountManager$7.doWork(AccountManager.java:900)
at android.accounts.AccountManager$AmsTask.start(AccountManager.java:1888)
at android.accounts.AccountManager.removeAccount(AccountManager.java:897)
at com.mycomp.actualapp.utils.LoginHelper$4.doInBackground(LoginHelper.java:282)
at com.mycomp.actualapputils.LoginHelper$4.doInBackground(LoginHelper.java:242)
at android.os.AsyncTask$2.call(AsyncTask.java:295)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
The strange thing, is that this code runs fine on Pre Marshmallow devices without any issues.
On a side note, I noticed that compiling with sdk 22 and targeting 22: Going to "Settings > Apps > My app(com.mycomp.actualapp) > Permissions" I see only two permissions, "Phone" "Storage".
I noticed that compiling with sdk 23 and targeting 23: I see three permissions, "Phone", "Storage" and "Contacts".
I have tried the following:
Switching to compile with sdk 23 - grant all permissions in app settings, try remove account again. Still fails with the same exception.
Compile with 22 and add the following permissions to the manifest. Make sure all permissions are granted. Still fails with the same exception:
<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
<uses-permission android:name="android.permission.WRITE_CONTACTS"/>
I am able to get the users account username and token without additional permission granting, but the removing of accounts doesn't work.
I would really appreciate any help!
I know this is late to answer but I thought I would share my findings in case anyone else is in the same situation.
I upgraded my build to build with 23 instead of 22 as I couldn't solve it on 22. Then I explicitly asking for the permission at runtime to GET_ACCOUNTS before trying to do anything with them.
https://developer.android.com/training/permissions/requesting.html
https://developer.android.com/reference/android/Manifest.permission.html#GET_ACCOUNTS
Further information for compiling with 23: You don't need to ask permission if the app shares the signature of the authenticator that manages an account. In this case, my signatures didn't match so I did need to request it. If you create an account within your app to be used within your app, you do not need to request permission at runtime.
I suddenly was stuck in the same thing yesterday.
In my case, I defined wrong package name in node.
Just fix it and it will work perfectly.
<account-authenticator>
xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="Your correct packet name here" + ".accounts"
android:icon="#drawable/ic_launcher"
android:label="xxx"
android:smallIcon="#drawable/ic_launcher"
>
</account-authenticator>
If your package name is:
com.example.android then the account type should be: com.example.android.accounts
Checking in the source code, you can removeAccounts in two cases:
the account is created by your app
your app is a system app
Source: https://android.googlesource.com/platform/frameworks/base/+/05c9ecc/services/core/java/com/android/server/accounts/AccountManagerService.java#1336
I'm trying to use Microsoft Translator for an Android app but it keeps throwing the same exception of "access":
"**java.lang.Exception: [microsoft-translator-api] Error retrieving translation : datamarket.accesscontrol.windows.net**"
Basically I'm running it on Android 2.3, I'm using the Java API ( https://code.google.com/p/microsoft-translator-java-api/ ), and I have registered for the translator in the Windows Azure Marketplace ( https://datamarket.azure.com/developer/applications/register ).
My core code is the following
Translate.setClientId("MY CLIENT ID");
Translate.setClientSecret("MY CLIENT SECRET");
try {
String translatedText = Translate.execute(word, Language.ENGLISH, Language.PORTUGUESE);
tvTranslation.setText(translatedText);
}
catch (Exception e) {
tvTranslation.setText(e.getMessage());
}
I even downloaded and ran this project, but got the same error: https://github.com/boatmeme/microsoft-translator-java-api
And this as well: http://mycodeandlife.wordpress.com/2013/02/05/android-tutorials-language-translator-app/
Any ideas? I spent the whole day on it and couldn't get anywhere.
This was very basic, but I found out the error was due to the (lack of the) Internet permission on Android.
Just needed to add it to my manifest:
<uses-permission android:name="android.permission.INTERNET"/>