hug0b opened a new issue #1202:
URL: https://github.com/apache/cordova-android/issues/1202
# Feature Request
## Motivation Behind Feature
<!-- Why should this feature be implemented? What problem does it solve? -->
Some plugins may require to perform actions inside the `onCreate()` Activity
Lifecycle.
An example of logic that needs to be inside `onCreate`:
```Java
public class MainActivity extends AppCompatActivity {
private Foo mService;
private ServiceConnection mConnection;
private boolean isConnect = false;
@Override
protected void onCreate(Bundle savedInstanceState) {
if(mConnection == null)
mConnection = new ServiceConnection() {
@Override
public void onServiceConnected(ComponentName className, IBinder
service) {
mService = Foo.bar(service);
isConnect = true;
}
};
}
```
In my understanding `onServiceConnected` should have ran when `onCreate` has
completed.
This logic would not behave the same inside the available `CordovaPlugin`
class methods like `initialize()` or `onStart()`.
(My real world use case is to write a Cordova plugin for the [MCOP
SDK](https://demo.mcopenplatform.org/gitlist/mcop/MCOP-SDK.git/blob/master/app/src/main/java/org/mcopenplatform/muoapi/mcopsdk/MainActivity.java)).
## Feature Description
<!--
Describe your feature request in detail
Please provide any code examples or screenshots of what this feature would
look like
Are there any drawbacks? Will this break anything for existing users?
-->
From a Cordova plugin, we should be able to hook inside Cordova's
MainActivity `onCreate`. (We can currently inject code in Cordova's Activity
but it can't be linked to plugin code afaik).
From my current Cordova knowledge I am unsure how it could be implemented.
## Alternatives or Workarounds
<!--
Describe alternatives or workarounds you are currently using
Are there ways to do this with existing functionality?
-->
I have not found any so far.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]