MobPush Android FAQ

Is the default click-to-jump interface configured, is it valid for all channels?

Only valid for MobPush, Meizu, Xiaomi, Huawei, OPPO, VIVO channels, not valid for FCM channels.

How to get callback parameters

  • When the process is alive, you can see the notification details in our callback listener, which can be processed according to the callback parameters. For details, please refer to API Interface->Push Listening Interface.
  • When the process is killed, callback monitoring is not available, but clicking the notification and pulling up the startup page of the application will trigger the onCreate or onNewIntent of starting the Activity, and get the returned Intent through getIntent to get the notification details.
  • Note: PushSDK provides a parsing method to obtain callback parameters, but the vendor notification is mainly to obtain additional fields, and will not parse all the information. Jump to the homepage to get parameters
JSONArray jsonArray =  MobPushUtils.parseMainPluginPushIntent(getIntent());
System.out.println("-------------JsonPushData打印查看:"+jsonArray);

return instructions

return field illustrate
“id”:“4bu9702gmq4mvl3myo” id Notification task id, only vendor notifications have this field
{“key”:“value”} additional field The attachment field needs to be specified, if not specified, it will not appear, only the manufacturer notifies this field
{“from_tcp”:true} from_tcp Whether the message comes from the MobPushTCP channel, true: yes
{“msg”:“MobPushNotifyMessage{}”} msg Message body, the object is MobPushNotifyMessage, only MobPushTCP channel messages have this field
{“channel”:“mobpush”} channel channel name

2.2 Scheme jump to obtain parameters, please refer to API interface->scheme jump for details

JSONArray jsonArray = MobPushUtils.parseSchemePluginPushIntent(getIntent());
System.out.println("-------------JsonScheme打印查看:"+jsonArray);

return instructions

