Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ToneGenerator causes Android crash #89

Closed
millerbennett opened this issue Jul 3, 2017 · 9 comments
Closed

ToneGenerator causes Android crash #89

millerbennett opened this issue Jul 3, 2017 · 9 comments
Labels
stale auto labeled abandoned issues after a period of inactivity

Comments

@millerbennett
Copy link

It appears that the debug sounds are causing at least my app to crash on startup.

Your Environment

  • Plugin version: latest
  • Platform: Android
  • OS version: 7.1.1
  • Device manufacturer and model: Nexus 5 emulator
  • React Native version: 0.45.1
  • Plugin configuration options:

desiredAccuracy: 100,
stationaryRadius: 100,
debug: false,
distanceFilter: 100,
stopOnTerminate: false,
startOnBoot: true,
interval: 60 * 1000,
locationProvider: BackgroundGeolocation.provider.ANDROID_DISTANCE_FILTER_PROVIDER

Context

Note that debug is set to false, but the debug tones still are getting triggered.

Possible Fix

I've found this StackOverflow thread:
https://stackoverflow.com/questions/13439051/tonegenerator-crash-android/13868360#13868360

Steps to Reproduce

I run this in my componentDidMount on startup (right now, just to test the usage of BackgroundGeolocation):

BackgroundGeolocation.configure({
      desiredAccuracy: 100,
      stationaryRadius: 100,
      debug: false,
      distanceFilter: 100,
      stopOnTerminate: false,
      startOnBoot: true,
      interval: 60 * 1000,
      locationProvider: BackgroundGeolocation.provider.ANDROID_DISTANCE_FILTER_PROVIDER
});
BackgroundGeolocation.start();

Debug logs

Process: com.moodleiosandroid, PID: 9223
java.lang.RuntimeException: Unable to start service com.marianhello.bgloc.LocationService@4939359 with Intent { flg=0x4 cmp=com.moodleiosandroid/com.marianhello.bgloc.LocationService (has extras) }: java.lang.RuntimeException: Init failed
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3343)
at android.app.ActivityThread.-wrap21(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1582)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: java.lang.RuntimeException: Init failed
at android.media.ToneGenerator.native_setup(Native Method)
at android.media.ToneGenerator.(ToneGenerator.java:746)
at com.marianhello.bgloc.AbstractLocationProvider.onCreate(AbstractLocationProvider.java:52)
at com.tenforwardconsulting.bgloc.DistanceFilterLocationProvider.onCreate(DistanceFilterLocationProvider.java:86)
at com.marianhello.bgloc.LocationProviderFactory.getInstance(LocationProviderFactory.java:43)
at com.marianhello.bgloc.LocationService.onStartCommand(LocationService.java:237)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:3326)
at android.app.ActivityThread.-wrap21(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1582) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6119) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776) 

@millerbennett
Copy link
Author

Looks like this might affect Android versions 7 and above. After switching to Android 6 with the same configuration, I don't encounter this issue anymore.

@mauron85
Copy link
Owner

Notice: this issue has been closed because it has been inactive for 141 days. You may reopen this issue if it has been closed in error.

@mark-plukkido
Copy link

We just experienced this issue on a Huawei P10 Lite after about 53 minutes of app uptime and continuous location update processing. Attached is a raw crashlog.

report-2518520634360549999-1c2588e3-da3f-4de6-8a3e-23c867bae29b.txt

@mark-plukkido
Copy link

mark-plukkido commented Mar 3, 2019

I've created a proposal to avoid this in release builds as a PR: mauron85/background-geolocation-android#28

Unfortunately I cannot pass the CircleCI testInstrumentation step as the $GCLOUD_SERVICE_KEY might not have been properly formatted? The changeset is tested in local and on the same Huawei P10 Lite mobile phone.

@mauron85
Copy link
Owner

mauron85 commented Mar 3, 2019

Instrumentation test failure is because circleci is not set to pass credentials with forked builds.

Pass secrets to builds from forked pull requests: OFF

@mauron85 mauron85 reopened this Mar 3, 2019
@stale
Copy link

stale bot commented Aug 30, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale auto labeled abandoned issues after a period of inactivity label Aug 30, 2019
@stale
Copy link

stale bot commented Sep 6, 2019

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.

@stale stale bot closed this as completed Sep 6, 2019
@thekarthiksankar
Copy link

@mauron85 @mark-plukkido @millerbennett
Hey guys,

I am getting this same crash only on a genymotion device which is used for automation testing.
We have a mic in the app. So whenever user clicks the mic, a tone will be played.
So I don't have a choice of removing it.

I just wanted to know, Have you guys figured out how to actually fix this crash or what is causing this crash?

@kempensp
Copy link

kempensp commented Feb 8, 2022

I'm having the crash happen on Android 11 (using an AppInventor extension based on ToneGenerator).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale auto labeled abandoned issues after a period of inactivity
Projects
None yet
Development

No branches or pull requests

5 participants