Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Android Activity onNewIntent

Is it planned to implement a callback for onNewIntent in an Android Activity?

— asked February 7th 2011 by Kevin Morey
  • activity
  • android
0 Comments

1 Answer

  • I'm not quite sure to understand your question or what you are trying to do. But basically an activity eventListener might trap a newIntent whenever an Intent is received, please see an actual snippet code:

    var activity = Ti.Android.currentActivity;
    var intent = activity.getIntent();
    if (intent !== null) {
        Ti.API.info("Intent Hello: " + intent.getStringExtra("hello"));
    } else {
        Ti.API.info("No intent");
    }
    
    activity.addEventListener('newIntent', function(e) {
        var msg = "NewIntent: No property.";
        if (e.intent) {
            msg = "NewIntent: property hello has value " + e.intent.getStringExtra("hello");
        }
        Ti.UI.createNotification({
            message : msg
        }).show();
    });
    

    If still needed by someone else please feel free to add remarks, just provided my 2 cents here …

    — answered November 10th 2012 by Eduardo Gomez
    permalink
    0 Comments
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.