This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.fcm; | |
| import android.util.Log; | |
| import com.google.firebase.iid.FirebaseInstanceId; | |
| import com.google.firebase.iid.FirebaseInstanceIdService; | |
| public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService { | |
| private static final String TAG = "MyFirebaseIIDService"; | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.fcm; | |
| import android.app.Notification; | |
| import android.app.NotificationManager; | |
| import android.app.PendingIntent; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.graphics.Bitmap; | |
| import android.graphics.BitmapFactory; | |
| import android.graphics.Color; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <RelativeLayout | |
| xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent" | |
| android:paddingBottom="@dimen/activity_vertical_margin" | |
| android:paddingLeft="@dimen/activity_horizontal_margin" | |
| android:paddingRight="@dimen/activity_horizontal_margin" | |
| android:paddingTop="@dimen/activity_vertical_margin" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class FCM { | |
| public function send_notification($token, $payload_notification, $payload_data) { | |
| $url = 'https://fcm.googleapis.com/fcm/send'; | |
| $fields = array( | |
| //'registration_ids' => $token, | |
| //'condition' => "'logined' in topics || 'news' in topics", | |
| 'to' => '/topics/news', | |
| 'priority' => 'normal', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| include_once 'FCM.php'; | |
| /* | |
| $token = array('TOKEN1', 'TOKEN2'); | |
| */ | |
| $token = array(); | |
| $notification = array( | |
| 'title' => 'Google I/O 2016', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.fanalytics; | |
| import android.os.Bundle; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.view.View; | |
| import com.google.firebase.analytics.FirebaseAnalytics; | |
| public class MainActivity extends AppCompatActivity { | |
| private FirebaseAnalytics mFirebaseAnalytics; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="utf-8"?> | |
| <defaultsMap> | |
| <entry> | |
| <key>is_promotion_on</key> | |
| <value>false</value> | |
| </entry> | |
| <entry> | |
| <key>price</key> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.example.fconfig; | |
| import android.os.Bundle; | |
| import android.support.annotation.NonNull; | |
| import android.support.v7.app.AppCompatActivity; | |
| import android.util.Log; | |
| import android.view.View; | |
| import android.widget.TextView; | |
| import com.google.android.gms.tasks.OnCompleteListener; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void uploadFromDataInMemory() { | |
| Helper.showDialog(this); | |
| // Get the data from an ImageView as bytes | |
| mImageView.setDrawingCacheEnabled(true); | |
| mImageView.buildDrawingCache(); | |
| Bitmap bitmap = mImageView.getDrawingCache(); | |
| ByteArrayOutputStream baos = new ByteArrayOutputStream(); | |
| bitmap.compress(Bitmap.CompressFormat.PNG, 100, baos); | |
| byte[] data = baos.toByteArray(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private void uploadFromStream(String path) { | |
| Helper.showDialog(this); | |
| InputStream stream = null; | |
| try { | |
| stream = new FileInputStream(new File(path)); | |
| } catch (FileNotFoundException e) { | |
| e.printStackTrace(); | |
| } | |
| mUploadTask = imageRef.putStream(stream); | |
| mUploadTask.addOnFailureListener(new OnFailureListener() { |
OlderNewer