Git Product home page Git Product logo

hms-core / hms-react-native-plugin Goto Github PK

View Code? Open in Web Editor NEW
232.0 19.0 65.0 12.8 MB

This repo contains all of React-Native HMS plugins.

Home Page: https://developer.huawei.com/consumer/en/doc/overview/HMS-Core-Plugin?ha_source=hms1

License: Apache License 2.0

Java 95.37% JavaScript 0.93% HTML 2.53% Starlark 0.22% Swift 0.71% Ruby 0.08% Objective-C 0.18%
react-native hms plugin push push-notifications huawei

hms-react-native-plugin's Introduction

HMS React-Native Plugins

license

This repo contains the source code for HMS React-Native first-party plugins, which are developed by the HMS Core team.

These plugins enable access to using kit-specific APIs. For more information about plugins, and how to use them, see Official Documentations.

Plugins

These are the available plugins in this repository.

Plugin Version Downloads Documentation Demo Project
Account version download-npm Getting Started
API Reference
example
Ads version download-npm Getting Started
API Reference
example
Ads-Prime version download-npm Getting Started
API Reference
example
Analytics version download-npm Getting Started
API Reference
example
AR version download-npm Getting Started
API Reference
example
Availability version download-npm Getting Started
API Reference
example
Awareness version download-npm Getting Started
API Reference
example
Contact Shield version download-npm Getting Started
API Reference
example
DTM version download-npm Getting Started
API Reference
example
Health version download-npm Getting Started
API Reference
example
IAP version download-npm Getting Started
API Reference
example
Location version download-npm Getting Started
API Reference
example
Map version download-npm Getting Started
API Reference
example
ML version download-npm Getting Started
API Reference
example
ML Body version download-npm Getting Started
API Reference
example
ML Image version download-npm Getting Started
API Reference
example
ML Language version download-npm Getting Started
API Reference
example
ML Text version download-npm Getting Started
API Reference
example
Nearby version download-npm Getting Started
API Reference
example
Push version download-npm Getting Started
API Reference
example
Push-Fcm version download-npm Getting Started
API Reference
example
Safety Detect version download-npm Getting Started
API Reference
example
Scan version download-npm Getting Started
API Reference
example
Site version download-npm Getting Started
API Reference
example

Question or issues

If you want to evaluate more about HMS Core, r/HMSCore on Reddit is for you to keep up with latest news about HMS Core, and to exchange insights with other developers.

If you have questions about how to use HMS samples, try the following options:

  • Stack Overflow is the best place for any programming questions. Be sure to tag your question with huawei-mobile-services.
  • Huawei Developer Forum HMS Core Module is great for general questions, or seeking recommendations and opinions.

If you run into a bug in our samples, please submit an issue to the Repository. Even better you can submit a Pull Request with a fix.

hms-react-native-plugin's People

Contributors

aktug avatar betulerkoc avatar gokberkbar avatar isamert avatar mike-mei avatar mustafahaluk avatar ozcanozgur avatar ozkulbeng avatar rozeridilar avatar serdar-can avatar tiantian0303 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hms-react-native-plugin's Issues

account example wrong import

Hi

In account plugin exmaple, in App.js (hms-react-native-plugin/react-native-hms-account/example/App.js::line 20), RNHMSAccount should be imported from "@hmscore/react-native-hms-account" not "react-native-hms-account"

src/RNMessageParser not found

after installed from npm package:

https://npm.runkit.com/react-native-hwpush

we are facing the issue: src/RNMessageParser not found

error: bundling failed: Error: Unable to resolve module ./src/RNMessageParser from D:\Mobile-App\appsella-mobileapp\node_modules\react-native-hwpush\index.js: The module ./src/RNMessageParser could not be found from D:\Mobile-App\appsella-mobileapp\node_modules\react-native-hwpush\index.js. Indeed, none of these files exist:

HMS Location: getLastLocation "Result from location kit is null"

Description
I have implemented the getLastLocation command, exactly and also a little abstracted as in the docs and kept stumbling upon the error "Result from location kit is null" and no result.

This is my code:

    /**
     * Returns the geolocation data
     */
    async getGeoLocation(): Promise<HmsGeolocationData> {
        try {
            await HMSLocation.LocationKit.Native.init();

            try {
                await HMSLocation.FusedLocation.Native.requestPermission();
            } catch (e) {
                alert('HMSLocation: Couldnt get location permissions', e);
                HMSLocation.FusedLocation.Native.requestPermission();
            }
        
        } catch (initException) {
            alert("Error while initializing." + initException);
        }
                
        return  HMSLocation.FusedLocation.Native.getLastLocation();
    },

I tried to resolve it for a while and then decided to try install another GPS app, because I feared, that something is wrong with my device.
As soon as I installed MAPS.ME (just to test the GPS chip in my phone) everything works perfect on this phone now.
I always get a location perfectly as expected and no problems.

