Android Permissions WITHOUT Features!!???

Hi,

I did set “android.permission.ACCESS_COARSE_LOCATION”,
for InnerActive Ads …

now I saw that it automatically adds:
Features: android.hardware.location.network, android.hardware.location,
what does mean instead of 1044 Devices I only can serve 574 !!

Is there anything I don’t know or how to request PERMISSION for a feature but
not automatically request that feature as a need!!??

So we could serve all devices, but only request permission for Coarse Location if
that device do offer that feature. (I think thats even basic in native Applications, where
I have to set separately what permission i need and what features I need, right?)

thx
chris
[import]uid: 4795 topic_id: 21348 reply_id: 321348[/import]

Hello Chris,

What you need to do is indicate that your Android app uses a feature, but that feature is not required. You would do this via [lua][/lua] tags in the AndroidManifest.xml file as documented on the Android developer site (see the link below). This way your app can still be purchased by devices that do not have the specified feature.
http://developer.android.com/guide/topics/manifest/uses-feature-element.html

In Corona, you can add these [lua][/lua] tags via the “build.settings” file as follows…
[lua]settings =
{
android =
{
usesPermissions =
{
“android.permission.ACCESS_COARSE_LOCATION”,
},
usesFeatures =
{
{name=“android.hardware.location”, required=false},
{name=“android.hardware.location.network”, required=false},
{name=“android.hardware.location.gps”, required=false},
}
}
}[/lua] [import]uid: 32256 topic_id: 21348 reply_id: 84524[/import]

oh joshua!!..
thats just a great answer, even with example (hugs)
… have to test asap :slight_smile:


any new about the ads.init() (if its soon possible to call it several time while app is running and overwrite previous initiated network?) :slight_smile:
[import]uid: 4795 topic_id: 21348 reply_id: 84525[/import]

Hi Chris,

I’m glad I could help! :slight_smile:

Regarding support for calling ads.init() multiple times, this is the first I’ve heard of this feature request (at least me personally). Do you intend to set up your app to support both InMobi and inneractive? For what purpose? Is it because you want to switch ad networks if one of them fails to deliver ads?

If you have an existing support case for this, then can you send me the case number please… or to the forum thread where this was requested? I’ll write up a feature request if it doesn’t exist and it has a better shot of getting implemented if it has a good explanation why it is needed. Thanks! [import]uid: 32256 topic_id: 21348 reply_id: 84529[/import]

Hi Joshua,

exactly. Its much better if we are able to choose what AdNetwork we use by remote.

Yes, we already have a feature request
http://developer.anscamobile.com/forum/2012/01/28/switch-ad-networks-fly
Chris
[import]uid: 4795 topic_id: 21348 reply_id: 84628[/import]

right now trying…
bit confusing, as before i had

androidPermissions =
{
“android.permission.ACCESS_COARSE_LOCATION”,
},

and now it is

usesPermissions =
{
“android.permission.ACCESS_COARSE_LOCATION”,
},
with the first AND usesFeatures =
it did not worked…

It could be helpful for the devs to have a page where that is explained better when 1 and when 2

A Forum search only brought 3 posts where usesPermissions is mentioned.

:slight_smile: [import]uid: 4795 topic_id: 21348 reply_id: 84633[/import]

We added “usesPermissions” and “usesFeatures” as of build 704. We haven’t documented them yet. So, I apologize for the confusion.

The “usesPermissions” does the exact same thing as “androidPermissions”. The difference being is that “usesPermissions” must be inside of an “android” table within your build.settings file. The intent is to put all of the android related things within the same table, just like we did for iOS. You see, it was a bad design decision on our part to have an “androidPermissions” outside of the “android” table, especially since we plan on adding more platform support in the future such as the Mac. So, we’re planning on shifting all of the permissions to inside of the android table in the near future for our sample apps and recommending others to do the same.

That said, Corona supports both “usersPermissions” and “androidPermissions” tables. The build process will merge the settings in both tables before adding permissions to your AndroidManifest.xml file. I’ve tested this for myself and the merge works correctly. But really, you should only use one or the other, like what I’ve shown in the post up above. It makes no sense to duplicate the two.

Regarding “usesFeatures”, this really only affects the marketplace app filtering process. That is, it is only used to prevent or allow Android devices to view/buy your app on the marketplace. It has no affect on the app itself at runtime. So, that means you (or us) have to have code in place to check if a device feature exists before using it or else the app may crash.

