Page 913 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 913

OkHttpClient client  =  new  OkHttpClient();

                            RequestBody  body  =  new  FormBody.Builder()
                                 .add("Token", token)
                                 .build();


                            //라즈베리파이에서  데이터베이스에  토큰을  저장하는  php  불러옴

                       Request  request  =  new  Request.Builder(
                                 .url("이곳에 데이터베이스의  URL과 사용할  php를  작성")
                                 .post(body)
                                 .build();



                       try  {
                            client.newCall(request).execute();
                       }  catch  (IOException  e)  {
                            e.printStackTrace();
                       }



                 }
            }


            -MyFirebaseMessagingService.java

            package  app.intech.fcmpush;


            import  android.app.NotificationManager;
            import  android.app.PendingIntent;
            import  android.content.Context;

            import  android.content.Intent;
            import  android.media.RingtoneManager;
            import  android.net.Uri;
            import  android.support.v4.app.NotificationCompat;



            import  com.google.firebase.messaging.RemoteMessage;




            public  class  MyFirebaseMessagingService  extends
            com.google.firebase.messaging.FirebaseMessagingService  {

                 private static  final  String  TAG  =  "FirebaseMsgService";




                                                         -  906  -
   908   909   910   911   912   913   914   915   916   917   918