Package 

Class HmsMessageServiceOneSignal

  • All Implemented Interfaces:
    android.content.ComponentCallbacks , android.content.ComponentCallbacks2

    
    public final class HmsMessageServiceOneSignal
    extends HmsMessageService
                        

    The hms:push library creates an instance of this service based on the intent-filter action "com.huawei.push.action.MESSAGING_EVENT".

    WARNING: HMS only creates one HmsMessageService instance. This means this class will not be used by the app in the following cases:

    • Another push provider library / SDK is in the app.

    • Due to ordering in the AndroidManifest.xml OneSignal may or may not be the winner.

    • App needs to it's own HmsMessageService and call bridging / forwarding APIs on each SDK / library for both to work.

    • The app has it's own HmsMessageService class. If either of these are true the app must have it's own HmsMessageService with AndroidManifest.xml entries and call OneSignalHmsEventBridge for these methods. This is noted in the OneSignal SDK Huawei setup guide.

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private final Messenger a
    • Method Summary

      Modifier and Type Method Description
      Unit onNewToken(String token, Bundle bundle) When an app calls the getToken method to apply for a token from the server, if the server does not return the token during current method calling, the server can return the token through this method later.
      Unit onNewToken(String token)
      Unit onMessageReceived(RemoteMessage message) This method is called in the following cases:
      • "Data messages" - App process is alive when received.

      • "Notification Message" - foreground_show = false and app is in focus This method callback must be completed in 10 seconds, start a new Job if more time is needed.

      • This may only be a restriction for #1

      • 10 sec limit didn't seem to hit for #2, even when backgrounding the app after the method starts

      • Methods inherited from class android.app.Service

        bindIsolatedService, bindService, bindService, bindService, bindService, bindServiceAsUser, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceContext, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAssets, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDeviceId, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getResources, getSharedPreferences, getSystemService, getSystemServiceName, getTheme, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, openOrCreateDatabase, peekWallpaper, registerComponentCallbacks, registerDeviceIdChangeListener, registerReceiver, registerReceiver, registerReceiver, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeSelfPermissionsOnKill, revokeUriPermission, revokeUriPermission, sendBroadcast, sendBroadcast, sendBroadcast, sendBroadcastAsUser, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setTheme, setWallpaper, setWallpaper, startActivities, startActivities, startActivity, startActivity, startForegroundService, startInstrumentation, startIntentSender, startIntentSender, startService, stopService, unbindService, unregisterComponentCallbacks, unregisterDeviceIdChangeListener, unregisterReceiver, updateServiceGroup
      • Methods inherited from class android.content.ContextWrapper

        bindIsolatedService, getColor, getColorStateList, getDrawable, getString, getString, getSystemService, getText, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, obtainStyledAttributes, revokeSelfPermissionOnKill, sendBroadcastWithMultiplePermissions
      • Methods inherited from class com.huawei.hms.push.HmsMessageService

        attachBaseContext, dump, getApplication, getForegroundServiceType, onConfigurationChanged, onCreate, onLowMemory, onRebind, onStart, onTaskRemoved, onTimeout, onTrimMemory, onUnbind, startForeground, startForeground, stopForeground, stopForeground, stopSelf, stopSelf, stopSelfResult
      • Methods inherited from class com.onesignal.notifications.services.HmsMessageServiceOneSignal

        a, a, a, a, a, a, b, b, b, doMsgReceived, handleIntentMessage, onBind, onDeletedMessages, onDestroy, onMessageDelivered, onMessageSent, onSendError, onStartCommand, onTokenError, onTokenError
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HmsMessageServiceOneSignal

        HmsMessageServiceOneSignal()
    • Method Detail

      • onNewToken

         Unit onNewToken(String token, Bundle bundle)

        When an app calls the getToken method to apply for a token from the server, if the server does not return the token during current method calling, the server can return the token through this method later. This method callback must be completed in 10 seconds. Otherwise, you need to start a new Job for callback processing.

        Parameters:
        token - token
        bundle - bundle
      • onMessageReceived

         Unit onMessageReceived(RemoteMessage message)

        This method is called in the following cases:

        • "Data messages" - App process is alive when received.

        • "Notification Message" - foreground_show = false and app is in focus This method callback must be completed in 10 seconds, start a new Job if more time is needed.

        • This may only be a restriction for #1

        • 10 sec limit didn't seem to hit for #2, even when backgrounding the app after the method starts

        Parameters:
        message - RemoteMessage