Posts

WWDC 23: Keynote Live

WWDC 23: Keynote Live

Here it comes!

WWDC 23 is just started, and we are preparing the live updates for you!

You can enter the live Keynote here

10:00 am

It’s started!

apple tim cook

10:05 am

15-inch MacBook Air is introduced. It starts from $1299.

It’s been waiting for a long time. MacBook Air is one of the best products of Apple to join the MacOS environment. It is the thinnest 15-inch laptop with 11.5mm thin and only 3.3 pounds (1.53kg). It supports MagSafe and Touch ID. Moreover, it has up to 18 hours of battery life!

The 13-inch model starts from $1099.

m2 macbook air

10:10 am

M2 Ultra is introduced, and it is faster than before, as always.

Mac Studio comes with new M2 Max and Ultra chips, starting from $1999.

M2 Ultra and M2 Max are the new chips. M2 Ultra is the most powerful chip ever created for a personal computer, according to Apple.

Also according to the Apple, It can train ML workloads like large transformer models that the best GPU can’t process because they run out of memory.

22 streams of 8K ProRes video can play at the same time. Yes, that is a lot!

m2 ultra chip details

mac studio details

10:15 am

Mac Pro comes with M2 Ultra. It is starting $6999.

mac pro details

10:20 am

iOS 17 comes with features of personalized call photos and memojis, live voicemail, catch-up, inline location, new sticker experience.

Personalized call photos will be shown during the call.

Live voicemail helps old-school people to read voicemail messages as text.

Audio messages are transcribed.

With new sticker experience, you can now make live, animating stickers from live photos. They can also work with third-party apps.

ios 17 details

10:25 am

Use AirDrop to swap your number with someone new. “NameDrop”. If you bring phones close together, you share your contact poster and you can chose what number and email addresses you share.

You can close your iPhone to another one to start transferring also, like AirDrop.

airdrop

10:30 am

Journal app will be alive for us. It helps to write down daily adventures.

It stores your data such as people, places, activity, music, photos and more to provide an excellent way for practising gratitude.

ios journal app

10:35 am

StandBy is the form that makes iPhone like a smart alarm.

it is enabled when the iPhone is sideways, designed for a MagSafe stand. You can see the time, calendar, alarm, and more. It also supports smart stacks and other features like live activities.

ios standby feature

10:40 am

The new version iPadOS 17 comes with the features mainly released for iOS 16.

iPadOS 17 will include the almost the same features in iOS 17.

You can interact with widgets more by customizing home screen. Also, redesign the lock screen with a beautiful earth animation.

Health app coming to iPadOS.

Handling PDFs are easy now! Preview, sign, and edit PDFs.

ipados details

10:45 am

Now, macOS Sonoma.

Apple TV screensavers can be used in Sonoma now!

‌iPhone‌ widgets can be accessed on the Mac, too.

‌iPhone‌ just needs to be nearby or on the same Wi-Fi network. ‌Widgets‌ on the Mac are interactive now, too. Use your car widget from your ‌iPhone‌ to start cooling off your car.

macos sonoma

10:50

Kojima Games will release Death Stranding Director’s Cut game to Mac.

Kojima Games will release Death Stranding Director's Cut game to Mac.

10:55 am

Here are Audio & Home features.

apple home and audio

11:00 am

AirPlay in hotels is for using the hotel’s electronic devices easily.

11:05 am

‌watchOS 10‌ is alive! A new way to view information quickly from any watch face, plus comprehensive app redesigns across watchOS.

New Cycling support for Workout. Apple Watch can connect to Bluetooth-enabled bike sensors.

Now for the excited part for developers, Workout API. Developerss can create workout programs that can be accessible from the Workout app.

watchos details

11:20 am

The new AR platform Vision Pro is alive! It’s a headset, you look through, but not at. Digital content blended into the space around you.

Use eyes, hands and voice to control.

Vision Pro lets you never be separated from people around you. Vision pro displays your eyes when people are around. New “EyeSight” feature with an external display.

It can use Magic Trackpad and Magic Keyboard as control inputs, and even bring your Mac screen into Vision Pro.

It starts $3499.

Its operating system is called visionOS.

visionos details

11:40 am

Disney is celebrating its 100th anniversary.

Disney is celebrating its 100th anniversary.

That is all we gather from the WWDC 2023! For more detailed posts about the sessions, be sure you keep track our blog webpage or sign up for our newsletter from below.

Sending Push Notifications On React Native Using Firebase

Sending Push Notifications to React Native Using Firebase

On any mobile app, sending push notifications is an important way to communicate with the users. Setting up a push notification system and distributing notification is a tedious process. Services like Google’s Firebase aims to make this process easy. Let’s look at how we can integrate Firebase into a React Native app.

