/push/:msgtoken funktioniert
This commit is contained in:
parent
510bfe4087
commit
4eda7a13b2
BIN
.idea/caches/gradle_models.ser
generated
BIN
.idea/caches/gradle_models.ser
generated
Binary file not shown.
@ -41,4 +41,6 @@ dependencies {
|
|||||||
implementation 'com.github.danielnilsson9:color-picker-view:1.4.0@aar'
|
implementation 'com.github.danielnilsson9:color-picker-view:1.4.0@aar'
|
||||||
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
implementation 'com.android.support:recyclerview-v7:28.0.0'
|
||||||
implementation 'com.android.support:support-v4:28.0.0'
|
implementation 'com.android.support:support-v4:28.0.0'
|
||||||
|
implementation 'cz.msebera.android:httpclient:4.4.1.2'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,23 @@
|
|||||||
package at.smartshopper.smartshopper.messaging;
|
package at.smartshopper.smartshopper.messaging;
|
||||||
|
|
||||||
|
import android.util.Log;
|
||||||
|
|
||||||
import com.google.firebase.messaging.FirebaseMessaging;
|
import com.google.firebase.messaging.FirebaseMessaging;
|
||||||
import com.google.firebase.messaging.RemoteMessage;
|
import com.google.firebase.messaging.RemoteMessage;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import at.smartshopper.smartshopper.R;
|
import at.smartshopper.smartshopper.R;
|
||||||
import at.smartshopper.smartshopper.shoppinglist.Member;
|
import at.smartshopper.smartshopper.shoppinglist.Member;
|
||||||
|
import cz.msebera.android.httpclient.HttpResponse;
|
||||||
|
import cz.msebera.android.httpclient.NameValuePair;
|
||||||
|
import cz.msebera.android.httpclient.client.HttpClient;
|
||||||
|
import cz.msebera.android.httpclient.client.entity.UrlEncodedFormEntity;
|
||||||
|
import cz.msebera.android.httpclient.client.methods.HttpPost;
|
||||||
|
import cz.msebera.android.httpclient.impl.client.DefaultHttpClient;
|
||||||
|
import cz.msebera.android.httpclient.message.BasicNameValuePair;
|
||||||
|
|
||||||
public class MyFirebaseSender {
|
public class MyFirebaseSender {
|
||||||
|
|
||||||
@ -32,11 +42,24 @@ public class MyFirebaseSender {
|
|||||||
FirebaseMessaging firebaseMessaging = FirebaseMessaging.getInstance();
|
FirebaseMessaging firebaseMessaging = FirebaseMessaging.getInstance();
|
||||||
for (int i = 0; messageIds.size() > i; i++) {
|
for (int i = 0; messageIds.size() > i; i++) {
|
||||||
|
|
||||||
firebaseMessaging.send(new RemoteMessage.Builder(R.string.firebase_sender_id + "@fcm.googleapis.com/fcm/send")
|
try {
|
||||||
.setMessageId(messageIds.get(i))
|
firebaseMessaging.send(new RemoteMessage.Builder(R.string.firebase_sender_id + "@fcm.googleapis.com/fcm/")
|
||||||
.addData("my_message", message)
|
.setMessageId(messageIds.get(i))
|
||||||
.addData("my_action", action)
|
.addData("my_message", message)
|
||||||
.build());
|
.addData("LoginActivity", action)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
// Create a new HttpClient and Post Header
|
||||||
|
HttpClient httpclient = new DefaultHttpClient();
|
||||||
|
HttpPost httppost = new HttpPost("https://www.smartshopper.cf/push/" + messageIds.get(i));
|
||||||
|
|
||||||
|
// Execute HTTP Post Request
|
||||||
|
HttpResponse response = httpclient.execute(httppost);
|
||||||
|
Log.d(R.string.StringTag + "", "Response Push Post" + response);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,4 +5,5 @@
|
|||||||
<string name="title_activity_shoppinglist_details">ShoppinglistDetails</string>
|
<string name="title_activity_shoppinglist_details">ShoppinglistDetails</string>
|
||||||
<string name="title_activity_item_list">ItemListActivity</string>
|
<string name="title_activity_item_list">ItemListActivity</string>
|
||||||
<string name="firebase_sender_id">221332577314</string>
|
<string name="firebase_sender_id">221332577314</string>
|
||||||
|
<string name="StringTag">SmartShopper</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user