So what exactly is not working for you? Is the app not working correctly on a device that does not have a GPS? Or have you already submitted your app to the marketplace with my recommended build.settings change and it still won’t let you app be installed on devices without a GPS?
[import]uid: 32256 topic_id: 21348 reply_id: 84741[/import]

can someone tell me why this is generating an error:

settings =

{

     orientation =

        {

                default = “portrait”,

                supported =

                {

                       “portrait”, “portraitUpsideDown”,

                },

        },

        android =

    {

        versionCode = “50”,

        usesExpansionFile = true,

        largeHeap = true,

        usesPermissions =

        {

        “android.permission.WRITE_EXTERNAL_STORAGE”,

           “android.permission.VIBRATE”,

        “android.permission.CLEAR_APP_USER_DATA”,

        “android.permission.CAMERA”,

        “android.permission.GET_TASKS”,

        “android.permission.INTERNAL_SYSTEM_WINDOW”,

        “android.permission.MODIFY_AUDIO_SETTINGS”,

        “android.permission.INSTALL_PACKAGES”,

        “android.permission.READ_EXTERNAL_STORAGE”,

        “android.permission.READ_FRAME_BUFFER”,

        “android.permission.RECORD_AUDIO”,

        “android.permission.SET_PROCESS_LIMIT”,

        “android.permission.INTERNET”,

        “com.android.vending.CHECK_LICENSE”,

}, 

        usesFeatures =

        { name = “android.hardware.camera”, required = true },

        {name=“android.hardware.screen.portrait”, required = true},

        { name = “android.hardware.microphone”, required = true },

        { name = “android.hardware.location”, required = false },

            { name = “android.hardware.location.gps”, required = false },

         supportsScreens =

                {

                        smallScreens = true,

                        normalScreens = true,

                        largeScreens = true,

                        xlargelScreens = true,

                },

        

    },

}

Your “usesFeatures” is missing curly braces.  It needs to be a table of tables as shown in our documentation here…

   http://docs.coronalabs.com/guide/distribution/buildSettings/index.html#features

d’oh! thanks, Joshua!

Happy to help.

Also, I don’t think adding the “android.hardware.screen.portrait” part is necessary.  If your app is set up to be portrait in the orientation table, then Android automatically assumes that portrait is required.  The only time you would add portrait or landscape to the uses features table is if you do *not* want to make it required… and only if your app supports both portrait and landscape.  This is because some Android devices only support one orientation… like only landscape… but they’re extremely rare.  For example, the Nvidia Shield used to be a device that only supported landscape apps and would not allow end-users to purchase/download apps that require portrait.  But Nvidia changed this behavior with a firmware update to support portrait apps.

thanks again, Joshua!!

I just took it out.

I’m still having a serious issue though. I have an app in Android beta testing, and it downloads and shows up, but it won’t open. the ASUS TF300T system app area lists 60.00KB for Data and shows 110MB for App. my APK file is 7.2MB and the .obb file is 111.2MB. did something get left out, or is there just extra compression involved?

once it opened as a sort of slidable image arrangement showing image art stretched out in a long row. sometimes the splash screen shows up for the briefest moment followed by a black screen. mostly, it’s just a black screen. the app plays without error from iOS devices and doesn’t generate any errors when I’m building it for Android.

also, whenever I download a new version, it makes me restart to download the assets folder’s content. is this normal?

thanks again for any help you can provide. this is really frustrating!!!

>> I have an app in Android beta testing, and it downloads and shows up, but it won’t open.

How are you downloading the app to your device?  Most native Android developers install the APK via Google’s “adb” command line tool which is included with the Android SDK, which installs the APK via USB.

If you are using a Google expansion file and manually installing your APK to the device, then you must also manually install the *.obb file to external storage as well.  Unfortunately, the directory where you install the *.obb file can vary between devices.  On Google sanctioned devices, such as device models with the name “Nexus” in it (ie: Galaxy Nexus), the *.obb file is expected to be installed to the following location…

   /mnt/sdcard/Android/obb/<your.package.name>/

You can access the above directory, create your package name folder, and copy your *.obb file to that destination via Google’s “ddms” application that is included with the Android SDK.

Alternatively, you can upload your APK and its expansion file to Google Play, then install your APK to your device via “adb”.  When you run your app on your device, it will then automatically download and install your expansion file on startup.  Just be warned that it sometimes takes Google Play a few hours to recognize that you’ve uploaded a new version of your app… so this method won’t work immediately, but it’s good to test out once you’re near ready to deploy.

>> also, whenever I download a new version, it makes me restart to download the assets folder’s content. is this normal?

