1
ライブラリを作成しました。アンドロイドアプリケーションにプッシュ通知を送信できます。私はライブラリのすべてのコードをアプリケーションに置くと動作しますが、別々に実行しようとするとアプリケーションは通知を受け取りません。ライブラリーからアプリに通知を送信する方法
この機能の実装:
NotificationCompat.Builder builder =
new NotificationCompat.Builder(this)
.setContentTitle(title)
.setContentText(content);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
String bootrapClassName = SharedPreferenceManager.getInstance(this).getClassNameClient();
Intent intent = new Intent(this, Class.forName(bootrapClassName));
stackBuilder.addParentStack(Class.forName(bootrapClassName));
stackBuilder.addNextIntent(intent);
PendingIntent resultPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
builder.setContentIntent(resultPendingIntent);
NotificationManager notificationManager =
(NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.notify(DcarBeaconApplication.NOTIFICATION_ID, builder.build());
エラーまたは例外がありませんが、それが正常に動作しますが、任意の通知を受信しません。この問題を解決する方法を教えてください。ありがとう。
マニフェストファイルにレシーバを定義しましたか? – sasikumar
@サシクマール:聞いてくれてありがとう。まだ、このレシーバの提案はありません。 – luoihocbk
このライブラリはどこに作成しましたか? – Jordan