The flitter Aurora push manufacturer can't push the click problem

I went to various blogs and didn't find a solution. I found a way to record it and help friends who didn't solve the problem. This involves the distribution strategy of Aurora push. When you integrate the manufacturer push, you give priority to the manufacturer push. As a result, most mobile phones can't receive the callback method of fluent, but can receive the push, Clicking the notification will not do any processing. Therefore, we modify the aurora push strategy to use Aurora push when the app is online and manufacturer push when it is not online. This needs to be changed in the background. See the following figure for specific requirements

This is the push setting of Aurora's official website, and then see how to set it in the background

The screenshot is not very complete, but you can still see the specific document links to view the aurora http://docs.jiguang.cn/jpush/server/push/rest_api_v3_push/#options
Here we have completed the integration of Aurora push. The vendor push has led to the problem that the callback of shuttle cannot be received, but the integration of our vendor push is still useless. I will continue below.
Many people have said about the integration steps, so I won't write them. We just say how to click to enter the app after receiving the push. The official wants us to see the original, so we still look at the documents. I take Huawei as an example. Meizu doesn't know how to integrate, but Xiaomi is the same as vivo, and oppo is a little different. We are looking at the picture


From these two figures, we can see that the server needs to pass in the URI when pushing_ Activity: package name. The activity to jump to, so we just need to configure this activity. Let's see the example given by the official

Click to jump directly to the page you specified, and then you can get the value transmitted from the service to carry out specific operations. Of course, if the app is killed, we only need to open the app. If we don't need operations, can we directly send our startup page MainActivity to the server

<activity
            android:name=".MainActivity"
            android:requestLegacyExternalStorage="true"
            android:launchMode="singleTop"
            android:theme="@style/LaunchTheme"
            android:exported="true"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
            android:hardwareAccelerated="true"
            android:windowSoftInputMode="adjustResize">
            <!-- Specifies an Android theme to apply to this Activity as soon as
                 the Android process has started. This theme is visible to the user
                 while the Flutter UI initializes. After that, this theme continues
                 to determine the Window background behind the Flutter UI. -->
            <meta-data
              android:name="io.flutter.embedding.android.NormalTheme"
              android:resource="@style/NormalTheme"
              />
            <!-- Displays an Android View that continues showing the launch screen
                 Drawable until Flutter paints its first frame, then this splash
                 screen fades out. A splash screen is useful to avoid any visual
                 gap between the end of Android's launch screen and the painting of
                 Flutter's first frame. -->
            <meta-data
              android:name="io.flutter.embedding.android.SplashScreenDrawable"
              android:resource="@drawable/launch_background"
              />
              <intent-filter>
               <action android:name="android.intent.action.VIEW"/>
               <category android:name="android.intent.category.DEFAULT"/>
           </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

I haven't tested this. I've tried it for you. You can tell me if there are any problems. You can see that I added it where the system is generated

android:exported="true"


 <intent-filter>
               <action android:name="android.intent.action.VIEW"/>
               <category android:name="android.intent.category.DEFAULT"/>
 </intent-filter>

Two parts of code. If you can't, you can create an activity, click to jump to this activity, and then the activity will jump to the fluent page. This is basically completed.
There are a lot of activity jumps to the fluent Internet. I just write two columns casually, because I also have problems here. It's not very good. If you have better information, you can tell me about the application setting engine

class MyApplication : Application() {

    lateinit var flutterEngine: FlutterEngine

    override fun onCreate() {
        super.onCreate()
        flutterEngine = FlutterEngine(this)
        flutterEngine.dartExecutor.executeDartEntrypoint(
            DartExecutor.DartEntrypoint.createDefault()
        )
        FlutterEngineCache
            .getInstance()
            .put("engine_id", flutterEngine)
    }

    override fun onTerminate() {
        //Destroy the shuttle engine
        flutterEngine.destroy()
        super.onTerminate()
    }


}

Then click the activity to jump to start the shutter page

try {
            startActivity(
                FlutterActivity
                    .withCachedEngine("engine_id")
                    .build(this)
            )
            finish()
        }catch (e:Exception){
            var intent = Intent(this, MainActivity::class.java)
            startActivity(intent)
            finish()
        }

Because I didn't register fluteractivity in the manifest, I sometimes reported an error when jumping. Fluteractivity was not registered in the manifest, sometimes not, but it was registered. I added a default topbar, so I used this method. It's not very good. You can tell me a better way. That's it

Tags: Flutter

Posted on Wed, 10 Nov 2021 17:18:19 -0500 by elite_prodigy