But then I tried to upload the app to the Cloud Debugging instance and there again it doesn't work and return the "Result from location kit is null" error.
I did not change anything on the code.
It seems like I am only getting the last geolocation if it was initiated by another app.

Is there a command to initiate the location myself?
HMSLocation.LocationKit.Native.init() returns true from my example as well. (that was my first guess)

Did I miss anything?

Expected behavior
The geolocation coordinates should always be returned, even on a fresh phone, that has never accessed GPS coords from a different app.

Current behavior
As long as I did not install another app with GPS support I always get "Result from location kit is null".

Unable to set custom notification icon

Hello,

I'm having an issue with setting custom icon on notification popup on android. I've tried both of these approaches (described under section 11.) but the notification popup just keeps using the default icon.

I've also made sure that I'm using a resource located at: /res/raw/my_icon.png which, as the name suggests, is a PNG image. I've also tried using various other resources but nothing.

Thanks.

P. S. hms-push version: "@hmscore/react-native-hms-push": "^5.0.2-301",

Question: PushKit with custom "sound" from send API not working??

Description
Sending push notification, with custom sound, always play default sound

Expected behavior
The notification sound should be the custom sound

Current behavior
The notification play default sound

Screenshots
I place sound inside /res/raw
image

Environment

  • Platform: [e.g. React-Native/Cordova/Flutter/Xamarin]
  • Kit: [e.g. Push/Map/Ads/Account/IAP]
  • Kit Version [e.g. 5.0.3]
  • OS Version [e.g. Android 11]
  • Android Studio version (if applicable) [e.g. 4.1]
  • Platform version (if applicable)
  • Node Version (if applicable)
  • Your Location/Region (if applicable)

Other
Data sent to https://push-api.cloud.huawei.com/v1/[appid]/messages:send

{ 
    "message": {
        "notification": {
            "title": "Test title",
            "body": "Test body..."
        },
        "token": [
            "My device token", 
        ],
        "android": {
            "notification": {
                "title": "Test title",
                "body": "Test body...",
                "click_action": {
                    "type": 3
                },
                "default_sound": false,
                "sound": "storedispatch"
            }
        }
    }
}

iOS builds broken with react-native-hms-location

Description
Importing import HMSLocation from '@hmscore/react-native-hms-location'; causes iOS to build in runtime with

[Mon Nov 30 2020 12:29:30.290]  ERROR    TypeError: null is not an object (evaluating '_Geofence.default.GeofenceRequestConstants')
[Mon Nov 30 2020 12:29:30.291]  ERROR    Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)

Environment

  • Platform: React-Native
  • Kit: Location
  • Kit Version: 5.0.0-301-01

Unable to generate token

Description
I get an error whenever I call the getToken function. The error is:

[getToken] Error/Exception: {"nativeStackAndroid":[],"userInfo":null,"message":"6003: certificate fingerprint error","code":"907122045","line":2242,"column":45,"sourceURL":"http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false"}

I already added enabled the push kit, added the SHA-256 certificate fingerprint, added the agconnect-services.json inside my android/app folder. Setup my gradle:

buildscript {
    ext {
        buildToolsVersion = "29.0.2"
        minSdkVersion = 21
        compileSdkVersion = 29
        targetSdkVersion = 29
    }
    repositories {
        google()
        jcenter()
        maven {url 'https://plugins.gradle.org/m2/'}
        maven {url 'https://developer.huawei.com/repo/'}
    }
    dependencies {
        classpath("com.android.tools.build:gradle:3.5.3")
        classpath 'gradle.plugin.com.onesignal:onesignal-gradle-plugin:[0.12.9, 0.99.99]'
        classpath 'com.huawei.agconnect:agcp:1.2.1.301'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        mavenLocal()
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url("$rootDir/../node_modules/react-native/android")
        }
        maven {
            // Android JSC is installed from npm
            url("$rootDir/../node_modules/jsc-android/dist")
        }

        google()
        jcenter()
        maven { url 'https://www.jitpack.io' }
        maven {url 'https://developer.huawei.com/repo/'}
    }
}

and added

implementation 'com.huawei.hms:push:4.0.3.300'
implementation project(':react-native-hms-push')

Not sure what went wrong based on the error it generated.

Expected behavior
It should return a token

Current behavior
returns an error:

[getToken] Error/Exception: {"nativeStackAndroid":[],"userInfo":null,"message":"6003: certificate fingerprint error","code":"907122045","line":2242,"column":45,"sourceURL":"http://10.0.2.2:8081/index.bundle?platform=android&dev=true&minify=false"}

Screenshots
If applicable, add screenshots to help explain your issue

Environment
"@hmscore/react-native-hms-push": "^5.0.2-301",
"react": "16.13.1",
"react-native": "0.63.4",

[Map] Scroll behaviour inside ScrollView

