Push Message
Supported SDK Version
This feature is supported in Android SDK version 2.33.0 and above.
1. Integrate Firebase Project
To use push messages in an Android app, you need to integrate the Hackle workspace with the Firebase project.
For more details, please refer to Android FCM Integration.
2. Integrate Firebase Cloud Messaging SDK
Please complete the Android app settings by following the Firebase Cloud Messaging Installation Guide.
3. Integrate with Hackle SDK
Refer to SDK Integration to add the Hackle SDK dependency and initialize the SDK.
The push token will be automatically registered when building and running the app.
4. Test Push Messages
-
Check Token: You can verify the token set on the Android device by following the User Identifier Verification Guide.
-
Send Test: Follow the Push Message Test Sending Guide to verify the push message on the Android device.
(Advanced) Deep Link Navigation
Hackle push messages support deep link navigation when clicked. If an activity opens through a push message, you can check the opened deep link information as follows:
For more details on Android deep linking, please refer to the Android Deep Linking Guide.
import android.app.Activity
import android.content.Intent
import android.os.Bundle
class ExampleActivity : Activity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstance)
if (intent != null && !intent.dataString.isNullOrEmpty()) {
// Do something ...
println("link : ${intent?.dataString}")
}
}
override fun onNewIntent(intent: Intent?) {
super.onNewIntent(intent)
setIntent(intent)
if (intent != null && !intent.dataString.isNullOrEmpty()) {
// Do something ...
println("link : ${intent?.dataString}")
}
}
}
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import androidx.annotation.Nullable;
public class ExampleActivity extends Activity {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
if (intent != null && intent.getDataString() != null) {
String text = String.format("link : %s", intent.getDataString());
System.out.println(text);
}
}
@Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
setIntent(intent);
if (intent != null && intent.getDataString() != null) {
String text = String.format("link : %s", intent.getDataString());
System.out.println(text);
}
}
}
Updated 6 months ago