Github user riknoll commented on the pull request:

    
https://github.com/apache/cordova-plugin-media/pull/93#issuecomment-212146985
  
    @fafaman that does sound like a `configChanges` issue as Nikhil mentioned. 
To prevent the restart, you need to add the `uiMode` value in the 
`configChanges` attribute of the Activity declaration in AndroidManifest.xml 
where we declare [the rest of 
them](https://github.com/apache/cordova-android/blob/master/bin/templates/project/AndroidManifest.xml#L40).
 You will find that file in the platforms folder of your project:
    
    ```
    <project-root>/platforms/android/AndroidManifest.xml
    ```
    The best way to make that change is by using a hook or a plugin (we 
recommend that you don't edit any files in the platform directory directly).
    
    If you want to actually respond to that event (e.g. to change your UI to a 
car-friendly UI), you'll need to make a plugin that surfaces it to the 
javascript. We provide a 
[callback](https://github.com/apache/cordova-android/blob/master/framework/src/org/apache/cordova/CordovaPlugin.java#L386)
 to plugins for configuration changes so that would be pretty simple but would 
require Java code.
    
    A note about the implications of making that change:
    
    By default, Android just restarts the activity when a configuration changes 
because that is the easiest way to ensure that all of the resources and other 
things that need to be swapped out will automatically be taken care of by the 
OS. Cordova already handles some configurations, like orientation changes. 
Adding that `uiMode` value will prevent the restart in this scenario, but means 
that any changes that need to happen because of the configuration change won't 
happen automatically. I don't really have a way of testing the implications of 
that so I honestly can't say if there is any issue with adding it. You'll need 
to test it for yourself to make sure nothing weird happens in that scenario.
    
    Read more about configuration changes 
[here](http://developer.android.com/guide/topics/resources/runtime-changes.html)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@cordova.apache.org
For additional commands, e-mail: dev-h...@cordova.apache.org

Reply via email to