は[OK]を、私は解決策を発見しました。
これは私がAndroidManifest.xmlを
<activity
android:name=".ActivityXPTO"
android:screenOrientation="sensor"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="ACTIVITY_XPTO" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
アプリが閉じている
や背景とユーザーがクリックでで
{
"registration_ids": [
"XXX",
...
],
"data": {
"id_offer": "41"
},
"notification": {
"title": "This is the Title",
"text": "Hello I'm a notification",
"icon": "ic_push",
"click_action": "ACTIVITY_XPTO"
}
}
アプリにサーバから送信していJSONであります通知では、自分のActivityXPTOを開き、必要なid_offerを取得します。
public class ActivityXPTO extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
...
String idOffer = "";
Intent startingIntent = getIntent();
if (startingIntent != null) {
idOffer = startingIntent.getStringExtra("id_offer"); // Retrieve the id
}
getOfferDetails(id_offer);
}
...
}
それはそれだ...
いくつかのコードを共有できますか?アプリでも同様のことがありますが、GCMを使用しています。通知を受け取るサービスでは、単にインテントに余分な文字列を追加し、それを使用してどのフラグメントを開くべきかを確認します。 – Vucko
私は助けを必要としません、私のアプリは動作します:)あなたはそれを修正しました – Vucko
あなたはそれを解決しましたか?私は同じ問題を取り上げています。私はtargetActivityを開始しましたが、意図から補足を取得しませんでした。何か解決策はありますか? –