return field illustrate
{“from_tcp”:true} from_tcp Whether the message comes from the MobPushTCP channel, true: yes
{“msg”:“MobPushNotifyMessage{}”} msg Message body, the object is MobPushNotifyMessage, only MobPushTCP channel messages have this field
{“key”:“value”} additional field The attachment field needs to be specified, it is recommended not to use url as the key
{“mobpush_link_k”:“mlink://com.mob.mobpush.link”} scheme scheme address
{“mobpush_link_v”:“schemeKey=schemeValue”} scheme parameter The scheme parameters carried under the scheme address
{“id”:“4brfm8nti9aj1arf28”} id push task id
{“channel”:“xiaomi”} channel channel name
{“schemeLink”:“mlink://com.mobpush.demo2”} scheme scheme address
{“schemeKey”:“schemeValue”} scheme parameter The scheme parameters carried under the scheme address (Huawei, VIVO, OPPO)
{“schemeKey”:“schemeValue”,“schemeUrl”:“mlink://com.mob.mobpush.link”} schemeUrl The scheme parameter (flyme) carried under the scheme address

3. If you do not use the analysis method provided by PushSDK, you can refer to the following methods to obtain callback parameters

private void dealPushResponse(Intent intent) {
        Bundle bundle = null;
        if (intent != null) {
            bundle = intent.getExtras();
            if (bundle == null) {
                Log.e("PushResponse","bundle的值为空"+bundle);
                return;
            }
            else {
                Set<String> keySet = bundle.keySet();
                if (keySet == null || keySet.isEmpty()) {
                    return;
                }
                for (String key  : keySet) {
                    //通过key获取bundle中的key对应的值。就是附加数据了
                    Log.e("PushResponse","bundlekey===========================点击信息"+key);
                }
                Log.e("PushResponse","bundle===========================点击信息"+bundle.toString());
            }
        }
    }

When OPPO pushes, it pushes according to all groups of people, why some OPPO devices can’t receive it

Because OPPO push corresponds to all groups of people, this kind of full push has a time limit rule. When the full amount is pushed, the newly registered OPPO devices on the day will not take effect, and it will take effect the next day. The full push will be counted in the target device group, T+ 1 rule. When pushing to a single OPPO device, there is no T+1 rule restriction, and it will take effect immediately after successful registration.

Will there be a callback when the manufacturer pushes and opens the notification?

Not all callbacks are available. OPPO Push does not have callbacks for receiving notifications and opening notifications; FCM Push does not have callbacks for receiving notifications and opening notifications when the application is in the background or the application process is killed.

When the app is in the foreground, the MobPush channel push cannot be received

When the app is in the foreground, the MobPush channel push cannot be received. Please follow the steps below to check:
1. Check whether the phone network is normal. 2. Check whether
the notification permission of the phone is enabled. correct

Call MobPush.setClickNotificationToLaunchMainActivity(), set it to false, and click the notification to not start the homepage. Why does it not work after setting it?

This method does not work for all channels. Currently, it only works for MobPush channels, Meizu channels, and Xiaomi channels. For Huawei channels, OPPO channels, and FCM channels, it does not matter whether this method is called or not due to different implementations of each manufacturer. Affect these three channels, the default is to start the home page.

OPPO and VIVO device notification permission switch problem

OPPO:
Before connecting to OPPO PUSH, the notification bar permission of the application is turned off by default; after connecting to OPPO PUSH, the OPPO phone with ColorOS3.1 to 5.0 version, after the user activates the relevant application, the notification bar permission will be turned on by default. In particular, if the user is using an old version of the app (not integrated with OPPO PUSH) and manually closes the permission of the notification bar of the app, only the user can manually uninstall the old version of the app, and then install the new version (integrated with OPPO PUSH) and activate it. bar is turned on by default. With the overlay installation method, the permission of the notification bar will not be enabled by default; for mobile phones of ColorOS5.1 and later versions, the permission of the notification bar is turned off by the system uniformly, and the user needs to manually open it.

VIVO:
Integrated with VPUSH, the general notification permission switch is basically turned on by default, but the category switch below is turned off by default and needs to be turned on manually by the user.

Mi mobile phone can not receive push

If the mobile application (APP) is not released on the Xiaomi Store, the Xiaomi push team will have the right to no longer provide push services. As a result of the regular security review of the developer’s application, the Mi App Store adjusts the app’s push permission. If the developer’s app fails to pass the regular security review of the Mi App Store, Xiaomi has the right to unilaterally terminate the agreement, or immediately close the app’s push permission. Until the app passes the security review of the Mi App Store and is released on the Mi App Store. For details, please refer to: link

If the Xiaomi mobile phone cannot receive the push, please check whether the notification permission is turned on. At the same time, the Xiaomi device starts to use unimportant notification filtering in the notification bar from MIUI9, and check whether there is a notification of the corresponding application in the unimportant notification in the notification bar.

The application notification permission is not turned on, and the push notification cannot be received after it is turned on

At the beginning, the application notification permission was not enabled. When the notification permission is enabled, please kill the process, restart the APP and push it again.

Will the receive callback and click notification callback be called?

uncertain. Divided into push channels, different manufacturers have different implementation methods, resulting in some calling back, some only calling back the click notification, and some not calling back.

MobPush channel, receive callback and click notification callback will be called;

Huawei manufacturer channel, manufacturer push only provides click notification callback;

The Xiaomi manufacturer channel, both the receive callback and the click notification callback will be called;

Meizu manufacturer channel, both receive callback and click notification callback will be called;

OPPO manufacturer channel, neither callback;

The FCM channel, when the application is in the foreground, both the receiving callback and the click notification callback will be called. When the application is in the background or the application process is killed and not started, neither of the two callbacks is available;

VIVO manufacturer channel, manufacturer push only provides click notification callback.

After the label is set successfully, push through the label, but the push cannot be received

After the tag is successfully set, it takes time for some manufacturers to pull the data synchronously, which leads to the success of setting the tag on the interface, but the device is not synchronized when pushing, and there is no target device, so the push cannot be received. It is recommended to wait for a few minutes after the device is successfully tagged before pushing.

How many aliases can one device set? Can different devices set the same alias?

The same APP and one device can only correspond to one alias, and the newly set alias will overwrite the previously set alias. Different devices cannot set the same alias at the same time, the device set last takes effect, and the aliases of other devices will become invalid.

If the application cannot obtain the registration ID (regId) on the Android 9 device

If the registration ID can be obtained on other versions of Android phones, but not on Android 9 devices, please confirm that the targetSdkVersion is greater than 27; if it is greater than 27, you need to add android in the application tag of the AndroidManifest.xml file: usesCleartextTraffic="true"

What should I do if the push is configured with an FCM vendor and other Firebase products (ads and other products) need to be used at the same time, and an error is reported when compiling?

1. When configuring ads and FCM separately, whether the versions of the same libraries they depend on are consistent, if not, you need to unify the versions;
2. Unify the versions: add in the build.gradle of APPmodule

configurations.all { 
    exclude group: 'com.google.firebase', module: 'firebase-messaging' 
} 
//在app module 的build.gradle文件的dependencies里添加
compile 'com.google. firebase:firebase-messaging:17.1.0'

Do I need to remove the "-" when configuring the appId and AppKey pushed by the vivo manufacturer?

unnecessary

Access to the vivo manufacturer's push, the push is sent successfully, but the vivo device does not receive the push

1. Check whether the configuration is correct, whether the package name is consistent with the package name when applying for the vivo push service;
2. Whether the mobile phone notification permission is turned on;
3. Check whether the message has been delivered but folded into the message box? The current strategy is to display the app when it is alive, and fold it when it is not alive;
4. Check whether there is a problem with the device’s network connection. If the connected wifi is set up as a proxy, it is generally necessary to restart the phone, and you can switch the phone network to try again;

What should I do if the information pushed by the manufacturer is configured, but the AppKey is incomplete and the first number is found to be incomplete after running the package?

This is caused by the gradle version being too high. Please add a space where there is a problem with the configuration.

Why are some Huawei devices unable to receive offline messages after Huawei vendor push is configured?

First, check whether the configured parameters of the Huawei manufacturer are correct; second, check the EMUI version of the Huawei device. If it is lower than 5.0, it may not be supported. If it is lower than 5.0, you can try to upgrade the "Huawei Mobile Services" application in the device and upgrade the "Huawei Mobile Services" Huawei manufacturers may be supported.

The vendor push of MobPush conflicts with the vendor push of other third-party products used by the application. How to solve it?

On the home page, configure the vendor information in the MobPush{} configuration of build.gradle as usual; then, add at the end of the build.gradle file:

configurations.all {
    exclude group: 'com.mob.push.plugins', module: 'meizu'   //屏蔽MobPush提供的魅族厂商包
    exclude group: 'com.mob.push.plugins', module: 'xiaomi'  //屏蔽MobPush提供的小米厂商包
    exclude group: 'com.mob.push.plugins', module: 'vivo'    //屏蔽MobPush提供的vivo厂商包
    exclude group: 'com.mob.push.plugins', module: 'oppo'    //屏蔽MobPush提供的oppo厂商包
}

Which manufacturer conflicts, whichever manufacturer can be excluded.

If the Meizu manufacturer push in other third-party products used by the app conflicts with the Meizu manufacturer push of MobPush, one of them will not work when pushing

Since the Meizu vendor push only takes the first Reciever configured in AndroidManifest.xml for the receiving monitoring callback, whichever component is configured in the front will take effect, and the configuration in the latter will be invalid.
Solution: Customize a Receiver, inherit MzPushMessageReceiver, rewrite all the methods in it, call the Meizu callback of MobPush and the Meizu callback of third-party products in this Receiver, and configure it in the AndroidManifest.xml file:

<receiver
                android:name="自定义Receiver">
                <intent-filter>
                        <action
                                android:name="com.meizu.flyme.push.intent.MESSAGE" />
                        <action
                              android:name="com.meizu.flyme.push.intent.REGISTER.FEEDBACK" />
                        <action
                                android:name="com.meizu.flyme.push.intent.UNREGISTER.FEEDBACK" />
                        <action
                                android:name="com.meizu.c2dm.intent.REGISTRATION" />
                        <action
                                android:name="com.meizu.c2dm.intent.RECEIVE" />
                        <category
                                android:name="包名" />
                </intent-filter>
        </receiver>

Implement an example in a custom Receiver:

public class MyReceiver extends MzPushMessageReceiver {
         private OtherReceiver otherReceiver;
         private PushMeiZuRevicer mobpushMeiZuReceiver;
         public MyReceiver() {
                otherReceiver = new OtherReceiver();
                mobpushMeiZuReceiver = new PushMeiZuRevicer();
         }
         @Override
         public void onPushStatus(Context context, PushSwitchStatus pushSwitchStatus) {
                otherReceiver.onPushStatus(context, pushSwitchStatus);
                mobpushMeiZuReceiver.onPushStatus(context, pushSwitchStatus);
         }
         @Override
         public void onRegisterStatus(Context context, RegisterStatus registerStatus) {
                otherReceiver.onRegisterStatus(context, registerStatus);
                mobpushMeiZuReceiver.onRegisterStatus(context, registerStatus);
         }
         @Override
         public void onRegister(Context context, String s) {
                otherReceiver.onRegister(context, s);
                mobpushMeiZuReceiver.onRegister(context, s);
         }
         @Override
         public void onUnRegister(Context context, boolean b) {
                otherReceiver.onUnRegister(context, b);
                mobpushMeiZuReceiver.onUnRegister(context, b);
         }
         @Override
         public void onUnRegisterStatus(Context context, UnRegisterStatus unRegisterStatus) {
                otherReceiver.onUnRegisterStatus(context, unRegisterStatus);
                mobpushMeiZuReceiver.onUnRegisterStatus(context, unRegisterStatus);
         }
         @Override
         public void onSubTagsStatus(Context context, SubTagsStatus subTagsStatus) {
                otherReceiver.onSubTagsStatus(context, subTagsStatus);
                mobpushMeiZuReceiver.onSubTagsStatus(context, subTagsStatus);
         }
         @Override
         public void onSubAliasStatus(Context context, SubAliasStatus subAliasStatus) {
                otherReceiver.onSubAliasStatus(context, subAliasStatus);
                mobpushMeiZuReceiver.onSubAliasStatus(context, subAliasStatus);
         }
         @Override
         public void onNotificationClicked(Context context, MzPushMessage mzPushMessage) {
                otherReceiver.onNotificationClicked(context, mzPushMessage);
                mobpushMeiZuReceiver.onNotificationClicked(context, mzPushMessage);
         }
         @Override
         public void onNotificationArrived(Context context, MzPushMessage mzPushMessage) {
                otherReceiver.onNotificationArrived(context, mzPushMessage);
                mobpushMeiZuReceiver.onNotificationArrived(context, mzPushMessage);
         }

         @Override
         public void onNotifyMessageArrived(Context context, String s) {
                otherReceiver.onNotifyMessageArrived(context, s);
                mobpushMeiZuReceiver.onNotifyMessageArrived(context, s);
         }
    }

The Meizu manufacturer’s push is configured, the client’s debug log output is registered successfully, but the push is not received during the push or the offline push is not received, how to solve it

1. Confirm that the Meizu manufacturer's push access is flyme push, not ups push.
2. Check whether the application created on the Meizu Developer Platform is configured with a receipt. If not, please configure it. This will affect the push result and cause the push to fail.
3. If all the above are confirmed to be normal, but there are still problems, please contact MobTech technical support for troubleshooting.

The same push listener callback is called multiple times, why?

If the application has multiple sub-processes, and the push monitoring callback is added in the onCreate method of Application, then there are several sub-processes. Application's onCreate will be called several times, and the monitoring callback will be added several times, so the same push monitoring callback will appear. The case where it is called multiple times. If you want to only monitor and call back the main process, then you need to judge the current process when adding it, and then add the push monitoring callback when the main process is in the main process.

Does it support corner mark function?

MobPush supports corner mark function. Need to call MobPush.setShowBadge(true); turn on badge function, default false, badge function off.
For the manufacturer channel, the Xiaomi system itself supports the corner mark function without any processing;
Meizu manufacturers do not support the corner mark function;
OPPO and VIVO manufacturers currently only open the corner mark function to their own applications and WeChat QQ;
Huawei manufacturers support EMUI 8.0 and above support the badge function. If you need to enable the badge function for Huawei manufacturers, add the androidBadgeClass parameter in the extrasMapList parameter when the server pushes. The parameter value is the full path of the application entry Activity, so EMUI8.0 and above Devices pushed by Huawei manufacturers can display corner marks.

Does MobPush support multiple package names?

support.

Can one device application set multiple tags? Can different devices of the same application set the same label?

The same APP and one device can subscribe to multiple tags. Please try to use English tags to avoid using Chinese or special characters, which will cause manufacturers to fail to subscribe tags and push unsuccessfully; different devices can set the same tag at the same time.

Will the RegistrationId of MobPush change? If the change is sent at what time? Is RegistrationId a fixed length?

Generally, the registration id will not be sent to change, but there will also be changes found. Sometimes the registration id will change when the device is uninstalled and reinstalled or the device is restored to the factory, and the length of the registration id will change due to the internal optimization of the server. , is not of fixed length.

Will using StopPush close all vendor channel pushes?

Except that the FCM manufacturer cannot be closed (the related interface is not provided), TCP and other manufacturers are normally closed.

After turning on the notification permission, I still can't receive it

MobPush will only update the record's notification permission status during initialization.

If the notification permission is turned off during initialization, you need to restart the APP again to update the recorded notification permission status. If you need real-time updates, you can call this method:

//打开轮询开关
MobPush.startNotificationMonitor();
//关闭轮询开关
MobPush.stopNotificationMonitor();

Unable to count manufacturers

Please add this method in the onCreate of the Activity opened by clicking the notification

MobPush.notificationClickAck(getIntent());

Huawei manufacturer's long text style is invalid

Use the Huawei long text style, and the title (title) is required.

Huawei manufacturers parse intent is empty

Huawei's transfer of data to the app is only effective when the NC version is 9.11 or above. The NC version can be viewed (Settings-Application-Application Management-Push Service). Old devices have problems with no push service or a lower version. You can try to upgrade the version Solution, if it cannot be upgraded, Huawei has not provided a compatible solution for old equipment. Detailed instructions can be found at: link

What should I do if the integrated Huawei vendor channel is rejected on the Google store?

For example, in the rejected copy of the google store, there is the words "We found your app is using a non-compliant version of Huawei Mobile Services SDK which contains code to download or install applications from unknown sources outside of Google Play", the reason is that you are currently using The Huawei SDK version is too low. Huawei has fixed this problem in version 6.3.0.304 (2022-03-31) and later. You can actively declare this version in the Gradle script, as shown in the following example.
picture

The use of the setTimestamp function for local notifications is invalid on Android 12 and above

Because in the Android12 version, when calling the precise alarm clock method, the SCHEDULE_EXACT_ALARM permission must be added, which can be solved by adding this permission in the manifest file.

Guess you like

Origin blog.csdn.net/apkkkk/article/details/131653704
Recommended