Does the map support the feature that scrolling from an outbounding ScrollView is disabled while scrolling inside the MapView?
Google and Apple Maps support this out of the box. If you move around the map the ScrollView is fixed. The HMS map you cannot move if it is inside a ScrollView. Very little and laggy from left to right but not up and down.
Is there a setting I am missing? Or do I have to build this by my own checking the "onCameraMove" callback?

hmscore_react-native-hms-iap error loading when gradle starts :(

Could not determine the dependencies of task ':app:processDebugResources'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not find com.huawei.agconnect:agconnect-core:1.2.1.301.
Searched in the following locations:
- file:/Users/asd/.m2/repository/com/huawei/agconnect/agconnect-core/1.2.1.301/agconnect-core-1.2.1.301.pom
- file:/Users/asd/Desktop/hw/node_modules/react-native/android/com/huawei/agconnect/agconnect-core/1.2.1.301/agconnect-core-1.2.1.301.pom
- file:/Users/asd/Desktop/hw/node_modules/jsc-android/dist/com/huawei/agconnect/agconnect-core/1.2.1.301/agconnect-core-1.2.1.301.pom
- https://dl.google.com/dl/android/maven2/com/huawei/agconnect/agconnect-core/1.2.1.301/agconnect-core-1.2.1.301.pom
- https://jcenter.bintray.com/com/huawei/agconnect/agconnect-core/1.2.1.301/agconnect-core-1.2.1.301.pom
- https://www.jitpack.io/com/huawei/agconnect/agconnect-core/1.2.1.301/agconnect-core-1.2.1.301.pom
Required by:
project :app > project :hmscore_react-native-hms-iap
Could not find com.huawei.hms:iap:4.0.4.300.
Searched in the following locations:
- file:/Users/asd/.m2/repository/com/huawei/hms/iap/4.0.4.300/iap-4.0.4.300.pom
- file:/Users/asd/Desktop/hw/node_modules/react-native/android/com/huawei/hms/iap/4.0.4.300/iap-4.0.4.300.pom
- file:/Users/asd/Desktop/hw/node_modules/jsc-android/dist/com/huawei/hms/iap/4.0.4.300/iap-4.0.4.300.pom
- https://dl.google.com/dl/android/maven2/com/huawei/hms/iap/4.0.4.300/iap-4.0.4.300.pom
- https://jcenter.bintray.com/com/huawei/hms/iap/4.0.4.300/iap-4.0.4.300.pom
- https://www.jitpack.io/com/huawei/hms/iap/4.0.4.300/iap-4.0.4.300.pom
Required by:
project :app > project :hmscore_react-native-hms-iap

Question: Is there any way like animateMarkerToCoordinate

Thanks for the wonderful library, I have a tracking where I want to animate marker from one position to another position. like in react-native-maps we use function animateMarkerToCoordinate . Is there any method for this.
i.e
this.markerRef.animateMarkerToCoordinate(newCoordinate, duration);

react-native-hms-map not working with Vue Native

Background

I have react-native-maps installed in my Vue Native App. Now, I would like to extend my app to Huawei Devices. I installed react-native-hms-map but it seems having some issues.

Installation steps

  1. npm install @hmscore/react-native-hms-map

Attemps

I attempted using two methods, but both methods were not working either. I have the screenshots of the errors attached.

Method 1

<template>
    ...
          {{ renderMap() }}
    ...
</template>
<script>
import MapView, { GroundOverlay, MapTypes,TileOverlay } from "@hmscore/react-native-hms-map";
import React from "react"

...
export defaults {
  methods: {
    renderMap() {
      return (
        <MapView mapType={MapTypes.NONE}>
          <TileOverlay
            tileProvider={{url: 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png'}}
          />
        </MapView>
      )
    }
  }
}
 </script>

capture_method_1

Method 2

This method is also the method I use to integrate with react-native-maps.

<template>
    ....
    <MapView :mapType="mapType">
      <TileOverlay
        :tileProvider="{url: 'https://a.tile.openstreetmap.org/{z}/{x}/{y}.png'}"
      />
    </MapView>
    ....
<template/>

<script>
import MapView, { GroundOverlay, MapTypes,TileOverlay } from "@hmscore/react-native-hms-map";

export defaults {
  data() {
    return {
      mapType: MapTypes.NONE
    }
  }
}
</scripts>

Capture_method_2

Versions

"@hmscore/react-native-hms-location": "^5.0.0-301",
"@hmscore/react-native-hms-map": "5.0.1-300",
"react": "16.11.0",
"react-native": "0.62.2",
"vue-native-core": "^0.1.4",
"vue-native-helper": "^0.1.4",
"vue-native-scripts": "^0.1.4"

Any idea?

[Map] how to make infoWindow transparent

Hi team,

I have successfully integrated map kit and added infoWindow which have a white background(see screenshot below), however the design I'm trying to achieve require InfoWindow background to be transparent

this is the code:

styles = StyleSheet.create({
    infoWindow:{
        backgroundColor:'transparent'
    },
    tooltipContainer:{
        backgroundColor:"rgb(49,49,49)",
        borderRadious:6,
        paddingHorizontal:14,
        paddingVertical:6
    },
    tooltipText:{
        color:"#fff",
        fontFamily:"Muli",
        fontSize:12
    },
   arror: {
        backgroundColor: 'transparent',
        borderWidth: 12,
        borderColor: 'rgb(49,49,49)',
        alignSelf: 'center',
        marginTop: 0
    }
})

<MapView
onMapLoaded={()=> this.marker.showInfoWindow() }}
>
    <Marker
    coordinate={this.state.coords}
    res={ref=>this.marker = ref }
    >
        <InfoWindow
        style={this.styles.infoWindow}
        >
            <View style={stules.tooltipContainer}>
                <Text style={styles.tooltipText}/>  
                <View style={styles.arrow}/>
            </View>
        </InfoWindow>
    </Marker>
</MapView>

*** how to make the InfoWindow background transparent?

infowindow_bg

docs library wrong dirPath

there is another library with the name react-native-hms-map, therefore to install this library one should use the command: npm i @hmscore/react-native-hms-map; The android src will be at: node_modules/@hmscore/react-native-hms-map/android
So in Readme.md:
project(':react-native-hms-map').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-hms-map/android')
should become:
project(':react-native-hms-map').projectDir = new File(rootProject.projectDir, '../node_modules/@hmscore/react-native-hms-map/android')

App crashas in Android while opening

hi guys, i am also facing the same issue app is not opening in android,But it is working on hms core apk presented device ,but not working in google service device.And also when i uninstall hms-push pkg it is opening in google service phones and when i install it is not opening in google service phones

this is the logcat i am getting in android studio when opening

Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
at com.huawei.hms.rn.push.logger.HMSLogger.getInstance(HMSLogger.java:100)
at com.huawei.hms.rn.push.remote.HmsPushMessageService.onTokenError(HmsPushMessageService.java:107)
at com.huawei.hms.push.HmsMessageService.a(HmsMessageService.java:34)
at com.huawei.hms.push.HmsMessageService.a(HmsMessageService.java:29)
at com.huawei.hms.push.HmsMessageService.handleIntentMessage(HmsMessageService.java:7)
at com.huawei.hms.push.HmsMessageService$a.handleMessage(HmsMessageService.java:7)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:238)
at android.app.ActivityThread.main(ActivityThread.java:7878)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:512)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1028)

