What is the different between android:maxSdkVersion="18" and no? - java

What is the different between
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" android:maxSdkVersion="18"/>
and
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE">

This is the highest SDK version that the permission will be applied to. This is because some permission are no longer required to be requested, say because of a change to the android framework.
As the documentation states:
The highest API level at which this permission should be granted to
your app. Setting this attribute is useful if the permission your app
requires is no longer needed beginning at a certain API level.
For example, beginning with Android 4.4 (API level 19), it's no longer
necessary for your app to request the WRITE_EXTERNAL_STORAGE
permission when your app wants to write to its own
application-specific directories on external storage (the directories
provided by getExternalFilesDir()). However, the permission is
required for API level 18 and lower.

android:maxSdkVersion:
The highest API level at which this permission should be granted to
your app. Setting this attribute is useful if the permission your app
requires is no longer needed beginning at a certain API level.
From developer.android.com

From android documentation:
android:maxSdkVersion
The highest API level at which this permission should be granted to your app. Setting this attribute is useful if the permission your app requires is no longer needed beginning at a certain API level.

Related

What permissions are considered collection of users' data?

I have recently rolled out a simple app and it is currently still in review. When I filled out the questions I remember that I was asked whether my app collects data or not and I stated no. I am wondering if I chose the right option since I am not so sure now.
These are my permissions in my manifest file:
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
I also am not sure if this log code is considered collection of data which is part of my app.
Log.d("TAG", "The interstitial ad wasn't ready yet.");
and
Log.d(LOG_TAG, "onStart");
These log code segments are the same ones available on the ad guide pages for android developers, I've integrated, app open ads, interstitial and banner ads. Also all the permissions are purely to allow the user to be able to see the ads so I'm not sure if this is considered collecting data. My application can work without any internet connection.
I have also made my app available to users from the ages of 6 and above as I believe that it is simple enough to use. Do I need to add in any special code that asks for permission because of this or does my app have to be made specifically for a certain age group if its below the ages of 13? I read through the policies but I don't consider that I'm collecting data or have violated any policies, or showing any type of inappropriate ads as I have disabled all these types of potential ads in my admob account for this specific ad. I'm not sure if I've done everything right or not, can someone tell me how this should be handled as I have not added any targeting code in my app. Its just the basic ad code that I have added to my app.
We cannot determine what if you collect user data from manifest file, but depend on your manifest.
android.permission.ACCESS_NETWORK_STATE is needed for accessing ConnectivityManager (mainly for monitoring network connections in general), while android.permission.ACCESS_WIFI_STATE grants access to WifiManager (for managing all aspects of Wi-Fi connectivity in particular).
In the latest release of Google Play, Google removed the need to ask permission for internet as "most apps need it anyways nowadays". However, for users who have older versions, it is still recommended to leave the code below in your manifest.
If the app doesn't contain any ads:
You can simply remove/ignore it by adding tools:node="remove" in the AndroidManifest.xml file.
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
Even if another third-party library asks for this specific permission, the build will be forced not to merge it in your final Manifest file. You can get more info from this SO answer.
Also you can read about all permission from this link.
Finally, don't worry depend on your manifest they can't be determine if you collect user data or not.

Action requested: Declare your Ad ID permission

