Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Creating Android Notification with Odd Side Effect

$
0
0

I am using the AlarmManager module in my app to manage local notifications. The code uses the Broadcast Receiver method (addAlarmNotification()) to set the alarms. The notifications themselves are firing when expected, but I am noticing an odd side effect: after scheduling a notification for some time in the future, if I hit the home button, my app restarts while going into the background. If the app does not schedule a notification, the app goes into the background without resetting. I don't see any exceptions/errors via logcat.

My code using the module is pretty straightforward:

var alarmMgr = null
            , alarmModule = null
            , delta = -1
            , now = new Date().getTime();
 
        alarmModule = require( "bencoding.alarmmanager" );
        alarmMgr = alarmModule.createAlarmManager();
        alarmMgr.setRootActivityClassName( "com.mycompany.MyappActivity" );
 
        delta = Math.ceil( ( ( task.DueDate - now ) / 1000 ) / 60 );
        var props = {
            requestCode: task.TaskID
            , minute: delta
            , contentTitle: task.AlarmText
            , contentText: task.AlarmText
            , playSound: false
            , vibrate: false
            , showLights: false
        };
 
        if( task.repeat !== "undefined" && task.repeat !== null )
        {
            props.repeat = task.repeat;
        }
 
        alarmMgr.addAlarmNotification( props );
 
        alarmMgr = null;
        alarmModule = null;
The launch mode for the app in tiapp.xml is "singleTop." I am running against version 3.2.1 of the Titanium SDK and using version 0.11 of the alarm module. Has anyone seen behaviour like this before?

Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>