Используйте флаг Notification.FLAG_AUTO_CANCEL
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(context, contentTitle, contentText, pendingIntent);
// Cancel the notification after its selected
notification.flags |= Notification.FLAG_AUTO_CANCEL;
и для запуска приложения:
NotificationManager notificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
// Create a new intent which will be fired if you click on the notification
Intent intent = new Intent(context, App.class);
// Attach the intent to a pending intent
PendingIntent pendingIntent = PendingIntent.getActivity(context, intent_id, intent, PendingIntent.FLAG_UPDATE_CURRENT);
Не уверен, что понимаю, что вы хотите, и не совсем бесплатную функцию (но статический метод в классе шаблона), но я предполагаю, что вы запрашиваете что-то похожее, как показано ниже
template <typename>
struct proFunc;
template <template <typename ...> class C, typename ... Ts>
struct proFunc<C<Ts...>>
{
static void func (Ts ...)
{ }
};
[ 115], что вы можете использовать этот способ
using ArgsTuple = std::tuple<int, float>;
proFunc<ArgsTuple>::func(1, 2.f);
и вы также можете проверить, что
static_assert( std::is_same<decltype(&proFunc<ArgsTuple>::func),
void(*)(int, float)>::value, "!" );
Чтобы получить что-то более похожее на свободную функцию, вы можете использовать указатели на функции
auto funcPnt = &proFunc<ArgsTuple>::func;
funcPnt(3, 4.f);