Skip to content

infobip/mobile-messaging-sdk-huawei

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Mobile Messaging SDK for Huawei on Android

Download License

Mobile Messaging SDK is designed and developed to easily enable push notification channel in your mobile application. In almost no time of implementation you get push notification in your application and access to the features of Infobip Mobile Apps Messaging. The document describes library integration steps. Additional information can be found in our Wiki.

Requirements

  • Android Studio
  • API Level: 21 (Android 5.0 - Lollipop) - 33 (Android 13.0 - Tiramisu)
  • HMS Core (APK) 4.0.0.300 or later
  • AppGallery

Quick start guide

  1. Make sure to setup application at Infobip portal, if you haven't already.

  2. Add dependencies to app/build.gradle

    dependencies {
        ...
        implementation ('com.infobip:infobip-mobile-messaging-huawei-sdk:6.8.2@aar') {
            transitive = true
        }
    }
  3. Configure Huawei application

  4. Add HMS App ID and Infobip Application Code obtained in step 1 to values/strings.xml

    <resources>
        <string name="app_id">SENDER ID</string>
        <string name="infobip_application_code">APPLICATION CODE</string>
        ...
    </resources>

    HMS App ID could be taken from Huawei Developer Console - Application settings

  5. Download agconnect-services.json from AppGallery Connect and copy it to your app's folder.

     a. Find your App from the list and click the link under Android App in the Mobile phone column.
     
     b. Go to Develop > Overview.
     
     c. In the App information area, Click `agconnect-services.json` to download the configuration file.
     
     **Note** that if you are developing / testing FCM and HMS at the same device then better to remove cache for installed app, remove app and after that install build with other push cloud. 
    
  6. Add code to MainActivity#onCreate

    public class MainActivity extends AppCompatActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_main);
    
            new MobileMessaging
                    .Builder(getApplication())
                    .build();
        }
    }
    String resources

Notice:

Since Android 13+ we are using default notification permission request dialog. It is possible to trigger permission request later, to learn how please follow: Android 13 notification permission handling.


NEXT STEPS: Users and installations


Notes

  1. All required manifest components are merged to application manifest automatically by manifest merger. Please include push-related components to manifest manually if manifest merger was disabled.
  2. Keep in mind that some proprietary Android versions may restrict network traffic for your app. It may in turn affect delivery of push notifications.
If you have any questions or suggestions, feel free to send an email to [email protected] or create an issue.