Skip to content

Permissions

Izzy edited this page Dec 10, 2020 · 2 revisions

Obtaining app permissions

Using $google->parsePerms($packageName) you can obtain permissions for a given app. As with the structures returned for apps, the keys success and message are used to indicate the status. For data itself, you'll find a list by permission groups behind the grouped key – and "unified permissions" behind the perms key. Example output:

Array
(
    [success] => 1
    [message] =>
    [grouped] => Array
        (
            [storage] => Array
                (
                    [group_name] => Storage
                    [perms] => Array
                        (
                            [0] => Array
                                (
                                    [0] => 
                                    [1] => modify or delete the contents of your USB storage
                                )
                            [1] => Array
                                (
                                    [0] => 
                                    [1] => read the contents of your USB storage
                                )
                        )
                )
            [perm_media] => Array
                (
                    [group_name] => Photos/Media/Files
                    [perms] => Array
                        (
                            [0] => Array
                                (
                                    [0] => 
                                    [1] => modify or delete the contents of your USB storage
                                )
                            [1] => Array
                                (
                                    [0] => 
                                    [1] => read the contents of your USB storage
                                )
                        )
                )
            [perm_camera_mic] => Array
                (
                    [group_name] => Microphone
                    [perms] => Array
                        (
                            [0] => Array
                                (
                                    [0] => 
                                    [1] => record audio
                                )
                        )
                )
        )
    [perms] => Array
        (
            [0] => modify or delete the contents of your USB storage
            [1] => read the contents of your USB storage
            [4] => record audio
        )
)

The grouped keys are the IDs given to the permission groups by Google. The empty [0] key for permissions in the grouped tree is as shipped by Google; as those structures are not documented, it's unclear what this is reserved for until some values show up here. In earlier iterations, it was more details on what the permission stands for ("description"). With this empty field now being the leading one, a good guess is it was meant for the permission ID, like android.permission.INTERNET. This field is now empty for quite a while already, so it's unlikely something will fill it anytime soon. We've left it present nevertheless, just in case.

Results on failure look similar to those on failed requests for AppDetails:

Array
(
    [success] => 0
    [message] => HTTP/1.0 404 Not Found
)
Clone this wiki locally