HMS Location issue with error code 800

I'm trying to access the Huawei map and location in react native application for android support, After making necessary changes based on the HMS-location kit demo, I'm unable to load the maps and location. I'm getting the below error message.

Error while getting location settings. Error: {"errorCode":800,"errorMessage":"907135003: Connection Failed:application configuration error, please developer check configuration(10)"}

Please let me know any changes to be done to resolve the issue.

Platform: React-Native 0.63.4 , React 16.13.1
Kit: [Map & Location]
LocationKit: "@hmscore/react-native-hms-location": "^5.0.0-301-02",
MapKit:"@hmscore/react-native-hms-map": "^5.0.3-302-01",
OS Version [Android 10, Android 11]
Android Studio version [ Android Studio 4.0.1]

HMS Maps are not rendering in huawei cloud device and hms core installed google play service devices

I'm trying to use Huawei maps in react native application for android support, After making necessary changes based on hms map kit demo, I'm unable to load the maps in Huawei cloud simulator and hms core with google play service devices as well. I'm able to see only a white screen on the map. Please let me know any changes to be done to resolve the issue.

  • Platform: React-Native 0.63.4 , React 16.13.1
  • Kit: [Map ]
  • Kit Version [5.0.1-300]
  • OS Version [Android 10, Android 11]
  • Android Studio version [ Android Studio 4.0.1]

Screenshot 2020-12-16 at 4 21 49 PM

Screenshot 2020-12-16 at 4 11 32 PM

HmsPushEvent.onNotificationOpenedApp is getting executed even after tap in loop

Hi all,

HmsPushEvent.onNotificationOpenedApp is got executed in the loop when we use to open the external url