Today i have got this email:
Last July, we announced Advertising policy changes to help bolster
security and privacy. We added new restrictions on identifiers used by
apps that target children. When users choose to delete their
advertising ID in order to opt out of personalization advertising,
developers will receive a string of zeros instead of the identifier if
they attempt to access the identifier. This behavior will extend to
phones, tablets, and Android TV starting April 1, 2022. We also
announced that you need to declare an AD_ID permission when you update
your app targeting API level to 31 (Android 12). Today, we are sharing
that we will give developers more time to ease the transition. We will
require this permission declaration when your apps are able to target
Android 13 instead of starting with Android 12.
Action Items If you use an advertising ID, you must declare the AD_ID
Permission when your app targets Android 13 or above. Apps that don’t
declare the permission will get a string of zeros. Note: You’ll be
able to target Android 13 later this year. If your app uses an SDK
that has declared the Ad ID permission, it will acquire the permission
declaration through manifest merge. If your app’s target audience
includes children, you must not transmit Android Advertising ID (AAID)
from children or users of unknown age.
My app is not using the Advertising ID. Should i declare the AD_ID Permission in Manifest or not?
Case 1: The app doesn't contain any Ads:
You can simply remove/ignore it by adding tools:node="remove" in the AndroidManifest.xml file.
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
Make sure you have xmlns:tools at the top of AndroidManifest.xml file
Even if another third-party library asks for this specific permission, the build will be forced not to merge it in your final Manifest file.
You can get more info from this SO answer.
Case 2: The app contains Ads:
Add the following to AndroidManifest.xml before </manifest>:
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
You can get more information from here.
If your app uses the Google Mobile Ads SDK(Admob) version 20.4.0 or higher, you can skip setting up the permission manually since the SDK automatically declares it
More informations here:
https://developers.google.com/admob/android/quick-start
Case 1: Your App has Ads
Add the following to AndroidManifest.xml before </manifest>:
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
Case 2: Your App Doesn't have Ads
At the top of your AndroidManifest.xml make sure you have xmlns:tools on the <manifest ...>. (kudos to this answer) e.g.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.mycompany.myapp">
Then, add the following at the bottom of the page, before </manifest> tag:
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
Source:
Google's Doc: https://developers.google.com/android/reference/com/google/android/gms/ads/identifier/AdvertisingIdClient.Info#public-methods
Google describe here how to solve
https://support.google.com/googleplay/android-developer/answer/6048248?hl=en
Add in manifest
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
If your app doesn't contain ads, make sure you complete the survey on App content page (Policy > App content) in Play Console.
Just select the option: No, my app does not contain ads.
If you don't do that, you won't be able to upload new releases of your app to Google Play.
First of all,
com.google.android.gms.permission.AD_ID can be added by other third party SDK like
Play Services-ads
firebase-analytics etc
So, if you haven't added permission.AD_ID manually, make sure it is not added by any other SDK by checking merged manifest file.
merged-manifest path:
project > app > build > intermediate > merged_manifest > release > AndroidManifest.xml
Now go to your play console > app content > Adverstising ID and
Select NO if your merged manifest doesn't contain AD_ID, else
Select YES and complete next option.
In my case, I used Firebase Analytics only for crash reports etc.
You can set your app to use advertising ID.
And use Analytics only.
Don't worry. All developer who uses Admob for advertisement received this warning. Just make sure you are using Latest Google Mobile Ads SDK(Admob) OR AdMob SDK version higher or equal to 20.4.0 in your build.gradle file. In that case SDK automatically manage it.
Otherwise for older sdk below 20.4.0, we need to manually mention below line in our AndroidManifest.xml
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
There are two different forms:
Ads
Advertising ID
Initially, I got stuck because I did not notice the other. So your app can be in any combination, for example, no ads, but yes, advertising ID.
In this documentation it is explained that Google services can include the advertising ID for other reasons that are not ads: Analytics.
Google Play Services version 4.0 introduced new APIs and an ID for use by advertising and analytics providers. Terms for the use of this ID are below.
And in this other documentation, in the examples section is very clear that ads are understood as what is commonly understood as ads: banners, pop-ups, a tile in the middle of a list, etc.
Analyzing the merged manifest we can see that the library play-services-measurement-api is adding the permission and is related to Analytics. The library manifest looks like this:
<uses-permission android:name="com.google.android.gms.permission.AD_ID" />
<application>
<service
android:name="com.google.firebase.components.ComponentDiscoveryService"
android:exported="false" >
<meta-data
android:name="com.google.firebase.components:com.google.firebase.analytics.connector.internal.AnalyticsConnectorRegistrar"
android:value="com.google.firebase.components.ComponentRegistrar" />
</service>
</application>
Please notice that library is registering analytics.connector.internal.AnalyticsConnectorRegistrar.
In this case the Ads form must be mark with no but the Adverising ID form must be mark with yes and then the Analytics option.
I have seen people recommending force the manifest to not merge the permission.AD_ID but that would break the Analytics.
I also received today's mail from the PlayStore team to all developers. Asking to declare AD_ID permission.
Since we developed and released our application using Flutter with android targeting to API level 31. I'm using the advertising_identifier: ^0.1.1 plugin to get the advertising client ID. I haven't declared AD_ID permission in my manifest file.
Additionally, apps updating their target API level to 31 (Android 12) and using advertise identifier / advertise id client info fetch will need to declare a Google Play services normal permission in the manifest file as follows:
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
Refered,
https://support.google.com/googleplay/android-developer/answer/6048248?hl=en
when you set targetSdkVersion 33 you must need to add the below line in the manifest file
<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>
if you are not set this, show a warning on the play console when your is in production.

