0

I'm working on fall detection app. I was testing it on virtual devices API: 23,28,29 and app works fine but when I run this app on my phones with Android 6 and 9 it crash immediately.

What are the solutions ?

Thanks in Advance.

Run desription

I checked MainActivity line from errors window but i have no suggestion what I can do. MainActivity line175

Logcat errors after open app: Logcat

My manifest

<?xml version="1.0" encoding="utf-8"?>

 <uses-permission android:name="android.permission.SEND_SMS"/>
    <uses-permission android:name="android.permission.INTERNET"/>
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>


    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_falling_down_stairs"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <receiver android:name=".MyLocationService"/>


        <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version"/>
        <activity android:name=".CaretakersList"></activity>
        <activity android:name=".settingContact" />

        <service
            android:name=".AlertService"
            android:enabled="true"
            android:exported="true" />


        <activity android:name=".MainActivity" android:screenOrientation="portrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>


    </application>

</manifest>
Crisis
  • 15
  • 4

2 Answers2

1

This is because DecimalFormat generate localized string, and the decimal separator can be different in some locale.

You can force the good locale like this :

DecimalFormat precision = new DecimalFormat("0.00", new DecimalFormatSymbols(Locale.US));

More info here

dgp
  • 683
  • 3
  • 13
0

From your stacktrace there is error in Real number format in method of your MainACtivity onSensorChanged with value "9,35". In java all floating numbers use dot like this "9.35". Check this method and use correct format of Real number

Ilia Kuzmin
  • 165
  • 8
  • I wrote format with "." and I don't know why it shows Invalid double with "," DecimalFormat precision = new DecimalFormat("0.00"); – Crisis Jan 13 '20 at 20:15