简体   繁体   中英

Starting Titanium “activity” from android service

I have a native module with a listener that starts running on boot. For certain events I need to perform something similar to startActivity. Does anyone know what is the equivalent in Titanium or any other ideas to communicate back to the application?

Thanks, Simon

Are you referring to this kind of activity? I've used this one to alert the user if he wants to exit the application.

var mainActivity = Ti.Android.currentActivity;

$.dialog.on('click', function(e){
    if (e.index == 0){
        mainActivity.finish();
    }
    else
        Ti.API.info('You clicked NO');  
});

Maybe this link will be useful: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Android-property-currentActivity

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM