Return-Path: X-Original-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 70C8A92FB for ; Fri, 8 Jun 2012 19:41:41 +0000 (UTC) Received: (qmail 7333 invoked by uid 500); 8 Jun 2012 19:41:41 -0000 Delivered-To: apmail-incubator-callback-dev-archive@incubator.apache.org Received: (qmail 7309 invoked by uid 500); 8 Jun 2012 19:41:41 -0000 Mailing-List: contact callback-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-dev@incubator.apache.org Received: (qmail 7300 invoked by uid 99); 8 Jun 2012 19:41:41 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jun 2012 19:41:41 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of don.coleman@gmail.com designates 209.85.160.175 as permitted sender) Received: from [209.85.160.175] (HELO mail-gh0-f175.google.com) (209.85.160.175) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 08 Jun 2012 19:41:37 +0000 Received: by ghbz2 with SMTP id z2so1465446ghb.6 for ; Fri, 08 Jun 2012 12:41:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=U8TjlKw9mPmjBZ11utqu3huRUJ/v22D75gmmmxXSiEg=; b=zbi4KZpe+TqVj7PU4l+u4++4sN5aFdYtVpw5pqQDf3Gm3tXb1FL+DTPxbAK7AgVj8x kxZZ29F8Zms+Z664QQeS5096pYXc46dvOwW1Ph9Oamp3M4SX3inJ855nKJbnLc5LhjkH 0E579h/WsGzL4ufBA3VB/JShgaSHhUffcr0rKG5TPoWBFnQOsG2d+hfDbmQcaeaVWbxI t31gw4WOryv46ryrxr6yPT6+Gj7G9Dd62TGLd7rdq6tT3FXzCdIhk1FWL4KY+T0Zwe59 oDweBym78gO9kSe06HPNcIL1xXZ7RbJBGM11XkJrqyVjTUfwS13tVhp0RWADIg7kEIGr lHtg== MIME-Version: 1.0 Received: by 10.236.77.134 with SMTP id d6mr8948627yhe.79.1339184476327; Fri, 08 Jun 2012 12:41:16 -0700 (PDT) Received: by 10.147.182.10 with HTTP; Fri, 8 Jun 2012 12:41:16 -0700 (PDT) Received: by 10.147.182.10 with HTTP; Fri, 8 Jun 2012 12:41:16 -0700 (PDT) In-Reply-To: References: Date: Fri, 8 Jun 2012 15:41:16 -0400 Message-ID: Subject: Re: Android devs From: Don Coleman To: callback-dev@incubator.apache.org Content-Type: multipart/alternative; boundary=20cf3005147c00105004c1fb2feb X-Virus-Checked: Checked by ClamAV on apache.org --20cf3005147c00105004c1fb2feb Content-Type: text/plain; charset=ISO-8859-1 I use Activity and Intent in the NFC plugin. When I upgraded the plugin for cordova 1.6, I need to cast ctx to Activity everywhere. I added getActivity() and getIntent() make things a bit clearer. https://github.com/chariotsolutions/phonegap-nfc/blob/master/android/src/com/chariotsolutions/nfc/plugin/NfcPlugin.java#L391 Are there cases where this cast might fail? On Jun 8, 2012 2:49 PM, "Joe Bowser" wrote: > This gets back to ctx vs ctx.getActivity/ctx.getContext. > > Earlier on when working on CordovaWebView, I changed the plugins to require > a context instead of a CordovaInterface because Activities are Contexts, > and we can't guarantee that users are going to be using DroidGap with the > new CordovaWebView change. This was changed so all plugins have to use a > CordovaInterface. However, since we can't guarantee that a > CordovaInterface is an Activity, (because someone needs it to work with > MapActivity), this change got removed because casting objects is frowned > upon like using duct tape to patch a hole in your boat. > > This is probably the biggest stumbling block with plugins, since you need > the context to start activities, create intents and for other interaction > with Android. We should settle with a solid way to do this so that plugin > developers know what's going on. > > BTW: Are there any non-Adobe or non-IBM Android peeps on here who can speak > up? It'd be good to hear from someone who hasn't re-written this part of > the code yet. > > Joe > > On Fri, Jun 8, 2012 at 11:40 AM, Joe Bowser wrote: > > > No, it means that ctx.getContext() will have to be change to > > ctx.getActivity(), since Activities are Contexts. > > http://developer.android.com/reference/android/app/Activity.html > > > > > > On Fri, Jun 8, 2012 at 11:31 AM, Simon MacDonald < > > simon.macdonald@gmail.com> wrote: > > > >> Okay, I'll pull it out. It just means all those folks we told to change: > >> ctx > >> > >> to: ctx.getContext() in 1.5+ > >> > >> will now need to make it: ctx.getActivity().getContext() in 1.9+. > >> > >> Simon Mac Donald > >> http://hi.im/simonmacdonald > >> > >> > >> On Fri, Jun 8, 2012 at 2:27 PM, Bryce Curtis > >> wrote: > >> > >> > getContext was not added to interface since it is available from > >> > getActivity().getContext(). > >> > > >> > On Fri, Jun 8, 2012 at 1:24 PM, Simon MacDonald > >> > wrote: > >> > > Yeah, the video player plugin uses it to start playing video. > >> > > > >> > > Simon Mac Donald > >> > > http://hi.im/simonmacdonald > >> > > > >> > > > >> > > On Fri, Jun 8, 2012 at 2:10 PM, Joe Bowser > wrote: > >> > > > >> > >> Why would you want to start an activity where you wouldn't get a > >> result? > >> > >> Just to put it on the stack? > >> > >> > >> > >> On Fri, Jun 8, 2012 at 11:05 AM, Simon MacDonald > >> > >> wrote: > >> > >> > >> > >> > Please take a look at: > >> > >> > > >> > >> > > >> > >> > > >> > >> > >> > > >> > https://git-wip-us.apache.org/repos/asf?p=incubator-cordova-android.git;a=commit;h=95b48705fea2cac0f2561f84d3f1ecf017357b58 > >> > >> > > >> > >> > I added getContext and startActivity back into CordovaInterface. > >> Does > >> > >> > anyone see any problems with this? I've done it to make life with > >> the > >> > >> > current crop of plugins easier. > >> > >> > > >> > >> > Simon Mac Donald > >> > >> > http://hi.im/simonmacdonald > >> > >> > > >> > >> > >> > > >> > > > > > --20cf3005147c00105004c1fb2feb--