How can I find the group id (gid) for the sdcard_r group on android?
Use the following command to see GID of the concerned group:

id -G group_name

Courtesy of this answer of doylefermi. 

It is very much possible that the GID would be 1028 given this line in source code of Android.