Burstly Integration with Unity Android giving java.lang.securityException

I am trying to create a plugin for Burstly for Unity Android. I first created a sample android native app for it and it worked fine. Then I made the necessary changes in the project [like changing Activity to UnityPlayerActivity] and made a jar out of it. Put this and the BurstlySdk.jar in the Assets/Plugins/Android folder along with the AndroidManifest.xml which had the required permissions. But when trying to run the genereated .apk on the android device I am getting the following error-

04-19 17:13:37.857: E/AndroidRuntime(17587): Caused by: java.lang.SecurityException: Requires READ_PHONE_STATE: Neither user 10111 nor current process has android.permission.READ_PHONE_STATE.
04-19 17:13:37.857: E/AndroidRuntime(17587): at android.os.Parcel.readException(Parcel.java:1327)
04-19 17:13:37.857: E/AndroidRuntime(17587): at android.os.Parcel.readException(Parcel.java:1281)
04-19 17:13:37.857: E/AndroidRuntime(17587): at com.android.internal.telephony.IPhoneSubInfo$Stub$Proxy.getDeviceId(IPhoneSubInfo.java:190)
04-19 17:13:37.857: E/AndroidRuntime(17587): at android.telephony.TelephonyManager.getDeviceId(TelephonyManager.java:219)
04-19 17:13:37.857: E/AndroidRuntime(17587): at com.burstly.lib.util.Utils.getRawDeviceId(Utils.java:1128)
04-19 17:13:37.857: E/AndroidRuntime(17587): at com.burstly.lib.util.Utils.getDeviceSHA1Id(Utils.java:1035)
04-19 17:13:37.857: E/AndroidRuntime(17587): at com.burstly.lib.util.Utils.getDeviceId(Utils.java:994)
04-19 17:13:37.857: E/AndroidRuntime(17587): at com.burstly.lib.ui.BurstlyView.configureRequestData(BurstlyView.java:341)

This permission [android.permission.READ_PHONE_STATE] is already present in the AndroidManifest.xml but it is still not able to pick it up. The version of Unity which I am using is 4.1.0f4. Can I get some pointers what the issue might be?

Thanks
Rahul Saxena

1 Answer

1

Hi,

I’m Alex from Burstly. I’m wondering if you included the permissions in both the AndroidManifest.xml file in your jar as well. I’m currently working on a Unity plugin internally and have gotten Unity and Burstly working well by creating a jar containing an AndroidManifest.xml file (see below for an example) and, as you said, subclassing UnityPlayerActivity and including Burstly functionality in my own activity.

  • Alex