Search in sources :

Example 6 with PendingIntent

use of android.app.PendingIntent in project cw-omnibus by commonsguy.

the class ProjectorService method buildForegroundNotification.

@Override
protected void buildForegroundNotification(NotificationCompat.Builder b) {
    Intent iActivity = new Intent(this, MainActivity.class);
    PendingIntent piActivity = PendingIntent.getActivity(this, 0, iActivity, 0);
    b.setContentTitle(getString(R.string.app_name)).setContentIntent(piActivity).setSmallIcon(R.mipmap.ic_launcher).setTicker(getString(R.string.app_name));
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Example 7 with PendingIntent

use of android.app.PendingIntent in project cw-omnibus by commonsguy.

the class ScreenshotService method buildPendingIntent.

private PendingIntent buildPendingIntent(String action) {
    Intent i = new Intent(this, getClass());
    i.setAction(action);
    return (PendingIntent.getService(this, 0, i, 0));
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 8 with PendingIntent

use of android.app.PendingIntent in project PlayerHater by chrisrhoden.

the class TouchableNotificationPlugin method getMediaButtonPendingIntent.

private PendingIntent getMediaButtonPendingIntent(int keycode) {
    Intent intent = new Intent(getContext(), BroadcastReceiver.class);
    intent.setAction(Intent.ACTION_MEDIA_BUTTON);
    intent.putExtra(Intent.EXTRA_KEY_EVENT, new KeyEvent(KeyEvent.ACTION_UP, keycode));
    return PendingIntent.getBroadcast(getContext(), keycode, intent, 0);
}
Also used : KeyEvent(android.view.KeyEvent) Intent(android.content.Intent) PendingIntent(android.app.PendingIntent)

Example 9 with PendingIntent

use of android.app.PendingIntent in project cw-advandroid by commonsguy.

the class InterpreterService method send.

private void send(Intent intent, Intent data) {
    String broadcast = intent.getStringExtra(BROADCAST_ACTION);
    if (broadcast == null) {
        PendingIntent pi = (PendingIntent) intent.getParcelableExtra(PENDING_RESULT);
        if (pi != null) {
            try {
                pi.send(this, Activity.RESULT_OK, data);
            } catch (PendingIntent.CanceledException e) {
            // no-op -- client must be gone
            }
        }
    } else {
        data.setPackage(intent.getStringExtra(BROADCAST_PACKAGE));
        data.setAction(broadcast);
        sendBroadcast(data);
    }
}
Also used : PendingIntent(android.app.PendingIntent)

Example 10 with PendingIntent

use of android.app.PendingIntent in project cw-advandroid by commonsguy.

the class BshService method send.

private void send(Intent intent, String result, int code) {
    String broadcast = intent.getStringExtra(BROADCAST_ACTION);
    Intent data = new Intent();
    data.putExtra(PAYLOAD, result);
    data.putExtra(RESULT_CODE, code);
    if (broadcast == null) {
        PendingIntent pi = (PendingIntent) intent.getParcelableExtra(PENDING_RESULT);
        if (pi != null) {
            try {
                pi.send(this, Activity.RESULT_OK, data);
            } catch (PendingIntent.CanceledException e) {
            // no-op -- client must be gone
            }
        }
    } else {
        data.setPackage(intent.getStringExtra(BROADCAST_PACKAGE));
        data.setAction(broadcast);
        sendBroadcast(data);
    }
}
Also used : Intent(android.content.Intent) PendingIntent(android.app.PendingIntent) PendingIntent(android.app.PendingIntent)

Aggregations

PendingIntent (android.app.PendingIntent)1208 Intent (android.content.Intent)1010 Notification (android.app.Notification)222 NotificationCompat (android.support.v4.app.NotificationCompat)167 AlarmManager (android.app.AlarmManager)149 NotificationManager (android.app.NotificationManager)148 Bundle (android.os.Bundle)75 RemoteViews (android.widget.RemoteViews)67 RemoteException (android.os.RemoteException)64 Resources (android.content.res.Resources)62 Bitmap (android.graphics.Bitmap)61 Context (android.content.Context)60 ComponentName (android.content.ComponentName)55 Test (org.junit.Test)44 Uri (android.net.Uri)42 IntentFilter (android.content.IntentFilter)41 SharedPreferences (android.content.SharedPreferences)36 TaskStackBuilder (android.support.v4.app.TaskStackBuilder)33 UserHandle (android.os.UserHandle)31 ArrayList (java.util.ArrayList)30