Modify Android Device Permissions and Form Factors Support for Google Play

Hi, everyone:

This is a re-post of a forum reply - I hope you will find it useful. 

Recently Google Play made a number of changes, so that it is much more strict in terms of Android device/form factor support.  For example, if you simply published an ADF Mobile application on Google Play and then try to download the app from an Android tablet, you may see "This Application is not compatible with your device".  This is true even if you have created tablet-optimized screen in your ADF Mobile application.  This is because Google Play now inspects the content of AndroidManifest.xml file for supported screen form factors. Google Play uses the "Supports Screen"  element in the AndroidManifest.xml file to determine what devices/form factors are supported.  Summary of the supported form factors and densities are described here: Supporting Multiple Screens | Android Developers.  ADF Mobile supports different screen density display already in the deployment profile, and you don't really have to do anything there other than specified the required icon resources.  As for screen size, you would need to add the "Supports Screen" element in the manifest xml file template for the screen size you want to support.  For example, if you want to add to support all devices:

<supports-screens android:smallScreens="true"

                  android:normalScreens="true"

                  android:largeScreens="true"

                  android:xlargeScreens="true"/>

The Android site would give you definitions of what these different sizes mean. Basically, Normal = most of the smartphones, Large = small tablets with ~7 inch display, and xLarge = ~10 inch display.  

Furthermore, when you download the ADF Mobile application from Google Play and attempt to install it, you will also see the application requesting all sorts of device permissions, regardless of whether you are actually using that device service or not.  By default, ADF Mobile declares all the device permissions that may potentially be required by the framework.  Therefore, for example, even if the app does not access camera, the AndroidManifest.xml file will still contain references to camera permissions.  Ability to selectively choose the correct hardware permissions is planned for the next release of ADF Mobile.  In the meantime, you can modify the AndroidManifest.xml file template in the ADF Mobile extension as the workaround.

Here is what you will need to do to update the AndroidManifest.xml template:

  1. Navigate to file <JDev Install>/JDeveloper/JDev/Extensions/oracle.adf.mobile/Android/Oracle_ADFmf_Framework.zip
  2. Make a backup copy of the zip file
  3. Unzip the file, which would extract all files into a "framework" directory
  4. Navigate to framework/template/AndroidManifest.template.xml file
  5. Use a text editor to modify the device permissions, as well as adding the supports screen element as referenced above.  Check the list of device permissions and their definitions here for device permission modification, and please ensure you remove only the ones that you don't need.  Note that some permissions are required for framework to operate.  Please see the example below on what permissions are needed - the example below shows permissions required by the framework + GPS access.
  6. Zip up the framework directory and name zip file as Oracle_ADFmf_Framework.zip, replacing the old one.  Please make sure the zip file has the exact same directory structure as before.
  7. In JDeveloper, before deploying the application again, please do a "Clean All" to clean out all old deployment artifacts.
  8. Deploy the app - the app should now be visible for tablets, as well as has the appropriate permissions.
  9. Upload the app to Google Play - no additional actions are needed in Google Play around supported form factors and device permissions.

 

Now Android deployment process does not do any extra validation for what device permissions are actually needed, so it's up to you to ensure these are set correctly.  Also, you do not need to change the minimum and target API levels in the deployment profile - you would change it only if you want to restrict the application to support certain Android versions.  

Below is an example of the Android Manifest template file where device permissions have been striped down to only include GPS access and what the framework needs, but screen form factors have been specified to support all smartphone and tablet devices. 

Thanks,

Joe Huang 

 <?xml version="1.0" encoding="utf-8"?>

<manifest xmlns:android="http://schemas.android.com/apk/res/android"

  package="$$app.package$$">

  <uses-sdk/>


  <application android:icon="$$app.icon$$"

    android:label="$$app.name$$" android:name="oracle.adfmf.Application">

    <activity android:name="oracle.adfmf.Container" android:label="$$app.label$$" android:theme="@android:style/Theme.NoTitleBar"

              android:configChanges="$$app.configChanges$$" android:windowSoftInputMode="adjustPan" >

      <intent-filter>

        <action android:name="android.intent.action.MAIN" />

        <category android:name="android.intent.category.LAUNCHER" />

      </intent-filter>

    </activity>

    <activity android:name="oracle.adfmf.AMXActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>

    <activity android:name="oracle.adfmf.RemoteURLActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>

    <activity android:name="oracle.adfmf.LocalHTMLActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>

    <activity android:name="oracle.adfmf.phonegap.AdfSpringboardPhoneGapActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>

    <activity android:name="oracle.adfmf.SettingsActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>

    <activity android:name="oracle.adfmf.navbar.MoreTabActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity> 

    <activity android:name="oracle.adfmf.BlankActivity" android:theme="@android:style/Theme.NoTitleBar" android:windowSoftInputMode="adjustPan"></activity>

  </application>

  <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

  <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

  <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />

  <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />

  <uses-permission android:name="android.permission.READ_PHONE_STATE" />

  <uses-permission android:name="android.permission.INTERNET" />

   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />   

  <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />


<supports-screens android:smallScreens="true"

                  android:normalScreens="true"

                  android:largeScreens="true"

                  android:xlargeScreens="true"/>

</manifest>

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

This blog is is dedicated to tips and tricks for developing, integrating, securing, and managing mobile applications using Oracle Mobile Platform. It is created and maintained by the Mobile Suite/Oracle ADF Mobile product development team.

Archive of past entries

Even More Mobile Development Blogs

Oracle A-Team Site - Mobile Related Entries

Code samples from the Community

Fusion Middleware Blogs

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today