this.huaweiPushMessageOpenedListener = HmsPushEvent.onNotificationOpenedApp((result) => { console.log("consolehms inside onNotificationOpenedApp ==>", result); if (result) { if (result.extras && result.extras.notification && result.extras.notification.customData) { let dataMessage = result.extras.notification.customData; Linking.openURL(dataMessage.url); }}

After on tap on the message with URL, it is correctly open the URL in the browser, but when we come back to open the app, it again triggers the event onNotificationOpenedApp() and again it opens the URL in browser and it keep on loop

iOS builds broken with react-native-hms-push

Description
HmsPushMessaging causes iOS to build in runtime with

[Mon Dec 21 2020 10:34:28.716] ERROR TypeError: null is not an object (evaluating 'HmsPushMessaging')

  • A module failed to load due to an error and AppRegistry.registerComponent wasn't called.

Environment

Platform: React-Native 0.63.3
Kit: Push
Kit Version: 5.0.2-301

[Map] Marker icon from a Link

Hello team,

Does marker icon property supports web Urls? if not can you add support for that?

<Marker 
icon={{ path: 'https://upload.wikimedia.org/wikipedia/commons/thumb/8/88/Map_marker.svg/512px-Map_marker.svg.png" }}
/>

Also is there a way to scale the icons (increase/decrease the size)?

thanks.

I got the module's file content by "npm install" not match the file on github

I got the @hmscore/react-native-hms-push by npm install @hmscore/react-native-hms-push like these code:

index.js by npm install

import { NativeModules, NativeEventEmitter, Platform } from "react-native";

const { HmsPushInstanceId, HmsLocalNotification, HmsPushMessaging, HmsPushOpenDevice } = NativeModules;


import {
  Importance,
  Priority,
  RepeatType,
  Visibility,
} from "@hmscore/react-native-hms-push/src/LocalNotification";

Object.assign(HmsLocalNotification, {
  Importance: { ...Importance },
  Priority: { ...Priority },
  RepeatType: { ...RepeatType },
  Visibility: { ...Visibility },
  Attr: {
    id: "id",
    message: "message",
    fireDate: "fireDate",
    title: "title",
    ticker: "ticker",
    showWhen: "showWhen",
    autoCancel: "autoCancel",
    largeIcon: "largeIcon",
    largeIconUrl: "largeIconUrl",
    smallIcon: "smallIcon",
    bigText: "bigText",
    subText: "subText",
    bigPictureUrl: "bigPictureUrl",
    shortcutId: "shortcutId",
    number: "number",
    channelId: "channelId",
    channelName: "channelName",
    channelDescription: "channelDescription",
    color: "color",
    group: "group",
    groupSummary: "groupSummary",
    playSound: "playSound",
    soundName: "soundName",
    vibrate: "vibrate",
    vibrateDuration: "vibrateDuration",
    actions: "actions",
    invokeApp: "invokeApp",
    tag: "tag",
    repeatType: "repeatType",
    repeatTime: "repeatTime",
    ongoing: "ongoing",
    allowWhileIdle: "allowWhileIdle",
    dontNotifyInForeground: "dontNotifyInForeground",
    priority: "priority",
    importance: "importance",
    visibility: "visibility",
  },
});


import { HmsPushEvent } from "@hmscore/react-native-hms-push/src/HmsPushEvent";

HmsPushEvent.onRemoteMessageReceived = (result) =>
  new NativeEventEmitter()
    .addListener(HmsPushEvent.REMOTE_DATA_MESSAGE_RECEIVED, result);

HmsPushEvent.onTokenReceived = (result) =>
  new NativeEventEmitter()
    .addListener(HmsPushEvent.TOKEN_RECEIVED_EVENT, result);

HmsPushEvent.onTokenError = (result) =>
  new NativeEventEmitter()
    .addListener(HmsPushEvent.ON_TOKEN_ERROR_EVENT, result);

HmsPushEvent.onPushMessageSent = (result) =>
  new NativeEventEmitter()
    .addListener(HmsPushEvent.ON_PUSH_MESSAGE_SENT, result);

HmsPushEvent.onPushMessageSentError = (result) =>
  new NativeEventEmitter()
    .addListener(HmsPushEvent.ON_PUSH_MESSAGE_SENT_ERROR, result);

HmsPushEvent.onPushMessageSentDelivered = (result) =>
  new NativeEventEmitter()
    .addListener(HmsPushEvent.ON_PUSH_MESSAGE_SENT_DELIVERED, result);

HmsPushEvent.onLocalNotificationAction = (result) =>
  new NativeEventEmitter()
    .addListener(HmsPushEvent.LOCAL_NOTIFICATION_ACTION_EVENT, result);

HmsPushEvent.onNotificationOpenedApp = (result) =>
  new NativeEventEmitter()
    .addListener(HmsPushEvent.NOTIFICATION_OPENED_EVENT, result);


export { RNRemoteMessage } from "@hmscore/react-native-hms-push/src/RNRemoteMessage";
export { HmsPushResultCode } from "@hmscore/react-native-hms-push/src/HmsPushResultCode";
export { RemoteMessageBuilder } from "@hmscore/react-native-hms-push/src/RemoteMessageBuilder";

export { HmsPushInstanceId, HmsPushOpenDevice, HmsLocalNotification, HmsPushMessaging, HmsPushEvent };

export default HmsPushInstanceId;

index.js on github

import { NativeModules } from 'react-native';

const { RNHmsInstanceId } = NativeModules;
export default RNHmsInstanceId;

export const { RNHmsMessaging } = NativeModules;

export { RNRemoteMessage, RNReceiverEvent,RNErrorEnum} from './src/RNMessageParser';

react-native-hms-iap [Question]

Description
After integrating react-native-hms-iap we have trouble with app verification.

when i test on : real device , cloud debbuging with realdevice/simulator all works ideally, when my app is verified by Huawei they cant buy anythink.

Video

So my question is : what i am doing wrong ? any suggestion ? is this mystic ? Thanks for any help!

Can't get Received Push Notification payload

Description
When listening to onNotificationOpenedApp I expect to see the payload I send on my message

Expected behavior
I expect to see the payload of the message I sent

Current behavior
The received message object is empty

Logs
This is the payload I'm sending through https://push-api.cloud.huawei.com/v1/XXXXX/messages:send

{
"validate_only": false,
"extra" : {"e1" : 1},
"message": {
"extra2" : {"e2" : 1},
"data" : "prueba",
"notification": {
"title": "message title",
"body": " message body",
"Extra1" : "Extra1,"
},
"android": {
"extra3" : {"e3" : 3},
"notification": {
"extra4" : {"e4" : 4},
"title": "Noti in Noti title",
"body": "Mi cuerpo TOPIC",
"click_action": {
"type": 1,
"intent" : "intent"
}
}
}, "topic": "XXX__XXX"
}
}

And this is the JSON response I see when running this code
HmsPushEvent.onNotificationOpenedApp((result)=>{
console.log("NOTIFICATION_OPENED_EVENT",JSON.stringify(result));
})

NOTIFICATION_OPENED_EVENT {"uriPage":null,"extras":{"_push_cmd_type":"cosa","_push_msgid":"-1778066760","_push_notifyid":415863099},"remoteMessage":{"Link":"null","collapseKey":null,"ClickAction":null,"NotifyId":"0","contents":"0","When":"null","token":null,"isDefaultSound":"true","isDefaultVibrate":"true","ImageUrl":"null","bodyLocalizationArgs":"null","Ticker":null,"Tag":null,"Sound":null,"isLocalOnly":"true","data":null,"body":null,"urgency":"2","titleLocalizationKey":null,"originalUrgency":"2","vibrateConfig":"null","messageId":null,"dataOfMap":"{}","BadgeNumber":"null","sentTime":"0","intentUri":null,"isDefaultLight":"true","isAutoCancel":"true","from":null,"ChannelId":null,"Color":null,"titleLocalizationArgs":"null","to":null,"sendMode":"0","bodyLocalizationKey":null,"Importance":"null","icon":null,"messageType":null,"ttl":"86400","LightSettings":"null","receiptMode":"0","visibility":"null","title":null}}

As you can see, the whole object is null, instead of having any of the payload that I was sent

Environment

  • Platform: [e.g. React-Native/Cordova/Flutter/Xamarin]
  • Kit: Push
  • Kit Version 5.0.2-301
  • OS Version Android 11
  • Android Studio version4.1

Other

com.huawei.hms.rn.location.backend.logger.HMSLogger.<init>

Description
Got an error in firebase console

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'java.lang.Object android.content.Context.getSystemService(java.lang.String)' on a null object reference

System:
OS: macOS 11.1
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 50.95 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 15.4.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.0.15 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.0 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK:
API Levels: 19, 21, 23, 25, 26, 27, 28, 29
Build Tools: 26.0.2, 27.0.3, 28.0.3, 29.0.0, 29.0.2
System Images: android-16 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_201 - /usr/bin/javac
Python: 2.7.16 - /usr/local/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-macos: Not Found
@hmscore/react-native-hms-location: ^5.0.4-300

image

Bitcode bundle could not be generated error because AGConnectAppLinking was built without full bitcode

Description
Cannot build archive in XCode.
Bitcode bundle could not be generated error because AGConnectAppLinking was built without full bitcode.

Exact error:
bitcode bundle could not be generated because '/app/ios/Pods/AGConnectAppLinking/AGConnectAppLinking.framework/AGConnectAppLinking(Pods-AGConnectAppLinking-dummy.o)' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build file '/app/ios/Pods/AGConnectAppLinking/AGConnectAppLinking.framework/AGConnectAppLinking' for architecture armv7

Expected behavior
To be able to archive

Current behavior
Error in archiving

Environment

  • Platform: ReactNative
  • Kit: App Linking
  • OS: iOS

Crash on InterstitialAd.loadAd

Description
Hello, from our firebase console we see lots of crashes with this stack trace:

Fatal Exception: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.content.Context.getResources()' on a null object reference
at com.huawei.hms.ads.w.Code(w.java:20)
at com.huawei.hms.ads.w.Code(w.java:12)
at com.huawei.hms.ads.InterstitialAd.loadAd(InterstitialAd.java:2)
at com.huawei.hms.rn.ads.HMSAdsInterstitialAdModule.lambda$loadAd$0(HMSAdsInterstitialAdModule.java:209)
at com.huawei.hms.rn.ads.HMSAdsInterstitialAdModule.lambda$loadAd$0$HMSAdsInterstitialAdModule(HMSAdsInterstitialAdModule.java)
at com.huawei.hms.rn.ads.-$$Lambda$HMSAdsInterstitialAdModule$5OKlWN00oKt90NUqstcphOat7vE.run(-.java:4)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.app.ActivityThread.main(ActivityThread.java:7830)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1040)

In our App we display Huawei Interstitials ads.

To add more info:

in Firebase it shows that this crash happens when 99% of time when devices are in the background.
I think there is a bug loading interstitial ads while the app is in the background.

Any ideas on how to fix it? I tried to check the loadAd method but it is a black-box.

Thank you,
Marco

Unable to start service com.huawei.hms.rn.push.remote.HmsPushMessageService

Device: Huawei Mate 10 Pro
Android version: 10
Plugin version: "@hmscore/react-native-hms-push": "^5.0.2-300"

When attempt to receive data message from server, I received this in the log:

E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.trandllstudio.jcpstaging, PID: 18443
java.lang.RuntimeException: Unable to start service com.huawei.hms.rn.push.remote.HmsPushMessageService@686d26a with Intent { act=com.huawei.push.action.MESSAGING_EVENT pkg=com.trandllstudio.jcpstaging (has extras) }: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4683)
at android.app.ActivityThread.access$2900(ActivityThread.java:296)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2259)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:213)
at android.app.ActivityThread.main(ActivityThread.java:8178)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Context.getPackageName()' on a null object reference
at com.huawei.hms.rn.push.logger.HMSLogger.setupEventMap(HMSLogger.java:292)
at com.huawei.hms.rn.push.logger.HMSLogger.(HMSLogger.java:78)
at com.huawei.hms.rn.push.logger.HMSLogger.getInstance(HMSLogger.java:95)
at com.huawei.hms.rn.push.remote.HmsPushMessageService.onMessageReceived(HmsPushMessageService.java:35)
at com.huawei.hms.push.HmsMessageService.a(HmsMessageService.java:185)
at com.huawei.hms.push.HmsMessageService.onStartCommand(HmsMessageService.java:131)
at com.huawei.hms.rn.push.remote.HmsPushMessageService.onStartCommand(HmsPushMessageService.java:90)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:4663)
at android.app.ActivityThread.access$2900(ActivityThread.java:296) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2259) 
at android.os.Handler.dispatchMessage(Handler.java:107) 
at android.os.Looper.loop(Looper.java:213) 
at android.app.ActivityThread.main(ActivityThread.java:8178) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101) 

