What does ADMManifest.checkManifestAuthoredProperly() actually do? - android

Amazon Device Messaging has a static method used to ensure that the AndroidManifest.xml file is setup properly to allow for ADM messages to be sent and received. It is a void method. What does this method actually do? What happens when the manifest is not setup correctly?

From the Amazon developer forum:
The manifest check method queries Android's package manager to ensure you have the correct entries in your manifest (permissions, exported receiver). It also checks that you have an API key embedded, but does not check if it is valid. If any of these checks fail, it throws an IllegalStateException.
Also worth nothing: the manifest checker is intended to be used during ADM integration to quickly find issues in your manifest, and should not be put into the critical path of your application

Related

Android Google Play - SMS and Call LOG issue [duplicate]

I searched through my Flutter project, also the plugin directories and tried to find out where the required Android permissions are coming from.
I only found the permission for internet access, which is required by default, in the manifest file of my application:
<uses-permission android:name="android.permission.INTERNET"/>
However, the following permissions are listed as well when installing the application:
view network connections
full network access
prevent device from
sleeping
These are considered as normal permissions, but still I would like to find out where they are coming from because the application does not need these, I believe.
The manifest you see in your source is not the one that's in the final APK. The final AndroidManifest gets built up through the build process and compiled from different sources. If you'd like to see a full report of the manifest merging you can go into
build/app/outputs/logs
This is a very long log report, but you can read where all the manifest parts are coming from. If you'd like to see the final manifest itself this can be found in
build/app/intermediates/manifests/full/release or
build/app/intermediates/manifests/full/debug
This won't let you know where it's from, but you can look at the permissions and do a search in your build folder and you should find the partial manifest generated somewhere and you can see where exactly it's coming from.

Android lib/api to query, which Manifest.permission.XXXX are currently missing?

I am maintaining two android developper tools intent-intercept
and ContentProviderHelper
that declare as many required permessions as possible to work with as many apis (Intents or Contentproviders) as possible.
If i want to use target-api android-6.0 (M) and newer i have to implement an api to ask os/user to grant permission for a certain
api call.
And that is my problem: i donot know in advance which api-call(Intents or Contentproviders) require which permission.
As developper tools the app-s should work with any api.
How can I solve this? Is there a api/lib that tells me which Manifest.permission.XXXX are neccessary to invoke Intents or Contentprovider
or why last call failed?
Do i have to ask for all permissions even if they are not required?
Is there a api/lib that tells me which Manifest.permission.XXXX are neccessary to invoke Intents or Contentprovider
No.
or why last call failed?
Catch the SecurityException, then examine the message of the SecurityException and see if it contains the name of a dangerous permission.

Cannot see Crittercism app crashes on Android

I use crittercism for my app. Here is what i do to initialize Crittercism:
I only use the following permission:
<uses-permission android:name="android.permission.INTERNET"/>
and i initialize Crittercism like the following:
Crittercism.initialize(getApplicationContext(), "MY_APP_ID");
I do nothing else.
I can see some information about app installs etc, but i cannot see crash reports. I do the following when i click a button in my app and deliberately crash the app:
public void onClick(){
Integer i = null;
i++;
}
But i cannot see the crash report of this situation. Can anyone tell me why? Do i need to add mappings.txt file etc.?
Thanks
As the official Crittercism documentation says, you need more permissions.
Add the following permissions to your app’s AndroidManifest.xml file.
INTERNET
Required. Used to report data to Crittercism.
ACCESS_NETWORK_STATE
Optional. Allows providing network connectivity information such as carrier and network type.
READ_LOGS
Optional. Allows collecting logcat data to be attached to crashes and handled exceptions.
GET_TASKS
Optional. Allows augmenting crash reports with information on the activity running during a crash.
Documentation
You probably need "GET_TASKS" in order to have crash reports.
I found the problem.
It seems that in the developer console, the platform was set to IOS, i changed it to Android and i can see crash reports now.

