Android launch application from notification With Marmalade SDK

358 views Asked by At

im trying to launch application form notification using Android Edk. I succeded to display notification. But i want to launch my application from notification and i can`t make it work. Notification is received when application is not running, is triggered from a broadCast reciever.
I think my problem is related to the activity that i created from notification intent.

Here the notification function:

 Intent resultIntent = new Intent(context, TaskManagerActivity.class);
    resultIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_SINGLE_TOP);
    PendingIntent resultPendingIntent = PendingIntent.getActivity( context, 0, resultIntent, 0);

    NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context )
    .setSmallIcon(R.drawable.ic_menu_day)
        .setContentTitle(title)
        .setContentText(message)
        .setContentIntent(resultPendingIntent)
        .setWhen(System.currentTimeMillis());

    NotificationManager manager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
manager.notify(0, mBuilder.build());

And here is my activity class:

public class TaskManagerActivity extends Activity {

public static TaskManagerActivity m_Activity;
private static final String TAG = "TaskManagerActivity";

protected void onCreate(Bundle savedInstanceState)
{

    super.onCreate(savedInstanceState);
 //   setContentView(R.layout.main);

}

}

1

There are 1 answers

1
0xC0DED00D On

Have a look at official docs of Android about notification. Also I'd suggest you to read this post of SO.