App crashes on open after installing @hmscore/react-native-hms-push version 5.1.1-301

Description
App crashes on open after installing @hmscore/react-native-hms-push version 5.1.1-301

Expected behavior
App should not crash

Current behavior
App crashes

Crash report:
Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
com.huawei.hms.rn.push.logger.HMSLogger.getInstance
com.huawei.hms.rn.push.logger.HMSLogger.getInstance (HMSLogger.java:100)
com.huawei.hms.rn.push.remote.HmsPushMessageService.onTokenError (HmsPushMessageService.java:107)
com.huawei.hms.push.HmsMessageService.a (HmsMessageService.java:34)
com.huawei.hms.push.HmsMessageService.a (HmsMessageService.java:29)
com.huawei.hms.push.HmsMessageService.handleIntentMessage (HmsMessageService.java:7)
com.huawei.hms.push.HmsMessageService$a.handleMessage (HmsMessageService.java:7)

when I uninstall @hmscore/react-native-hms-push version 5.1.1-301. App does not crash anymore. Also downgrading @hmscore/react-native-hms-push to 5.0.2-301 works.

Environment

  • Platform: React-Native
  • Kit: Push Kit
  • Kit Version 5.0.2-301
  • OS Version Android 7.0

iOS builds broken with react-native-hms-analytics

