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

Intent dont launch Activity

$
0
0

i have the following intent that have to open the aplication or a activity in there. app.js

var pushnotifications = require('com.arellomobile.push');
    pushnotifications.pushNotificationsRegister(dataManager[0].idGCM, dataManager[0].idApp, {
        success:function(e){
            idRegistration = e.registrationId;
        },
        error:function(e){
            Ti.API.warn("Error to register"+JSON.stringify(e));
        },
        callback:function(e){
            var toolsMessage = new searchs.Messages();
            var idMessage = toolsMessage.create(data.header,data.title,new Date());//store incoming message
            var data = JSON.parse(e.data);
            var time = new Date().getTime()+5000000;
            var activity = Ti.Android.currentActivity();
            var intent = Ti.Android.createIntent({
                action: Ti.Android.ACTION_VIEW,
                className : 'com.appcelerator.test.Test7Activity',
                packageName : 'com.appcelerator.test',
                url: 'ui/android/activityInbox.js',
                flags : Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP
            });
            intent.addCategory(Titanium.Android.CATEGORY_LAUNCHER);
 
            var pending = Ti.Android.createPendingIntent({
                activity : activity,
                intent : intent,
                type : Ti.Android.PENDING_INTENT_FOR_ACTIVITY,
                flags : Ti.Android.FLAG_ACTIVITY_NO_HISTORY
            });
            var notification = Ti.Android.createNotification({
                contentIntent : pending,
                contentTitle :L('titleHeaderMessage'),
                contentText : data.title,
                tickerText :  L('tickerIncomingMessage'),
                flags : Titanium.Android.ACTION_DEFAULT | Titanium.Android.FLAG_AUTO_CANCEL | Titanium.Android.FLAG_SHOW_LIGHTS
            });
            Ti.Android.NotificationManager.notify(1, notification);
        }
    });
the activity is in the path Resources/ui/android/activityInbox.js 1st question, i have to put the whole path in url's intent?
var intent = Ti.Android.createIntent({
                action: Ti.Android.ACTION_VIEW,
                className : 'com.appcelerator.test.Test7Activity',
                packageName : 'com.appcelerator.test',
                url: 'ui/android/activityInbox.js',
                flags : Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP
            });
or
var intent = Ti.Android.createIntent({
                action: Ti.Android.ACTION_VIEW,
                className : 'com.appcelerator.test.Test7Activity',
                packageName : 'com.appcelerator.test',
                url: 'activityInbox.js',
                flags : Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP
            });
i declare in tiapp.xml the activity:
<android xmlns:android="http://schemas.android.com/apk/res/android">
        <activities>
            <activity url="activityInbox.js"/>
        </activities>
        <manifest>
        </manifest>
    </android>
but its not working so well

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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