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
| public class ComputerFactory { | |
| public static Computer createComputer(Class aClass) throws IllegalAccessException, InstantiationException { | |
| if (aClass.getName().equals(aClass.getName())){ | |
| return (Computer) aClass.newInstance(); | |
| } | |
| return null; | |
| } | |
| } |
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
| public class Main { | |
| public static void main(String[] args) { | |
| try { | |
| Asus asus = (Asus) ComputerFactory.createComputer(Asus.class); | |
| asus.since(1234); | |
| asus.name(); | |
| Mac mac = (Mac) ComputerFactory.createComputer(Mac.class); |
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
| public class ComputerFactory { | |
| public static Computer createComputer(Class aClass) throws IllegalAccessException, InstantiationException { | |
| return (Computer) aClass.newInstance(); | |
| } | |
| } |
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
| import java.util.ArrayList; | |
| import java.util.List; | |
| public class Main { | |
| public static void main(String[] args) { | |
| List<Integer> list = new ArrayList<>(); | |
| list.add(8); | |
| list.add(5); |
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
| dependencies { | |
| compile 'com.google.firebase:firebase-messaging:11.8.0' | |
| } |
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
| <service | |
| android:name=".MyFirebaseMessagingService"> | |
| <intent-filter> | |
| <action android:name="com.google.firebase.MESSAGING_EVENT"/> | |
| </intent-filter> | |
| </service> |
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
| <service | |
| android:name=".MyFirebaseInstanceIDService"> | |
| <intent-filter> | |
| <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> | |
| </intent-filter> | |
| </service> |
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
| <meta-data | |
| android:name="com.google.firebase.messaging.default_notification_icon" | |
| android:resource="@drawable/ic_stat_ic_notification" /> | |
| <meta-data | |
| android:name="com.google.firebase.messaging.default_notification_color" | |
| android:resource="@color/colorAccent" /> |
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 yusufcakal.com.cloudmessagging; | |
| /** | |
| * Created by Yusuf on 19.12.2017. | |
| */ | |
| import android.app.NotificationManager; | |
| import android.app.PendingIntent; | |
| import android.content.Context; | |
| import android.content.Intent; |
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
| public class MyFirebaseMessagingService extends FirebaseMessagingService { | |
| private static final String TAG = "MyFirebaseMsgService"; | |
| @Override | |
| public void onMessageReceived(RemoteMessage remoteMessage) { | |
| super.onMessageReceived(remoteMessage); | |
| Log.d(TAG, "From: " + remoteMessage.getFrom()); | |
| if (remoteMessage.getData().size() > 0) { |