Description
Add @hmscore/react-native-hms-analytics in project, add the AppGallery Connect configuration file and run the pod install command:

[!] Unable to determine Swift version for the following pods:

- react-native-hms-analytics does not specify a Swift version and none of the targets (`Sima`) integrating it have the `SWIFT_VERSION` attribute set. Please contact the author or set the `SWIFT_VERSION` attribute in at least one of the targets that integrate this pod.

Environment

  • Platform: React-Native
  • Kit: Analytics
  • Kit Version: 5.1.0-300-01

[location] mistake in docs

in Readme file of react-native-hms-location:
the method: removeLocationUpdates is in FusedLocationModule

HMSLocation.LocationKit.Native.removeLocationUpdates(locactionUpdateId)
  .then(_ => console.log("Remove location update successful"));

becoms:

HMSLocation.FusedLocation.Native.removeLocationUpdates(locactionUpdateId)
  .then(_ => console.log("Remove location update successful"));

App crashes when installed on iOS/non Huawei Android device

Hi! We integrated react-native-hms-push in our React Native app. It runs with no problems on Huawei phones, but the app crashes right when it starts if we run it on an iPhone or on other Android devices. There's no error and no logs in metro.
These are the versions of our dependencies (those that are relevant):

"@hmscore/react-native-hms-push": "^5.1.1-301",
"@react-native-agconnect/appmessaging": "1.2.0",
"@react-native-agconnect/core": "^1.2.0",
"@react-native-agconnect/crash": "1.2.0",
"react": "16.13.1",
"react-i18next": "^11.8.5",
"react-native": "0.63.4",