First, let’s create a project and run it:

npx react-native init SampleRNPushNotifications --template react-native-template-typescript
cd SampleRNPushNotifications
yarn ios

Then, download the necessary libraries:

yarn add react-native-push-notification 
@react-native-firebase/[email protected] 
@react-native-firebase/[email protected] 
@react-native-community/push-notification-ios 
@types/react-native-push-notification

To clarify what each library does:

  • React-native-push-notification: Necessary to send local notifications
  • @react-native-firebase/app@11.2.0: Main library required to use Firebase services
  • @react-native-firebase/messaging@11.2.0: Required to use Firebase Cloud Messaging (FCM)
  • @react-native-community/push-notification-ios: Required to get notification permissions in iOS
  • @types/react-native-push-notification: Contains type definitions for Push Notifications

Next step is to download and install Cocoapods for iOS dependencies:

npx pod-install

Now it’s time to create a new Firebase project:

Creating a Firebase Project

Go to console.firebase.google.com, and create a project:

 

Choose a name for your project. I chose SampleRNPushNotification:

 

There will be an option to choose whether you’ll use Firebase analytics tools. Select enable and continue:

 

Now select a Google Analytics account:

When your project is created, you will be informed with the message ‘’Your project is ready’’:

Creating Push Notifications for Android

From the left sidebar, select the gear icon next to Project Overview and then select Project Settings:

Scroll down to Your apps section and select the Android button:

Step 1. On the Register App section, enter the package name of your Android app. Find the package name by opening Android Studio, navigating to build.gradle (Module: app) file. It’s under the defaultConfig section, with the applicationId key:

cat android/app/build.gradle |pcregrep -o1 "applicationId \"(.+)\""

App nickname field is a given name for your app on Firebase console.

For Debug signing certificate field, you can get the SHA1 code by entering following command to the command line:

keytool -list -v -keystore ./android/app/debug.keystore -storepass android |pcregrep -o1 "SHA1: (.+)"

Step 2. Download config file will give you a Firebase configuration file. Drag the file on top of app folder on Android Studio. To open your project in Android Studio, enter the following command on your command line (Mac):

open -a /Applications/Android\ Studio.app ./android

Step 3. Add Firebase SDK step is where we need to add Google Analytics dependency to our Android app. Here’s how you can do it:

dependencies {
  classpath("com.android.tools.build:gradle:4.1.0") 
  classpath 'com.google.gms:google-services:4.3.5' 
  // NOTE: Do not place your application dependencies here, 
  // they belong in the individual module build.gradle files 
}

At the very bottom of the app/build.gradle file, add google services plugin:

apply plugin: "com.google.gms.google-services"

Afterwards, on the same file, under dependencies there will be lines that start with implementation. Add firebase analytics libraries under the last implementation statement there:

implementation platform('com.google.firebase:firebase-bom:27.0.0')
implementation 'com.google.firebase:firebase-analytics'

After all is complete, you’ll see a Sync Now button on Android Studio. Click it and synchronize the project with gradle.

Step 4. Run your app to verify installation so that Firebase Analytics is set up properly. Run it using the command and make the “Congratulations” part active on Firebase Console:

yarn run android

Configuring Firebase on React Native App

To get the device’s token, let’s open the App.tsx file and make the following changes:

import React, {useEffect} from 'react'; 
import firebase from '@react-native-firebase/app'; 
import messaging from '@react-native-firebase/messaging'; 
const App = () => { 
    useEffect(() => { 
        messaging().getToken(firebase.app().options.messagingSenderId) 
        .then(x => console.log(x)) 
        .catch(e => console.log(e)); 
    }, []); 
    return <></>; 
}; 

export default App;

Then, run the project:

yarn android

When the project starts running, you’ll see the device’s token on the Metro Bundler terminal:

Note: We’ll use this token to send test notifications to our device.

To display the notification on screen while the app is open, update App.tsx file as follows:

import React, {useEffect} from 'react'; 
import firebase from '@react-native-firebase/app'; 
import '@react-native-firebase/messaging'; 
import PushNotification from 'react-native-push-notification'; 
import {Platform} from 'react-native'; 
import PushNotificationIOS from '@react-native-community/push-notification-ios'; 
import {FirebaseMessagingTypes} from '@react-native-firebase/messaging'; 