File storage error when trying to display an OpenStreetMap map

My Android app using OpenStreetMap, which has been perfectly working for months, is now not able anymore to display the OpenStreetMap map. Despite the WRITE_EXTERNAL_STORAGE permission granted, I get messages like these :
E/OsmDroid: Unable to start the SQLite tile writer. Check external storage availability.
I/StorageUtils: /storage/emulated/0 is NOT writable
As I am targetting API29 and running on an Android 10 phone, I suppose the problem is related to the new policy about external storage access and the requirement to use the Storage Access Framework. Am I right?
No matter if I am right or wrong, does anyone know how I could fix this?
Because you are targeting Andorid 10 - api 29, the official Android docs states:
Running on Android 10
If your app targets Android 10 (API level 29), opt-out of scoped
storage and continue using the approach for Android 9 and lower to
perform this operation.
So you need to add to the AndroidManifest.xml:
<manifest ... >
<!-- This attribute is "false" by default on apps targeting
Android 10 or higher. -->
<application android:requestLegacyExternalStorage="true" ... >
...
</application>
</manifest>
#blackapps This is not a hack.

Permission denied in Android Emulator Device File Explorer

I want to check if a folder has been created in the External Storage.
I already added permissions inside the AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
but it doesn't work either.
Any clue?
/sdcard is a symlink to /storage/emulated/0. You should therefore be able to see external files for your app in /sdcard/Android/data/<your app>.
Looks like you are using Google Play system image.
You need to use a standard Android (AOSP) system image (not one of the Google APIs or Google Play system images)
see details here
cause there is system files located and for your access device file open self-> primary folder.
The correct location for my emulator was data/data/app_name/ as per the docs that phlip referred to.

How to turn airplanemode ON on Android programatically on API23

I'm trying to turn airplanemode on on Android but I got the following message:
java.lang.SecurityException: Permission Denial: not allowed to send broadcast android.intent.action.AIRPLANE_MODE
From my point of view (and some researches):
(1) I'm using all necessary permission to do that:
<uses-permission android:name="android.permission.WRITE_SETTINGS"/>
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
(2) The code is not wrong:
Settings.Global.putInt(
context.getContentResolver(),
Settings.Global.AIRPLANE_MODE_ON, 1);
Intent intent = new Intent(Intent.ACTION_AIRPLANE_MODE_CHANGED);
intent.putExtra("state", true);
context.sendBroadcast(intent);
I know that the app needs to be installed as a system app, so I'm installing that under /system/app/my-app/ (I tried /system/priv-app/my-app/ too) and added all the permissions to the folder and to the apk.
The last thing that I tried was the include of android:sharedUserId="android.uid.system" at the AndroidManifest.xml, but doing that the application disappears.
What am I missing here, after all those attempts?
ps: The device is rooted.
Thanks in advance
It seems although Airplane Mode has become a Constant value as of API Level 17 as per the Android development documentation.
Why are you turning airplane mode on? Is there a certain functionality you are trying to accomplish?
I would've posted this in the comments, but I don't have enough rep... tfw

Categories

Resources