If I remove the react-native-hms-push dependency (and of course, the code that depends on it), the app starts. Anyone else running into this?

Map view not loaded

I have @hmscore/react-native-hms-map installed by following these Installation Guide
All done, and I could install app successfully.

However, the map doesn't render well

I simply do this:

import MapView from '@hmscore/react-native-hms-map';

<MapView
    camera={{ target: { latitude: 50, longitude: 50 } }} 
/>

And it render only empty grid

App Info

react: 16.9.0 => 16.9.0 
react-native: 0.61.5 => 0.61.5 

Would you have any clue what wrong with this empty map?

[MAP] Prevent marker click automatic moving

When I click on a marker even doing nothing like
<Marker ... onClick={() => console.log('press')} />
the map is moving. Always so that the clicked marker moves to the middle of the screen. Is there a way to disable that?

MapView.Marker missing ID

Hi,

The view marker does not have a property Id, key Or tag, I know that the native marker supports setting Tag,
can you please add a property to identify a maker:

<MapView>
  <Marker
    id={id}
    //or
    key={id}
   //or at least
   tag={id}
/>
</MapView>

this way I can have unique identifier for my tags, or is there another way to identify markers?

Problem with import of react-native-hms-map in react-native

failing import of library in component.
Fails to link index.js file.

Example:
import HMSMapView, {MapTypes, Marker} from '@hmscore/react-native-hms-map';

Solution:
we solved this by:

  1. moved out of the src index.js.
  2. we modified the package.json file of library:
    • added in field "files"--> "index.js".
    • corrected --> "main": "index.js"
  3. import
    import HMSMapView, {MapTypes, Marker} from '@hmscore/react-native-hms-map/index';

HMS MAP not re render

Description
I'm trying to use Huawei maps in react native Application using bottom tab navigation. after making all suggested changes App first time load maps loaded successfully. after switching tab map hide.

Expected behavior
map should load perfectly after tab switching.

Current behavior
map not re rendering

Screenshots
WhatsApp Image 2020-12-30 at 12 38 38 PM

Logs
https://ghostbin.co/paste/fhh3v

Environment

  • Platform: [ React-Native: 0.63.4, React: 16.13.1]
  • Kit: [Map - 5.0.3-302-01 ]
  • Kit Version [e.g. 5.0.3]
  • OS Version [e.g. Android 10 Huawei Y9 prime]
  • Android Studio version (if applicable) [e.g. 4.0]
  • Platform version (if applicable)
  • Node Version (14.15.3)
  • Your Location/Region (if applicable)

Other
Add any other context about the problem here

com.huawei.hms.rn.location.backend.helpers.HMSBroadcastReceiver.init

Description
Got an error in firebase console

Fatal Exception: java.lang.NullPointerException
Attempt to invoke virtual method 'android.content.Context android.app.Activity.getApplicationContext()' on a null object reference

System:
OS: macOS 11.1
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Memory: 50.95 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 15.4.0 - /usr/local/bin/node
Yarn: 1.22.10 - /usr/local/bin/yarn
npm: 7.0.15 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.0 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.4, DriverKit 20.2, macOS 11.1, tvOS 14.3, watchOS 7.2
Android SDK:
API Levels: 19, 21, 23, 25, 26, 27, 28, 29
Build Tools: 26.0.2, 27.0.3, 28.0.3, 29.0.0, 29.0.2
System Images: android-16 | Google APIs Intel x86 Atom, android-19 | Google APIs Intel x86 Atom, android-22 | Google APIs Intel x86 Atom_64, android-23 | Google APIs Intel x86 Atom, android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom, android-29 | Google Play Intel x86 Atom_64, android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.6953283
Xcode: 12.4/12D4e - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_201 - /usr/bin/javac
Python: 2.7.16 - /usr/local/bin/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.3 => 0.63.3
react-native-macos: Not Found
@hmscore/react-native-hms-location: ^5.0.4-300

image

Program type already present: com.huawei.hms.rn.push.BuildConfig

After integrating Push Kit, I got this error

Building app from command line got this error both react-native run-android and ./gradlew assembleRelease

> Task :app:transformClassesWithMultidexlistForRelease FAILED
D8: Program type already present: com.huawei.hms.rn.push.BuildConfig

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:transformClassesWithMultidexlistForRelease'.
> com.android.build.api.transform.TransformException: Error while generating the main dex list:
  Error while merging dex archives: 
  Learn how to resolve the issue at https://developer.android.com/studio/build/dependencies#duplicate_classes.
  Program type already present: com.huawei.hms.rn.push.BuildConfig

However, running the app from Android Studio has no problem

App Info

  • React native: 0.61.5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.