2016-08-02 11 views
0

私はHC-06モジュールへの接続を実行するアプリケーションを作成しています。特定のSMSを聞き取り、私のアプリから通知を生成するbrodcastlistenerもあります。通知をクリックするとアプリケーションアクティビティしかし、私のアプリはいつもbluetoothに接続している間に実行されます。しかし、通知をクリックすると、同じアプリケーションでアクティビティを開始します。アクティビティ開始Bluetoothを使用して

+0

フックアップ –

+0

にcontentIntentとしてpendingintent https://developer.android.com/training/notify-user/ build-notification.html#click –

+0

は、自分自身に次の時間を検索してみて、我々はあなたがリンクを共有してくださいすることができpendingintentをimplemet時に起こるものを通知 –

答えて

0
NotificationManager notificationManager = (NotificationManager) context 
      .getSystemService(Context.NOTIFICATION_SERVICE); 
    Notification notification = new Notification(icon, message, when); 

    Intent notificationIntent = new Intent(context, HomeActivity.class); 

    notificationIntent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP 
      | Intent.FLAG_ACTIVITY_SINGLE_TOP); 

    PendingIntent intent = PendingIntent.getActivity(context, 0, 
      notificationIntent, 0); 

    notification.setLatestEventInfo(context, title, message, intent); 
    notification.flags |= Notification.FLAG_AUTO_CANCEL; 
    notificationManager.notify(0, notification); 
関連する問題