質問編集履歴

4

説明文の修正

2015/11/30 02:01

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -6,4 +6,4 @@
6
6
 
7
7
  メッセージを送ることができたのですが、その内容とidを取得してアプリを起動し、そのidの値を使用して、メッセージの詳細画面に遷移する方法がわかりません。
8
8
 
9
- 2週間以上たっても回答頂けないのですが、この実装ができるかどうかだけでも教えていただけませんでしょうか?
9
+ 2週間たっても回答頂けないのですが、この実装ができるかどうかだけでも教えていただけませんでしょうか?

3

文章の改善

2015/11/30 02:01

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -6,92 +6,4 @@
6
6
 
7
7
  メッセージを送ることができたのですが、その内容とidを取得してアプリを起動し、そのidの値を使用して、メッセージの詳細画面に遷移する方法がわかりません。
8
8
 
9
- 下記にコードを記載させていただきます。
10
-
11
- よろしくお願いいたします。
12
-
13
-
14
-
15
-
16
-
17
- ////////////GcmIntentService.java
18
-
19
-
20
-
21
- Intent intentX = new Intent(getApplicationContext(), MainActivity.class);
22
-
23
- PendingIntent contentIntent = PendingIntent.getActivity(
24
-
25
- this, 101, intentX, PendingIntent.FLAG_UPDATE_CURRENT);
26
-
27
- Bundle bundle = new Bundle(extras);
28
-
29
- String def = bundle.getString("default");
9
+ 2週間以上たっても回答頂けないのですが、この実装ができるかどうかだけでも教えていただけませんでしょうか?
30
-
31
- if (def == null){return;};
32
-
33
- intentX.putExtra("itemId", def);
34
-
35
-
36
-
37
-
38
-
39
- NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
40
-
41
- Notification notification = builder
42
-
43
- .setWhen(System.currentTimeMillis())
44
-
45
- .setContentTitle("通知です")
46
-
47
- .setContentText(bundle.getString("default"))
48
-
49
- .setContentText(bundle.getString("item_id"))
50
-
51
- .setTicker("通知です")
52
-
53
- .setContentIntent(contentIntent)
54
-
55
- .setOnlyAlertOnce(true)
56
-
57
- .setAutoCancel(true)
58
-
59
- .build();
60
-
61
-
62
-
63
-
64
-
65
-
66
-
67
-
68
-
69
-
70
-
71
-
72
-
73
- ///////////MainActivity.java
74
-
75
-
76
-
77
- String url;
78
-
79
- if (savedInstanceState == null) {
80
-
81
- Bundle extras = getIntent().getExtras();
82
-
83
- if(extras == null) {
84
-
85
- url = "";
86
-
87
- } else {
88
-
89
- url = extras.getString("itemId");
90
-
91
- }
92
-
93
- } else {
94
-
95
- url = (String) savedInstanceState.getSerializable("itemId");
96
-
97
- }

2

文章の改善

2015/11/30 02:01

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -14,6 +14,10 @@
14
14
 
15
15
 
16
16
 
17
+ ////////////GcmIntentService.java
18
+
19
+
20
+
17
21
  Intent intentX = new Intent(getApplicationContext(), MainActivity.class);
18
22
 
19
23
  PendingIntent contentIntent = PendingIntent.getActivity(
@@ -22,25 +26,17 @@
22
26
 
23
27
  Bundle bundle = new Bundle(extras);
24
28
 
29
+ String def = bundle.getString("default");
25
30
 
31
+ if (def == null){return;};
26
32
 
27
- try {
28
-
29
- JSONObject jsonObject = new JSONObject(bundle.getString("default"));
30
-
31
- intentX.putExtra("item_id", jsonObject.getString("item_id"));
33
+ intentX.putExtra("itemId", def);
32
-
33
- } catch (JSONException e) {
34
-
35
- e.printStackTrace();
36
-
37
- }
38
34
 
39
35
 
40
36
 
41
37
 
42
38
 
43
- NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
39
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
44
40
 
45
41
  Notification notification = builder
46
42
 
@@ -61,3 +57,41 @@
61
57
  .setAutoCancel(true)
62
58
 
63
59
  .build();
60
+
61
+
62
+
63
+
64
+
65
+
66
+
67
+
68
+
69
+
70
+
71
+
72
+
73
+ ///////////MainActivity.java
74
+
75
+
76
+
77
+ String url;
78
+
79
+ if (savedInstanceState == null) {
80
+
81
+ Bundle extras = getIntent().getExtras();
82
+
83
+ if(extras == null) {
84
+
85
+ url = "";
86
+
87
+ } else {
88
+
89
+ url = extras.getString("itemId");
90
+
91
+ }
92
+
93
+ } else {
94
+
95
+ url = (String) savedInstanceState.getSerializable("itemId");
96
+
97
+ }

1

コードの追加と詳細情報の変更

2015/11/27 03:28

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,3 +1,63 @@
1
- androidにawsでpush通知を送った際、送った内容と、それにidみたなものをつけいと思っています。
1
+ androidpush通知に関して質問させていただきます。
2
2
 
3
+
4
+
5
+ push通知を送った際に、メッセージ内容と、そのメッセージにid(idは見えない状態で)みたいなものをつけたいと思っています。
6
+
3
- 内容を送ることができたのですが、その内容とidを取得してアプリを起動し、その値を使用する方法がわかりません。もしpush通知でこんなのがつかえるなどを教えていただけませんでしょうか?
7
+ メッセージを送ることができたのですが、その内容とidを取得してアプリを起動し、そのidの値を使用して、メッセージの詳細画面に遷移する方法がわかりません。
8
+
9
+ 下記にコードを記載させていただきます。
10
+
11
+ よろしくお願いいたします。
12
+
13
+
14
+
15
+
16
+
17
+ Intent intentX = new Intent(getApplicationContext(), MainActivity.class);
18
+
19
+ PendingIntent contentIntent = PendingIntent.getActivity(
20
+
21
+ this, 101, intentX, PendingIntent.FLAG_UPDATE_CURRENT);
22
+
23
+ Bundle bundle = new Bundle(extras);
24
+
25
+
26
+
27
+ try {
28
+
29
+ JSONObject jsonObject = new JSONObject(bundle.getString("default"));
30
+
31
+ intentX.putExtra("item_id", jsonObject.getString("item_id"));
32
+
33
+ } catch (JSONException e) {
34
+
35
+ e.printStackTrace();
36
+
37
+ }
38
+
39
+
40
+
41
+
42
+
43
+ NotificationCompat.Builder builder = new NotificationCompat.Builder(this);
44
+
45
+ Notification notification = builder
46
+
47
+ .setWhen(System.currentTimeMillis())
48
+
49
+ .setContentTitle("通知です")
50
+
51
+ .setContentText(bundle.getString("default"))
52
+
53
+ .setContentText(bundle.getString("item_id"))
54
+
55
+ .setTicker("通知です")
56
+
57
+ .setContentIntent(contentIntent)
58
+
59
+ .setOnlyAlertOnce(true)
60
+
61
+ .setAutoCancel(true)
62
+
63
+ .build();