{ "id": "130664", "key": "AC-1026", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "12217", "key": "AC", "name": "Appcelerator - INBOX", "projectCategory": { "id": "10000", "description": "", "name": "Customer Service" } }, "resolution": { "id": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2014-07-22T23:08:27.000+0000", "created": "2014-05-20T09:31:59.000+0000", "labels": [ "android,", "launch", "notification", "splash-screen" ], "versions": [], "issuelinks": [], "assignee": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "updated": "2016-03-08T07:37:21.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "14548", "name": "Titanium SDK & CLI", "description": "Please enter tickets related to the MobileSDK here." } ], "description": "My native android module receives GCM push messages and create a notification. When pressing the notification, if there is *no task* (the app is not running in background), it launches but the *splash screen is not shown*. So it takes a few seconds until the app's main window is displayed which looks awkward.\r\n\r\nIf the task is in background, the app jumps immediately to foreground, which is excellent. But if there is no task and the application task is createdbu the intent, this should behave like pressing the launcher icon and show a splash screen. The code I use to initialize the notification's pending intent is:\r\n{noformat}\r\nPackageManager pm = tiapp.getPackageManager();\r\nIntent resultIntent = pm.getLaunchIntentForPackage(mainActivityPackage);\r\nresultIntent.addCategory(Intent.CATEGORY_LAUNCHER);\r\n{noformat}\r\nI've tried to add various combinations of flags to the intent like FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, Intent.FLAG_ACTIVITY_NEW_TASK, etc. but the splash screen is never displayed.\r\n\r\nAny idea how to make launching from a notification behave like tapping on the launcher icon?\r\n", "attachment": [], "flagged": false, "summary": "Launcing app using Intent from a native module doesn't show splash screen", "creator": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "subtasks": [], "reporter": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "environment": "Android using Titaniun 3.2.1", "comment": { "comments": [ { "id": "305864", "author": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "body": "For me, Just tested with my own app. After pressing the notification. \r\nI got following situations.\r\n\r\n1. If the app is running in background and currently in screen lock status, the app will be displayed *without* splash screen.\r\n2. If the app is running in background and currently *not* in screen lock status, the app will be displayed *with* splash screen.\r\n3. If the app is not running in background and currently in screen lock status, the app will be displayed *without* splash screen.\r\n3. If the app is not running in background and currently *not* in screen lock status, the app will be displayed *with* splash screen.\r\n\r\nAre those situations same to yours?", "updateAuthor": { "name": "sliang", "key": "sliang", "displayName": "Shuo Liang", "active": true, "timeZone": "Asia/Harbin" }, "created": "2014-05-21T02:58:55.000+0000", "updated": "2014-05-21T02:58:55.000+0000" }, { "id": "305873", "author": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "What is screen lock status? Do you mean that the device is locked and you need to enter a pattern or numerical code? You're not supposed to be able to access the notifications when the device is locked.\r\nMy situation is that the app is not running, and I just click the notification. The splash screen should come up until the main window is displayed.\r\nIt should display the splash screen no matter if the screen is locked (whatever that is) or not.", "updateAuthor": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-05-21T06:40:53.000+0000", "updated": "2014-05-21T06:40:53.000+0000" }, { "id": "314932", "author": { "name": "mrahman", "key": "mrahman", "displayName": "Mostafizur Rahman", "active": true, "timeZone": "Asia/Dhaka" }, "body": "Hi,\r\n\r\nWe have tested this issue using [Android notifications using intents|http://docs.appcelerator.com/titanium/3.0/#!/guide/Android_Notifications] test case and it's working good as we expected.\r\n \r\nh5. TESTING ENVIRONMENT\r\n \r\nMac OS\r\nTi CLI 3.3.0-rc\r\nTitanium SDK: 3.3.0.RC and 3.2.X.GA\r\nAndroid Device and Emulator\r\n \r\nh5. TEST CODE\r\n \r\n \r\n \r\n{code:title=app.js|borderStyle=solid}\r\n \r\nvar win = Titanium.UI.createWindow({\r\n\tbackgroundColor : 'blue'\r\n});\r\nvar btn = Ti.UI.createButton({\r\n\ttitle : 'Add Notification'\r\n});\r\n \r\nbtn.addEventListener('click', function(e) {\r\n\tvar now = new Date().getTime();\r\n\tvar delta = new Date( now + (4 * 1000) );\r\n\tvar deltaMS = delta - now;\r\n \r\n\tvar intent = Ti.Android.createServiceIntent({\r\n\t\turl : 'ExampleService.js'\r\n\t});\r\n\tintent.putExtra('interval', deltaMS);\r\n\tintent.putExtra('message' , 'This is that little extra');\r\n\tTi.Android.startService(intent);\r\n});\r\nwin.add(btn);\r\nwin.open();\r\n \r\n{code}\r\n \r\n \r\n{code:title= ExampleService.js|borderStyle=solid}\r\n \r\n \r\nif(!Ti.App.Properties.hasProperty('notificationCount')) {\r\n\tTi.App.Properties.setInt('notificationCount', 0);\r\n} else {\r\n\tTi.App.Properties.removeProperty('notificationCount');\r\n \r\n\tvar activity = Ti.Android.currentActivity;\r\n\tvar intent = Ti.Android.createIntent({\r\n\t\taction : Ti.Android.ACTION_MAIN,\r\n \r\n\t\turl : 'app.js',\r\n\t\tflags : Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP\r\n\t});\r\n\tintent.addCategory(Titanium.Android.CATEGORY_LAUNCHER);\r\n \r\n\tvar pending = Ti.Android.createPendingIntent({\r\n\t\tactivity : activity,\r\n\t\tintent : intent,\r\n\t\ttype : Ti.Android.PENDING_INTENT_FOR_ACTIVITY,\r\n\t\tflags : Ti.Android.FLAG_ACTIVITY_NO_HISTORY\r\n\t});\r\n \r\n\tvar notification = Ti.Android.createNotification({\r\n\t\tcontentIntent : pending,\r\n\t\tcontentTitle : 'Test',\r\n\t\tcontentText : 'test',\r\n\t\ttickerText : 'This is a test',\r\n\t\twhen : new Date().getTime(),\r\n\t\ticon : Ti.App.Android.R.drawable.appicon,\r\n\t\tflags : Titanium.Android.ACTION_DEFAULT | Titanium.Android.FLAG_AUTO_CANCEL | Titanium.Android.FLAG_SHOW_LIGHTS\r\n\t});\r\n \r\n\tTi.Android.NotificationManager.notify(1, notification);\r\n \r\n\tvar service = Ti.Android.currentService;\r\n\tvar serviceIntent = service.getIntent();\r\n \r\n \r\n\tvar teststring = serviceIntent.getStringExtra('message');\r\n\tTi.API.info('Extra!: ' + teststring);\r\n \r\n\tTi.Android.stopService(serviceIntent);\r\n}\r\n \r\n{code}\r\n \r\n \r\n{code:title= tiapp.xml |borderStyle=solid}\r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n{code}\r\n \r\nh5. STEPS TO TEST\r\n \r\n- Create a new project\r\n- Update \"app.js\" file with \"app.js\" code segment given above.\r\n- Create a new file name \"ExampleService.js\" in the Resource directory of the project.\r\n- Update \"ExampleService.js\" file with \"ExampleService.js\" code segment given above.\r\n- Run on Android Device and Emulator\r\n- App runs with showing the splash screen at the beginning.\r\n \r\nh5. EXPECTED RESULT\r\n \r\nThe splash screen should be visible before the app starts.\r\n \r\nThanks.\r\n\r\n", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-07-19T05:53:27.000+0000", "updated": "2014-07-22T23:07:14.000+0000" }, { "id": "315233", "author": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "I noticed another thing. A strange thing happens if setting opacity=1 (or any other value of opacity) when creating the heavyweight window, e.g.:\r\n{noformat}\r\nTi.UI.createWindow({opacity:1});\r\n{noformat}\r\nThe activity is then created with an old style theme. For example toggles created with Ti.UI.createSwitch() are the old style toggles. Removing the opacity, everything returns to normal. I don't think this is related directly to this issue, but if you're looking into the translucent activity, you might as well also look into this.", "updateAuthor": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-07-22T07:50:20.000+0000", "updated": "2014-07-22T07:50:20.000+0000" }, { "id": "315382", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Hey [~buddyguards], \r\ncan you please take a look into the testcase? We can't reproduce the issue. If you can modify that testcase in order to reproduce your issue, will be more than welcome. \r\n\r\nBest Regards", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-07-22T23:08:27.000+0000", "updated": "2014-07-22T23:08:27.000+0000" }, { "id": "315604", "author": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "body": "I've drilled down more deeply into this and found the cause for this problem.\r\nFirst of all I have to note that I'm doing this very differently. I create the notification in a native Java module as a result of a GCM push notification. The direct cause of the problem is that I launch two intents as a respond to the notification. One to launch and the other to an activity in my module that does some processing of the data passed by the push. It's something like this:\r\n{noformat}\r\nIntent intentLaunch = ctx.getPackageManager().getLaunchIntentForPackage(ctx.getPackageName());\r\nintentLaunch.addCategory(Intent.CATEGORY_LAUNCHER);\r\nintentLaunch.setFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);\r\nintentLaunch.putExtra(\"privateData\", jsondata);\r\n\r\nIntent intentInternal = new Intent();\r\nintentInternal.setClassName(mainActivityPackage, \"com.pingapp.gcmjs.GcmReceiverActivity\");\r\nintentInternal.putExtra(\"privateData\", jsondata);\r\n\r\nPendingIntent pendIntent = PendingIntent.getActivities(ctx, notifId,\r\n new Intent[] {intentLaunch, intentInternal}, PendingIntent.FLAG_UPDATE_CURRENT);\r\n{noformat}\r\nThe problem disappear completely if I instantiate the pending intent to just hold the launch intent:\r\n{noformat}\r\nPendingIntent pendIntent = PendingIntent.getActivity(ctx, notifId, intentLaunch, PendingIntent.FLAG_UPDATE_CURRENT);\r\n{noformat}\r\nNo idea why this happens.", "updateAuthor": { "name": "buddyguards", "key": "buddyguards", "displayName": "grebulon", "active": true, "timeZone": "Asia/Jerusalem" }, "created": "2014-07-24T10:10:35.000+0000", "updated": "2014-07-24T10:10:35.000+0000" } ], "maxResults": 10, "total": 10, "startAt": 0 } } }