Registering gcmregistrar.getregistrationid returns empty ID

Hello Android developers.
I have 2 Android applications with 2 different packages.
I want to register both of my applications to Google.
I have registered my apps using the same method.
And both of my applications have GCMActivity ( All of you already know the code, I used the same code as all of you ).
But i am stuck in a condition where one of my applications can't get regId.
final String regId = GCMRegistrar.getRegistrationId(this);
I tried to debug my apps, and what I got is this :
Application A gets the regId, but Application B only has "" value.
I don't understand what the problem is.
Both of them have similar code, similar way to register to Google.
Only different packages, SENDER_ID, GCMBroadcastReceiver, and Android key.
Is there a way my apps can get regId.
It has been like a week, I tried to register it using different Google accounts and different PC's.
But same result. I really need help.
Thank you.
All of you already know the code, I used the same code as all of you
You are wrong about that. You are using old and deprecated code. Beside the issue of GCMRegistrar being deprecated, GCMRegistrar.getRegistrationId(this) doesn't register to GCM, it just retrieves the registration ID that was previously persisted in SharedPreferences after a successful registration. If this method returns an empty registration ID, you should register to GCM (which is done with GCMRegistrar.register()).
You should, however, switch to using the GoogleCloudMessaging.register method of the Google Play Services library.

Content Provider authorities

I am inheriting a code base that needs to be kept fairly in sync with the previous version to make updating to new versions as painless as possible when they push the changes via git. The changes I am making are related to re-styling and adding new features.
In the latest release, I was trying to install both the original version of the app alongside this custom version and got this error:
Failure [INSTALL_FAILED_CONFLICTING_PROVIDER]
I looked through my source control and found that in previous versions I was using the same authorities and name as the parent app, but I don't recall having this problem, but maybe I just never tested the case where both apps were installed at the same time?
In the original version of the manifest, this is the provider element:
<provider
android:name="com.foo.mobile.android.provider.Provider"
android:authorities="com.foo.android.mobile.contentprovider"
android:exported="false" />
I tried changing the authority to this:
<provider
android:name="com.foo.mobile.android.provider.Provider"
android:authorities="com.bar.android.mobile.contentprovider"
android:exported="false" />
But now the app crashes shortly after launch with SecurityException:
java.lang.SecurityException: Permission Denial: opening provider com.foo.mobile.android.provider.Provider from ProcessRecord{42cbc998 2462:com.bar/u0a191} (pid=2462, uid=10191) that is not exported from uid 10189
I've looked on SO and saw a couple of questions regarding this topic and also looked at the documentation and it all says I need this authorities to be different, but how can I keep this different while keeping synergy with the base code?
maybe I just never tested the case where both apps were installed at the same time?
I would presume this is the case. You cannot have two apps with providers supporting the same authority installed at the same time.
But now the app crashes shortly after launch with SecurityException:
My guess is that you changed your manifest, but you did not change the Uri that you are using to access the provider. Hence, your com.bar app is still trying to talk to the com.foo provider, and that provider is not exported.
how can I keep this different while keeping synergy with the base code?
Either this is the same app, or it is not.
If it is the same app, your first step is to switch back to the original package name. The only way you could have gotten Failure [INSTALL_FAILED_CONFLICTING_PROVIDER] is because you changed the package name and did not change the provider's authority. Changing the package name means that, from the standpoint of everyone outside of you and your team, it is a completely different app. Once you have switched back to the original package name (and rolled back to the original provider authority), everything should be fine, except that you won't be able to have the release version and the development version on the same device at the same time.
If you do indeed plan to have this app have a separate package name (so existing users of the existing app cannot upgrade to this new app), you will need to change the authority string in all relevant places. I presume that you can do this using a string resource, where you have different versions of the string resource. Or, if this is a free-vs.-paid app scenario, move to doing your builds using Gradle for Android, and set up separate free and paid product flavors, which can patch up your package name and authority data as part of the builds, without having to tweak the source code.

Categories

Resources