Android Question How to get the FirebaseMassaging "registration_id" on the targetversion 30

Michael Müller Anywhere

Member
Licensed User
For push-notofication from a window-software (with "fcm.googleapis.com" and "fcm/send") to my App I'll need the registration_id to address the target android-device. It has 182 characters.
To get this string in the App I use (in the serve module "Firebasemassaging":


Module FirebaseMassaging:
Sub RegisterDevice (Unregister As Boolean)
Dim i As Intent
    i.Initialize("com.google.android.c2dm.intent.REGISTER",  "")
    i.PutExtra("sender",  Projekt_id)
    Dim jo As JavaObject = i
    jo.RunMethod( "setPackage", Array("com.google.android.gms"))
    Dim r As Reflector
    Dim i2 As Intent
    i2 = r.CreateObject("android.content.Intent")
    Dim pi As Object
    pi = r.RunStaticMethod("android.app.PendingIntent", "getBroadcast", _
     Array As Object(r.GetContext, 0, i2, 0), _
     Array As String("android.content.Context", "java.lang.int", "android.content.Intent", "java.lang.int"))
    i.PutExtra("app", pi)
    StartService(i)
End Sub


It returns:

Module FirebaseMassaging:
Sub HandleRegistrationResult(Intent As Intent)
Dim rid As String

    If Intent.HasExtra("error") Then
        Log("Error: " & Intent.GetExtra("error"))
    Else If Intent.HasExtra("unregistered") Then
        'Empty id is sent here. This will cause the board to delete this name.
    Else If Intent.HasExtra("registration_id") Then
        rid = Intent.GetExtra("registration_id")
    End If
End Sub

This code workes until version 29

On version 30 the error-block returns: INVALID_TARGET_VERSION

Is there a way to get the registration_id on version 30?
Or a replacement to send push-notification to my App?

Thank you
 
Top