This will happen if you upload an expansion file with your new version of the APK to Google Play.  In this case, you’re telling Google Play that your expansion file is a new version too.  When uploading a new version of your APK, you can tell Google Play to use an older version of your expansion file.  This way, when a customer updates your app with the newest version, they’ll continue to use the old version of the expansion file, thus avoid downloading the expansion file.

Also, please note that all of your compiled Lua scripts are contained in the APK and the rest of yours assets (images, music, all other files) are contained in the expansion file.  If you have not changed any of your assets, then you don’t need to upload a new version of your expansion file.

Does this help?

thanks for the fast and thorough replay first of all, Joshua!

I’ve been downloading it using Google Play Beta testing portal. the app appears to be running after I try to open it since when I view it afterwards through Settings/Apps, it offers the option to Force stop. Settings/Apps says I have only 60KB of its data installed and 110MB of App. Settings/Apps also said that even before I tried to open it this time. and when I tried to open, it gave me the usual Restart to download option (even though it said 110MB were already downloaded!). so I Restart as usual, the game icon shows up on the main desktop, and I get a black screen when I try to open it from there as usual.

I tried the manual install from my Mac using the Android File Transfer app. I stuck the APK file in the “data” folder and the .obb file in the “obb” folder. when I click on the apk game icon, it takes me to the you have to restart to download window.

I’ve never used Google Play Beta test before.  So, I can’t help you with that.

If you install the APK manually to your device, I recommend that you use “adb -r install <PathToApkFile>” at the command line and not try to copy it via the File Explorer.

If you are seeing the download screen after installing the *.obb file manually, then that is a clear indicator that you’ve installed it to the wrong location, because the download screen appears when it fails to find the *.obb file.  Or if the *.obb file you installed manually does not match the version that Google Play’s licensing services says it should be using, that would cause it to download the version from Google Play.  Note that the number that you see in the *.obb file name is the version code of your app.  The Corona Simulator’s build system automatically creates an *.obb file name with same version code that your APK is using.

I’m not sure what else I can do to help you further.  I’ve never experienced problems like this before.

even if I could get it to install directly from the computer, I have to be able to get it to download from the store. that’s the most important obstacle I’m up against right now…

is there anything else you can see in my build settings that might be causing a breakdown between the .apk and the .obb files?

is there anyone else on staff who has worked with the store whom I could be referred to? I’m up against a brick wall here. thanks again…

No one else here has ever ran into this issue.  At least that I can re-call.

Perhaps you’re running into a bug on Google Play’s end?

Have you tried rebuilding your app with a new version code (one number higher), upload that APK, and set up Google Play to use the previous expansion file version?

Note:  You’ll have to wait 2-3 hours for Google Play to realize the change before re-testing the download.

can someone tell me why this is generating an error:

settings =

{

     orientation =

        {

                default = “portrait”,

                supported =

                {

                       “portrait”, “portraitUpsideDown”,

                },

        },

        android =

    {

        versionCode = “50”,

        usesExpansionFile = true,

        largeHeap = true,

        usesPermissions =

        {

        “android.permission.WRITE_EXTERNAL_STORAGE”,

           “android.permission.VIBRATE”,

        “android.permission.CLEAR_APP_USER_DATA”,

        “android.permission.CAMERA”,

        “android.permission.GET_TASKS”,

        “android.permission.INTERNAL_SYSTEM_WINDOW”,

        “android.permission.MODIFY_AUDIO_SETTINGS”,

        “android.permission.INSTALL_PACKAGES”,

        “android.permission.READ_EXTERNAL_STORAGE”,

        “android.permission.READ_FRAME_BUFFER”,

        “android.permission.RECORD_AUDIO”,

        “android.permission.SET_PROCESS_LIMIT”,

        “android.permission.INTERNET”,

        “com.android.vending.CHECK_LICENSE”,

}, 

        usesFeatures =

        { name = “android.hardware.camera”, required = true },

        {name=“android.hardware.screen.portrait”, required = true},

        { name = “android.hardware.microphone”, required = true },

        { name = “android.hardware.location”, required = false },

            { name = “android.hardware.location.gps”, required = false },

         supportsScreens =

                {

                        smallScreens = true,

                        normalScreens = true,

                        largeScreens = true,

                        xlargelScreens = true,

                },

        

    },

}

Your “usesFeatures” is missing curly braces.  It needs to be a table of tables as shown in our documentation here…

   http://docs.coronalabs.com/guide/distribution/buildSettings/index.html#features

d’oh! thanks, Joshua!