You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by GitBox <gi...@apache.org> on 2021/04/13 08:57:27 UTC

[GitHub] [cordova-android] hug0b opened a new issue #1202: Access onCreate() Lifecycle in Cordova plugin

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] breautek commented on issue #1202: Access onCreate() Lifecycle in Cordova plugin

Posted by GitBox <gi...@apache.org>.
breautek commented on issue #1202:
URL: https://github.com/apache/cordova-android/issues/1202#issuecomment-831959071


   Alright then. In effort to not add things and require to maintain them (it's much more harder to remove features than it is to add them...) we'll close this feature request, especially since no one else expressed interest in this feature.
   
   If things change, don't hesitate to open a new feature request, or comment on this one to reopen it.


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] breautek closed issue #1202: Access onCreate() Lifecycle in Cordova plugin

Posted by GitBox <gi...@apache.org>.
breautek closed issue #1202:
URL: https://github.com/apache/cordova-android/issues/1202


   


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org


[GitHub] [cordova-android] hug0b commented on issue #1202: Access onCreate() Lifecycle in Cordova plugin

Posted by GitBox <gi...@apache.org>.
hug0b commented on issue #1202:
URL: https://github.com/apache/cordova-android/issues/1202#issuecomment-831954745


   As of now it seems that I don't actually need this feature after all (And also my sample code was not really a valid example of why accessing `onCreate` could be useful), so I guess this could be closed.


-- 
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org