Android Question App Crashing in a particular tablet

EduardoElias

Well-Known Member
Licensed User
Longtime User
Hi there!

I have a customer with a tablet with the following problem:

It is happening just after the app is opened, and this is due my new version for the sdk26 update.

Others are ok, but this one is strange. I have the same tablet here with me and worked.

Can someone give a clue why this?

B4X:
Multilaser M10A (M10A), Android 6.0
Relatório 1

java.lang.RuntimeException:
  at android.app.LoadedApk$ReceiverDispatcher$Args.run (LoadedApk.java:932)
  at android.os.Handler.handleCallback (Handler.java:815)
  at android.os.Handler.dispatchMessage (Handler.java:104)
  at android.os.Looper.loop (Looper.java:207)
  at android.app.ActivityThread.main (ActivityThread.java:5728)
  at java.lang.reflect.Method.invoke (Native Method)
  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:789)
  at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:679)
Caused by: java.lang.SecurityException:
  at android.os.Parcel.readException (Parcel.java:1599)
  at android.os.Parcel.readException (Parcel.java:1552)
  at android.net.wifi.IWifiManager$Stub$Proxy.getScanResults (IWifiManager.java:1360)
  at android.net.wifi.WifiManager.getScanResults (WifiManager.java:1419)
  at com.AB.ABWifi.ABWifi$WiFiScanReceiver.onReceive (ABWifi.java:145)
  at android.app.LoadedApk$ReceiverDispatcher$Args.run (LoadedApk.java:922)
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
The exact error message is missing. Worth integrating crashlytics. It will provide more information.

Seems like ABWifi also needs this permission: android.permission.ACCESS_COARSE_LOCATION

Add it in the manifest editor:
B4X:
AddPermission(android.permission.ACCESS_COARSE_LOCATION)
This is a dangerous permission so you also need to request it at runtime.
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User

I am getting confused with my manifest and this permission.

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="14"
        android:targetSdkVersion="26"/>
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE"/>
<uses-permission android:name="android.permission.INTERNET" />
<supports-screens android:largeScreens="true"
    android:xlargeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
AddApplicationText(<activity android:name="anywheresoftware.b4a.objects.preferenceactivity"/>)

AddManifestText(<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="18" />)

AddManifestText(<uses-feature android:name="android.hardware.telephony" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.bluetooth" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.usb.accessory" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.usb.host" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.camera" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.FAKETOUCH" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.LOCATION" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.location.GPS" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.location.NETWORK" android:required="false" />)
AddManifestText(<uses-feature android:name="android.hardware.WIFI" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.camera.autofocus" android:required="false"/>)
AddManifestText(<uses-feature android:name="android.hardware.touchscreen" android:required="false" />)
AddManifestText(<uses-feature android:name="android.permission.WAKE_LOCK" android:required="false" />)
AddManifestText(<uses-feature android:name="android.permission.ACCESS_FINE_LOCATION" android:required="false" />)
AddManifestText(<uses-feature android:name="android.permission.ACCESS_COARSE_LOCATION" android:required="false" />)

RemovePermission(android.permission.ACCESS_COARSE_LOCATION)
RemovePermission(android.permission.ACCESS_FINE_LOCATION)
RemovePermission(android.permission.VIBRATE)
RemovePermission(android.permission.BLUETOOTH_PRIVILEGED)
RemovePermission(android.permission.BLUETOOTH_ADMIN)

AddActivityText(main, <intent-filter >
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.HOME" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>)   
SetActivityAttribute(main, android:windowSoftInputMode, adjustPan|stateHidden)

My problem is that there are some tablets in our market down here (chinese ones) that are weird. The problem surely resigns on the way the android/linux package was compiled and declared. So the tablet itself have the features but for Play Store the tablet is something different.

So, to circumvent this problem I had to experiment until I found a Manifest file that worked for everything, that is the one attached.

I have removed the few traces where dangerous permissions were in place to not deal with more problems. But ABWIfi is necessary.

This is my current permissions:


then using this :

B4X:
Sub ReqPermissions
    For Each permission As String In Array(rp.PERMISSION_ACCESS_FINE_LOCATION, rp.PERMISSION_ACCESS_COARSE_LOCATION)
          rp.CheckAndRequest(permission)
        Wait For Activity_PermissionResult (permission As String, Result As Boolean)
        If Result = False Then
            ToastMessageShow("Sem Permissao, Faca Novamente", True)
            Activity.Finish
            Return
        End If
    Next
End Sub

I get return FALSE for both cases.

So, seems I need the PERMISSION_ACCESS_COARSE_LOCATION for a few tablets (yes it works on most of them old and new android versions)

I am lost.
 
Upvote 0

EduardoElias

Well-Known Member
Licensed User
Longtime User
It fails because the permission doesn't appear in the manifest file.

Sorry, I am lost, what should I do on my manifest?

Right now it is in a way that it can show up in all play store tablets... somehow in those tablets it filters out my application, so I tried by experiment until it worked
 
Last edited:
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…