const App = () => { 
    useEffect(() => { 
        firebase.messaging().onMessage(response => { 
            console.log(JSON.stringify(response));
            if (Platform.OS !== 'ios') { 
                showNotification(response.notification!); 
                return; 
            } 
            PushNotificationIOS.requestPermissions().then(() => 
                showNotification(response.notification!), 
            ); 
        }); 
    }, 
    []
    ); 
    const showNotification = ( notification: FirebaseMessagingTypes.Notification, ) => { 
        PushNotification.localNotification({ title: notification.title, message: notification.body!, }); 
    }; 
    return <></>; 
}; 

export default App;

All done! Now let’s navigate to Firebase console to test whether sending notifications work. Select Cloud Messaging under Grow section on the left. Then, select Send your first message button.

1. Under Notification section, fill in the content for your notification. To add images to your notification, you must be on a paid plan on Firebase. You can get the test image from unsplash.

2. Select Send test message. Then on the next field, you can enter the device token you got from the last section to send a test notification:

Make sure the app ran at least once on your device before sending. Do all the adjustments and tap Review. Verify the content and tap Publish. After sending, you’ll see the notification like this:

Creating Firebase Push Notifications on iOS

Open the iOS project in Xcode:

open ios/SampleRNPushNotifications.xcworkspace

Navigate to Firebase console, and add an iOS app:

Follow the steps there afterwards.

Step 1. Register app: First, you need to find your app’s bundle identifier. It can be found from Xcode:

 

Step 2. Download config file: Download the plist file and drag it into SampleRNPushNotifications folder. Pick all 4 targets on the panel that follows:

 

Step 3. Add firebase SDK: All you need to do is to add the following line to your Podfile file (not Podfile.lock):

pod 'Firebase/Analytics'

then run Cocoapods:

pod install --project-directory=ios/

Step 4. Add initialization code: Go to AppDelegate.m file and import Firebase to the bottom of the imports:

@import Firebase;

then find the didFinishLaunchingWithOptions method and inside call initialize on Firebase:

[FIRApp configure];

Step 5. Run your app to verify installation: Run the app and see whether everything works:

npx react-native run-ios

Making changes to React Native App

If you’re using the iOS simulator to test, you might see a warning like the one below.

Apple now allows to test push notifications on the iOS simulators. For a detailed guide, check out SwiftLee’s article.

Make modifications to App.tsx file to make it work on iOS. This is the final file:

import React, {useEffect} from 'react'; 
import firebase from '@react-native-firebase/app'; 
import '@react-native-firebase/messaging'; 
import PushNotification from 'react-native-push-notification'; 
import {Platform} from 'react-native'; 
import {FirebaseMessagingTypes} from '@react-native-firebase/messaging'; 
import PushNotificationIOS from '@react-native-community/push-notification-ios'; 

const App = () => { 
    const getToken = () => { 
        firebase .messaging() 
        .getToken(firebase.app().options.messagingSenderId) 
        .then(x => console.log(x)) 
        .catch(e => console.log(e)); 
    }; 
    const registerForRemoteMessages = () => { 
        firebase 
        .messaging() 
        .registerDeviceForRemoteMessages() 
        .then(() => { 
            console.log('Registered'); 
            requestPermissions(); 
        }) 
        .catch(e => console.log(e)); 
    }; 
    const requestPermissions = () => { 
        firebase 
        .messaging() 
        .requestPermission() 
        .then((status: FirebaseMessagingTypes.AuthorizationStatus) => { 
            if (status === 1) { 
                console.log('Authorized'); 
                onMessage(); 
            } else { 
                console.log('Not authorized'); 
            } 
        }) 
        .catch(e => console.log(e)); 
    }; 
    const onMessage = () => { 
        firebase.messaging()
        .onMessage(response => { 
            showNotification(response.data!.notification); 
        }); 
    }; 
    const showNotification = (notification: any) => { 
        console.log('Showing notification'); 
        console.log(JSON.stringify(notification)); 
        PushNotification.localNotification({ 
            title: notification.title, message: notification.body!, 
        }); 
    }; 
    getToken(); 
    if (Platform.OS === 'ios') { 
        registerForRemoteMessages(); 
    } else { 
        onMessage(); 
    } 
    return <></>; 
}; 

export default App;

Where to Go From Here?

Sending push notifications gets easy with rnfirebase plugin. With a few minutes of configuration and little code, we’ve implemented the ability to send push notifications to our React Native app via Firebase.

You can check https://github.com/mikehardy/rnfbdemo project to create boilerplate React Native apps with Firebase. All you need to do is to create a new app on Firebase for ‘com.rnfbdemo’ and add GoogleServices-Info.plist and json files into the project. The rest is handled by make-demo.sh file.

You can find the final project we’ve built here at react-native-push-notification-firebase repo.

Use Appcircle to build, test and distribute your React Native apps. From creating an account to starting your first build takes less than 30 seconds. Start for free.

Happy coding!