cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CB-8684) support onStart/onStop lifecycle events in plugins for Android
Date Wed, 08 Apr 2015 19:04:13 GMT

    [ https://issues.apache.org/jira/browse/CB-8684?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14485816#comment-14485816
] 

ASF GitHub Bot commented on CB-8684:
------------------------------------

GitHub user tony-- opened a pull request:

    https://github.com/apache/cordova-android/pull/173

    fix CB-8684 - support onStart/onStop lifecycle events in plugins for Android

    A couple notes about this PR.
    1. I feel pretty sure that CordovaActivity.shouldHandleStartOnAppViewInit is needed in
order to reliably get an onStart event to interested plugins, but not sure about CordovaWebViewImpl.shouldCallOnStartDuringInit.
 Don't want to add cruft, but would like these events to be reliable.
    2. I tried to add a reasonable test for this new feature, but I feel like there might
be a more elegant approach?  I'm open to feedback and willing to modify the approach.  Also
(per @agrieve suggestion), I set onload=true, but it seemed to be working without it (which
seems a little weird, but I didn't want to delay this PR any further - will step through it
later).

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/tony--/cordova-android CB-8684-clean-for-PR

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/cordova-android/pull/173.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #173
    
----
commit 683965c6e7759030352e8e45252ca6aa8b13bf1a
Author: Tony Homer <tony.homer@intel.com>
Date:   2015-04-08T19:00:38Z

    CB-8684 support onStart/onStop lifecycle events in plugins for Android

----


> support onStart/onStop lifecycle events in plugins for Android
> --------------------------------------------------------------
>
>                 Key: CB-8684
>                 URL: https://issues.apache.org/jira/browse/CB-8684
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Android
>            Reporter: Tony Homer
>            Assignee: Tony Homer
>
> Enable plugins to handle onStart/onStop lifecycle events in Android implementation. 
Currently plugin authors that need this feature instruct their users to modify the CordovaActivity
in their project in order to support these lifecycle events.
> For example, the Flurry plugin instructions direct users to override
> onStart and onStop in their activity in order to handle onStop:
> https://github.com/Initsogar/cordova-flurry
> There are other analytics plugins that want to know about onStart/onStop
> instead of onPause/onResume.
> This change will enable native Android support only - there will be no corresponding
Cordova lifecycle events generated because these events are platform specific.  
> In addition to the Android platform change, a "quirk"-type notation should be added to
the Android Plugin Development guide, along with possible update to the example code provided
there.
> For reference, here is the conversation from the dev mailing list between [~agrieve]
and [~tony--]:
> {quote}
> On 3/9/15, 12:05 PM, "Andrew Grieve" <agrieve@chromium.org> wrote:
> >I see no reason we couldn't add onStart / onStop.
> >
> >As an aside, if you're okay with supporting only ICS+, you can use
> >Application.registerActivityLifecycleCallbacks() as a work-around.
> >
> >
> >On Mon, Mar 9, 2015 at 11:23 AM, Homer, Tony <tony.homer@intel.com>
> wrote:
> >
> >> I assumed that this must have been discussed at some point, but I
> >>couldn¹t
> >> find anything in the list archives or JIRA.
> >> I¹m guessing that there might be some practical issues with
> >>onStart/onStop
> >> and plugin loading timing, but it seems like if there are issues like
> >>this
> >> they could be addressed somehow.
> >>
> >> I¹m asking about this because we have an internal request to enable apps
> >> to override onStart/onStop in the Intel XDK build system in order to
> >> support plugins that want to handle onStart/onStop.
> >> My initial response was ³why not use onResume/onPause², but some plugin
> >> authors apparently believe that onStart/onStop are the lifecycle events
> >> they need.
> >>
> >> For example, the Flurry plugin instructions direct users to override
> >> onStart and onStop in their activity in order to handle onStop:
> >> https://github.com/Initsogar/cordova-flurry
> >> There are other analytics plugins that want to know about onStart/onStop
> >> instead of onPause/onResume.
> >> Obviously it is possible to modify your activity in order to do this in
> >> your project, but if this capability is important, it should be possible
> >> without abandoning the Cordova Way.
> >>
> >> So I was wondering what you guys think?
> >> onPause/onResume should be good enough for anyone?
> >> onStart/onStop are edge cases that users need to handle by modifying
> >>their
> >> activity?
> >> onStart/onStop cannot be handled by plugins due to timing issues?
> >>
> >> Thanks!
> >> Tony
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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


Mime
View raw message