I am having some problems with my Titanium application when I am trying to start an activity from a Titanium.Android.Service.
The Bug:
> I am using benCoding's Alarm Manager Module so that the service is run at an interval even if the app is not running. The service then does it's stuff and sends a notification for the user. If the user touches the notification and only if there is no application in the history/back stack the notification will start the activity but will not load any content except the default title bar and a black screen. A screenshot it below of this. This eventually brings up the alert box saying that the app is not responding and would you like to either wait or stop the application. >
Just to point out that if the application is running in the background and the notification is touched then everything works as it should and run the activity perfectly.
I think my problem is coming from the fact that Titanium has not initialised so it cannot run the code for the activity and render any of the UI. I know that titanium has to initialise for the app to work because that is the reason why all titanium apps have a splash screen as that is when titanium is initialising. I have Googled how to try fix this but nothing comes up that is relevant.
Here is my code for the notification, and what I have in the manifest.
Service.js
var intent = Ti.Android.createIntent({ action : Ti.Android.ACTION_VIEW, url : 'Tips.js', flags :Ti.Android.FLAG_ACTIVITY_NEW_TASK | Ti.Android.FLAG_ACTIVITY_NO_HISTORY | Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED }); intent.addCategory(Titanium.Android.CATEGORY_LAUNCHER); intent.putExtra('Tip',tip); var pending = Titanium.Android.createPendingIntent({ intent: intent, type : Ti.Android.PENDING_INTENT_FOR_ACTIVITY, flags : Ti.Android.FLAG_ACTIVITY_NO_HISTORY, }); Titanium.Android.NotificationManager.notify( 0, Ti.Android.createNotification({ contentTitle: 'Tip to Quitting', contentText: tip, tickerText: 'Quick Tip to Quitting', contentIntent: pending }) );Tiapp.xml
<services> <service url="Service.js"/> </services> <activities> <activity url="Tips.js"> <intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT"/> <category android:name="android.intent.category.BROWSABLE"/> </intent-filter> </activity> </activities>Screen Shot of the app after the notification is touched: enter image description here