Re-Launch App from Background Service

409 views Asked by At

I am writing an App in Titanium Studio and I'm having a problem with opening my app from it's own background service. Any help would be greatly appreciated.

I tried way too many variations to put them all in one question but I hope this gives an idea of what I've tried from answers to similar problems here on stackoverflow and examples from the Titanium Studio Documentation:

var intent = Ti.Android.createIntent({
    action: Ti.Android.ACTION_RUN,
    type: "text/plain",
    className: "index.js",
    packageName: "com.jason.avenue"
});
intent.putExtra(Ti.Android.EXTRA_TEXT, 'Arrived');
intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
Ti.Android.currentActivity.startActivity(intent);

That throws the error "cannot start activity of null" I assume because I can't get the currentActivity of a background service but I really don't know.

I would like to open my app, after it has been closed by the user, from the background service that my app created before it was closed. If anyone has done this and would be so gracious as to share a snippet of how, I will write you into my will. :)

Thank you very much for taking the time to read my question.

1

There are 1 answers

0
Waqass Karim On

you are putting wrong value in className var intent = Ti.Android.createIntent({ action: Ti.Android.ACTION_RUN, type: "text/plain", url: "index.js", className: "com.jason.avenue", packageName: "com.json.avenue.IndexServices" });

packageName you can get it when you look into your build > android > AndroidManifest.xml

Good Luck :)