Git Product home page Git Product logo

Comments (45)

oney avatar oney commented on July 19, 2024

What version of React Native and react-native-gcm-android are you using?

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

"react-native-gcm-android": "0.1.6", "react-native": "^0.17.0", are the
versions that I'm using.

On 18 January 2016 at 14:10, Howard Yang [email protected] wrote:

What version of React Native and react-native-gcm-android are you using?


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Can you run adb logcat to get some logs?

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

Hi oney, this is my log.

D/WifiService(  585): releaseWifiLockLocked: WifiLock{NlpWifiLock type=2 binder=android.os.BinderProxy@20e05681}
I/GCM     (  842): GCM message com.carpetpro_mobile 0:1453102696504996%fa6b524cf9fd7ecd
D/RNGcmListenerService(14475): sendNotification
D/com.oney.gcm.GcmModule(14475): sadfjasidfjliasf444
D/BackgroundService(14475): onStartCommand
D/BackgroundService(14475): DeclaredField: APPLICATION_ID
D/BackgroundService(14475): DeclaredField: BUILD_TYPE
D/BackgroundService(14475): DeclaredField: FLAVOR
D/BackgroundService(14475): DeclaredField: VERSION_NAME
D/BackgroundService(14475): DeclaredField: DEBUG
D/BackgroundService(14475): DeclaredField value: true
W/unknown:React(14475): The packager does not seem to be running as we got an IOException requesting its status: failed to connect to /10.0.3.2 (port 8081) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused)
I/art     (14475): Thread[1,tid=14475,WaitingForJniOnLoad,Thread*=0xf4306800,peer=0x73b83970,"main"] recursive attempt to load library "/data/app/com.carpetpro_mobile-2/lib/x86/libreactnativejni.so"

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Oh, I guess it is related to this.
Run below command to generate index.android.bundle, and then run react-native run-android

react-native bundle --platform android --dev false --entry-file index.android.js \
  --bundle-output android/app/src/main/assets/index.android.bundle \
  --assets-dest android/app/src/main/res/

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

It still results in the same issue :(

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Do you load js bundle from 10.0.3.2:8081?

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

I do.

On 18 January 2016 at 18:05, Howard Yang [email protected] wrote:

Do you load js bundle from 10.0.3.2:8081?


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

:(

On 18 January 2016 at 18:13, Joselito Narte [email protected] wrote:

I do.

On 18 January 2016 at 18:05, Howard Yang [email protected] wrote:

Do you load js bundle from 10.0.3.2:8081?


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

JOJO

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Maybe it's related to facebook/react-native#3167 (comment)
Please try run adb reverse tcp:8081 tcp:8081 then react-native run-android

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

I just did this and it still didn't work out :'(

On 18 January 2016 at 18:27, Howard Yang [email protected] wrote:

Maybe it's related to facebook/react-native#3167 (comment)
facebook/react-native#3167 (comment)
Please try run adb reverse tcp:8081 tcp:8081 then react-native run-android


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Can you show index.android.js to me? You can remove irrelevant codes.

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

/**

var React = require('react-native');
var db = require('./models/User');
var JobOrderDB = require('./models/JobOrder');
var JobOrderStatDB = require('./models/JobOrderStatusLookup');
var Login = require('./components/LoginView.js');
var config = require('./config/app');
var appUpdate = require('./modules/AppUpdate');
var appUtil = require('./modules/AppUtilitiesModule');
var DeviceInfo = require('react-native-device-info');
var androidGeolocationModule =
require('./modules/AndroidGeolocationModule');
var images = require('./config/constants/images');
var AppData = require('./models/App');
var GcmAndroid = require('react-native-gcm-android');
import Notification from 'react-native-system-notification';
var networkUtil = require('./modules/NetworkUtilitiesModule');

var {
AppRegistry,
StyleSheet,
Text,
ListView,
Image,
TextInput,
NativeModules,
View,
DrawerLayoutAndroid,
Navigator,
BackAndroid,
ToastAndroid,
TouchableNativeFeedback,
TouchableHighlight,
TouchableOpacity,
Dimensions
} = React;

var cssVar = require('cssVar');
var onMenuClick = '';
var navig = '';
var _gcmAction =(action)=>{
console.log("gcm action>>>>",action);
switch(action){
case 'file_upload': console.log("gcm action",action);
ToastAndroid.show('',ToastAndroid.SHORT);
break;
case 'job_change': console.log("gcm action",action);
ToastAndroid.show('',ToastAndroid.SHORT);
break;
case 'device_logout':
appUtil.clearApplicationData();

                                    console.log("gcm action","other

device used your credentials");
break;
default: console.log("gcm action",action);
}
};
if (GcmAndroid.launchNotification) {
console.log('GcmAndroid.launchNotification:',
GcmAndroid.launchNotification);
var notification = GcmAndroid.launchNotification;
var info = JSON.parse(notification.info);
_gcmAction(info.action);

GcmAndroid.createNotification({
    subject: info.subject,
    message: info.message,
    largeIcon: 'ic_launcher',
    autoCancel: true,
    ticker: 'new notification!',
});
GcmAndroid.stopService();

}
else {
var app_mobile = React.createClass({

    getInitialState: function () {
        return {
            loading: false,
            email: '',
            token: '',
            position: {
            coords: {
                lat: '',
                lng: ''
            }
            },
            location:'',
            error: '',
            gcmLogged:false,
        };
    },
    requestNewLocation: function() {
        androidGeolocationModule.getCurrentLocation(
        (position) => this.setState({position: position}),
        (error) => this.setState({error: error})
        );
    },
    componendDidUpdate: function(prevProps,prevState) {
        requestNewLocation();
    },
    addBackButton: function (navigator) {
        var self = this;
        BackAndroid.addEventListener('hardwareBackPress', function () {
            navigator.pop();
            return true;
        });
    },
    componentWillMount: function() {
        this.setState({gcmLogged : false})

    },
    componentDidMount: function () {
        var self = this;

        androidGeolocationModule.getCurrentLocation(
        (position) => this.setState({position: position}),
        (error) => this.setState({error: error})
        );

        if(self.gcmLogged != true){

            db.FetchSession(function (err, data) {
            if (data.length > 0) {
                self.setState({
                    loading: true,
                    email: data[0].username
                });
            }
            else {
                self.setState({
                    loading: true,
                    email: ''
                });
            }
        });

        }

        GcmAndroid.addEventListener('register', function(token) {
            AppData.DeleteData();
            AppData.InsertData(token);
            console.log('send gcm token to server', token);
            self.setState({
                token: token
            })
        });

        GcmAndroid.addEventListener('notification',

function(notification) {
console.log('receive gcm notification', notification);
console.log('GcmAndroid.isInForeground',
GcmAndroid.isInForeground);

            var info = JSON.parse(notification.data.info);

            console.log('RECEIVED NOTIFICATION');

            if (!GcmAndroid.isInForeground) {
                GcmAndroid.createNotification({
                    subject: info.subject,
                    message: info.message,
                    largeIcon: 'ic_launcher',
                    autoCancel: true,
                    ticker: 'new notification!',
                });
                _gcmAction(info.action);
                this.setState({gcmLogged:true});
            }

        });
        GcmAndroid.requestPermissions();
    },
    renderLoading: function () {
        return (
            <View style={styles.loading_container}>
                <Text>
                    Loading...
                </Text>
            </View>
        );
    },
    drawerInstance : {
        instance : {openDrawer : function(){}}
    },

    initInstance : function(instance){
        console.log(instance);
        this.drawerInstance.instance = instance;
    },

    _onMenuClick : function(event){
        this.drawerInstance.instance.openDrawer();
    },

    _onDrawerItemClick : function(event){
        this.drawerInstance.instance.closeDrawer();
    },

    checkUpdate: function() {
        this._onDrawerItemClick();
        appUpdate.updateApp("GO");
    },

    render: function () {

        onMenuClick = this._onMenuClick;

console.log('POSSSSIITIOOON'+JSON.stringify(this.state.position));
// ToastAndroid.show(this.state.,ToastAndroid.SHORT);
var navigationView = (
<View style={{flex: 1, backgroundColor: '#253039'}}>
<TouchableHighlight
onPress={this._change.bind(this,'SystemInfos')}>

<Text style={{margin: 15, marginLeft: 2,
fontSize: 15, textAlign: 'left', paddingLeft: 10, paddingRight:10,color:
'#FFF'}}>System Info




<Text style={{margin: 15, marginLeft: 2,
fontSize: 15, textAlign: 'left', paddingLeft: 10, paddingRight:10,color:
'#FFF'}}>Update App



);

        if (!this.state.loading) {
            return this.renderLoading();
        }
        else {
            var initialRoute = {};
            if (this.state.email === ''|| this.gcmLogged == false)
                initialRoute = {id: 'Login', index: 0};
            else
                initialRoute = {id: 'WorkerJob', index: 0, title:

"Installer App"};
return (
<DrawerLayoutAndroid
drawerWidth={175}
drawerHeight={100}
ref={this.initInstance}
drawerPosition={DrawerLayoutAndroid.positions.Left}
renderNavigationView={() => navigationView} >

                    <Navigator
                        ref="carpet_pro_nav"
                        style={styles.container}
                        initialRoute={initialRoute}
                        title="Carpet Pros"
                        renderScene={this.renderScene.bind(this)}
                        configueScene = {(route) =>

Navigator.SceneConfigs.FloatFromRight}

                        navigationBar={
                                  <Navigator.NavigationBar
                                    routeMapper={navMap}
                                    style={styles.navBar}
                                    actions={[{title: 'Settings',
                                    icon:

require('./config/constants/images').HAMBURGER, show: 'always'}]}/>
} />

);
}
},

    popAll: function(){
        this.refs.carpet_pro_nav.popToTop();
    },

    renderScene: function (route, navigator){
        console.log('renderScene [navigator: ' + navigator + ']');
        var self = this;
        self.addBackButton(navigator);
        var routeID = route.id;
        var nextIndex = route.index + 1;
         this.navig = navigator;

        if (routeID === 'Login') {

            return (
                <Login
                   ...
                    }}/>
            );
        }
        if (routeID === 'WorkerJob') {
            var WorkerJobListView =

require('./components/WorkerJobListView.js');

            return (
                <WorkerJobListView
                    ...}/>

            );
        }
        if (routeID === 'LienWaiver') {
            var Lienwaiver = require('./components/Lienwaiver');

            return (
                <Lienwaiver
                    .../>
            );
        }
        if (routeID === 'WebView') {
            var WebView = require('./components/WebViewAndroid.js');

            return (
                <WebView
                    .../>
            );
        }
        if (routeID === 'OrderDetailsList') {
            var WorkOrder =

require('./components/WorkOrderDetailsList.js');

            return (
                <WorkOrder
                   ...  />
            );
        }
        if (routeID === 'Signature') {
            var SignatureView =

require('./components/SignatureView.js');

            return (
                <SignatureView
                   ...  />
            );
        }
        if (routeID === 'SignedWaiver') {
            var SignedWaiver = require('./components/SignedWaiver');

            return (
                <SignedWaiver
                   .../>
            )
        }
        if(routeID == 'SystemInfos'){
            var SystemInfos = require('./components/SystemInfos');

            return(
                <SystemInfos
                   ... />
            )
        } else {
            this.requestNewLocation();
        }
    },
    _change(route){
        var self = this;
        var location;
        this._onDrawerItemClick();
                    self.navig.push({id: route,
                        navigator:self.navig,

location:self.state.position.coords.lat+','+self.state.position.coords.lng,
email:self.state.email,
title:'System Info',
})
}
});

var NavigationBarRouteMapper = {
LeftButton: function (route, navigator, index, navState) {
this.navig = navigator;
if (route.id !== 'Login' && route.id !== 'WorkerJob') {
return (
<TouchableOpacity onPress={() => {

                    navigator.pop()
             }}>
                <Image
                    style={styles.backButton}

source={require('./config/constants/images').BACK_NAV_BUTTON}/>

)
}else {
return (
<TouchableOpacity onPress={() => {

                    onMenuClick()

                }}>
                <Image
                    style={styles.backButton}

source={require('./config/constants/images').HAMBURGER}/>

)
}
},
RightButton: function (route, navigator, index, navState) {

},
Title: function (route, navigator, index, navState) {
    return (
        <Text style={styles.navBarTitleText}>
            {route.title}
        </Text>
    );
},

};
var navMap = NavigationBarRouteMapper;
var styles = StyleSheet.create({
container: {
flex: 1,
textAlign: 'center'
},
signature_layout: {
width: 250,
height: 250,
backgroundColor: '#FFFFFF'
},
drawerMenu: {
flex: 1,
flexDirection: 'row',
},
navBar: {
backgroundColor: '#253039',
//height: 45
},
navBarTitleText: {
fontSize: 15,
color: '#ffffff',
fontWeight: '400',
//marginTop: 15,
marginTop: 12,
width: Dimensions.get('window').width - 150,
textAlign: 'center'
},
navBarLeftButton: {
paddingLeft: 10,
},
navBarRightButton: {
paddingRight: 10
},
navBarButtonText: {
color: cssVar('fbui-accent-blue')
},
arrow: {
marginLeft: 2,
marginTop: 18,
width: 20,
height: 20,
backgroundColor: 'transparent',
resizeMode: 'contain'

},
loading_container: {
    flex: 1,
    flexDirection: 'row',
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
    borderWidth: 1
},
logout: {
    color: cssVar('fbui-accent-blue'),
    fontSize: 20,
    marginTop: 12,
    textAlign: 'center'
},
backButton: {
    width: 20,
    height: 20,
    margin: 18
},
drawerIcon: {
    width: 20,
    height: 20,
    margin: 18,
},

});

AppRegistry.registerComponent('app_mobile', () => app_mobile);
}

On 18 January 2016 at 19:36, Howard Yang [email protected] wrote:

Can you show index.android.js to me? You can remove irrelevant codes.


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Hmmm... It seems it's not related.
Can you try generating signed release APK to test whether the issue happened?
https://facebook.github.io/react-native/docs/signed-apk-android.html

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

Yup I already did that yesterday. :'(

On 18 January 2016 at 20:02, Howard Yang [email protected] wrote:

Hmmm... It seems it's not related.
Can you try generating signed release APK to test whether the issue
happened?
https://facebook.github.io/react-native/docs/signed-apk-android.html


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Can you try again and get the logs?

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

Any idea how to fix this? com.android.ide.common.process.ProcessException:
org.gradle.process.internal.ExecException: Process 'command
'C:\Users\jojonarte\AppData\Local\Android\sdk\build-tools\23.0.2\aapt.exe''
finished with non-zero exit value 1

On 18 January 2016 at 20:19, Howard Yang [email protected] wrote:

Can you try again and get the logs?


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Please try cleaning the project

cd android
./gradlew clean

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

The error still persists :(

On 18 January 2016 at 22:21, Howard Yang [email protected] wrote:

Please try cleaning the project

cd android
./gradlew clean


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Have you tested the demo project? https://github.com/oney/TestGcm

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

The demo project doesn't crash as you are using a custom java wrapper which
is a service, and you handle all your notifications there. I think the
bridge on React native and android is killed when app is killed making the
issue. Is there a workaround on your javascript module??

On 19 January 2016 at 15:30, Howard Yang [email protected] wrote:

Have you tested the demo project? https://github.com/oney/TestGcm


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

In demo project, when the app is killed, we still handle notification in JS code.
Please see index.android.js of TestGcm
We handle notification when the app is killed in

if (GcmAndroid.launchNotification) {
  console.log('GcmAndroid.launchNotification:', GcmAndroid.launchNotification);
  var notification = GcmAndroid.launchNotification;
  var info = JSON.parse(notification.info);
  Notification.create({
    subject: info.subject,
    message: info.message,
  });
  GcmAndroid.stopService();
}

When it receives GCM notification and the app is killed, it will launch a service that creates a new React Native instance in the background.

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

Should I use System notification module as you did there?

On 19 January 2016 at 15:47, Howard Yang [email protected] wrote:

In demo project, when the app is killed, we still handle notification in
JS code.
Please see index.android.js of TestGcm
https://github.com/oney/TestGcm/blob/master/index.android.js
We handle notification when the app is killed in

if (GcmAndroid.launchNotification) {
console.log('GcmAndroid.launchNotification:', GcmAndroid.launchNotification);
var notification = GcmAndroid.launchNotification;
var info = JSON.parse(notification.info);
Notification.create({
subject: info.subject,
message: info.message,
});
GcmAndroid.stopService();
}

When it receives GCM notification and the app is killed, it will launch a
service
https://github.com/oney/react-native-gcm-android/blob/master/android/src/main/java/com/oney/gcm/BackgroundService.java
that creates a new React Native instance in the background.


Reply to this email directly or view it on GitHub
#26 (comment)
.

JOJO

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Yes, you should.

from react-native-gcm-android.

nbastoWM avatar nbastoWM commented on July 19, 2024

I'm also getting a crash if the app is closed.

E/ReactNativeJS(26189): undefined is not an object (evaluating 'i.SHORT')
I/ReactNativeJS(26209): 'GcmAndroid.launchNotification:', { info: '{"subject":"Hello...","message":"Hello from the server side!"}',
I/ReactNativeJS(26209):   collapse_key: 'do_not_collapse' }

However I'm getting another weird behaviour: I have installed the TestGcm app and my app with different tokens and Authorizations keys. However if both apps are closed and I send a notification to my app (my token and my authorization key) the crash occurs but when I click the notification your app is the one that opens. Actually, I didn't have the console log of GcmAndroid.launchNotification so it's the TestGcm app that receives the if (GcmAndroid.launchNotification) {.

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Can you use adb logcat to get logs when crashing?

from react-native-gcm-android.

nbastoWM avatar nbastoWM commented on July 19, 2024

I usally get logs with:

adb logcat *:S ReactNative:V ReactNativeJS:V

When I open the app:

I/ReactNativeJS( 8770): Running application "WMMyCityApp" with appParams: {"initialProps":{},"rootTag":1}. __DEV__ === false, development-level warning are OFF, performance optimizations are ON
I/ReactNativeJS( 8770): 'send gcm token to server', 'cH49NsZuMvM:APA91bEtw1JIOF-c_r7DjHuEO496HulXGCLnt3s3ysiXBuTuJDZgPV_A3wHNqxkQ2LkirbR-0WzxIyh__5GNI5tXr394nnMTcingSn7GnVqSv5QpuYnkkEVHjIi2DwwbCDs-BFZEle6k'

When I receive a notification with all apps closed:

E/ReactNativeJS( 8850): undefined is not an object (evaluating 'i.SHORT')
I/ReactNativeJS( 8870): 'GcmAndroid.launchNotification:', { info: '{"subject":"Hello GCM2","message":"Hello from the server side!"}',
I/ReactNativeJS( 8870):   collapse_key: 'do_not_collapse' }

NOTE: That console log is from TestGcm but the token sent was for my App.

Now I tried to generate a signed APK but I got this error.

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:processReleaseResources'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:42)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.api.internal.AbstractTask.executeWithoutThrowingTaskFailure(AbstractTask.java:310)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.executeTask(AbstractTaskPlanExecutor.java:79)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:63)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:51)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:23)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:88)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
    at org.gradle.execution.DefaultBuildExecuter.access$200(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$2.proceed(DefaultBuildExecuter.java:68)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:62)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:55)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:149)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:106)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:86)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:90)
    at org.gradle.tooling.internal.provider.ExecuteBuildActionRunner.run(ExecuteBuildActionRunner.java:28)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:41)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:50)
    at org.gradle.launcher.exec.DaemonUsageSuggestingBuildActionExecuter.execute(DaemonUsageSuggestingBuildActionExecuter.java:27)
    at org.gradle.launcher.cli.RunBuildAction.run(RunBuildAction.java:40)
    at org.gradle.internal.Actions$RunnableActionAdapter.execute(Actions.java:169)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:237)
    at org.gradle.launcher.cli.CommandLineActionFactory$ParseAndBuildAction.execute(CommandLineActionFactory.java:210)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:35)
    at org.gradle.launcher.cli.JavaRuntimeValidationAction.execute(JavaRuntimeValidationAction.java:24)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:206)
    at org.gradle.launcher.cli.CommandLineActionFactory$WithLogging.execute(CommandLineActionFactory.java:169)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:33)
    at org.gradle.launcher.cli.ExceptionReportingAction.execute(ExceptionReportingAction.java:22)
    at org.gradle.launcher.Main.doAction(Main.java:33)
    at org.gradle.launcher.bootstrap.EntryPoint.run(EntryPoint.java:45)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:54)
    at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
    at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    at org.gradle.wrapper.BootstrapMainStarter.start(BootstrapMainStarter.java:30)
    at org.gradle.wrapper.WrapperExecutor.execute(WrapperExecutor.java:127)
    at org.gradle.wrapper.GradleWrapperMain.main(GradleWrapperMain.java:61)
Caused by: java.lang.RuntimeException: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
    at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:147)
    at com.android.build.gradle.internal.tasks.IncrementalTask.taskAction(IncrementalTask.java:98)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:243)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:219)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:230)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:208)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 49 more
Caused by: com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
    at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:42)
    at com.android.builder.core.AndroidBuilder.processResources(AndroidBuilder.java:919)
    at com.android.build.gradle.tasks.ProcessAndroidResources.doFullTaskAction(ProcessAndroidResources.java:138)
    ... 57 more
Caused by: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1
    at org.gradle.process.internal.DefaultExecHandle$ExecResultImpl.assertNormalExitValue(DefaultExecHandle.java:365)
    at com.android.build.gradle.internal.process.GradleProcessResult.assertNormalExitValue(GradleProcessResult.java:40)
    ... 59 more


BUILD FAILED

The react-native run-android goes OK but generating the APK gives this error.
Without this modules I can generate the signed APK just fine.

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Please use adb logcat to get the logs about Java, not just javascript.

from react-native-gcm-android.

nbastoWM avatar nbastoWM commented on July 19, 2024

Sorry for the long comment:

I did adb reverse ... as I saw in the complete logs but it always crash if no app is opened.

I/InputDispatcher( 2765): Delivering touch to (3356): action: 0x1, toolType: 1
I/InputDispatcher( 2765): Delivering touch to (3275): action: 0x1, toolType: 1
D/com.facebook.a.a( 4432): Got unexpected exception: java.io.WriteAbortedException: Read an exception; java.io.NotSerializableException: org.json.JSONObject
W/Settings( 4500): Setting android_id has moved from android.provider.Settings.System to android.provider.Settings.Secure, returning read-only value.
D/SSRM:n  ( 2765): SIOP:: AP = 320, CUR = 450, LCD = 200
D/SensorService( 2765): [SO] -0.125 0.212 9.741
V/AlarmManager( 2765): waitForAlarm result :4
I/GCM     ( 4002): GCM message com.wmmycityapp 0:1453474092530395%41b09ea7f9fd7ecd
V/BroadcastQueue( 2765): [background] Process cur broadcast BroadcastRecord{1164de0d u0 com.google.android.c2dm.intent.RECEIVE} DELIVERED for app ProcessRecord{389d13e0 8850:com.wmmycityapp/u0a515}
D/ActivityManager( 2765): caller:android.app.ApplicationThreadProxy@2ea8b1c2, r.packageName :com.wmmycityapp
D/RNGcmListenerService( 8850): sendNotification
V/BroadcastQueue( 2765): [background] Process cur broadcast BroadcastRecord{32bfb310 u0 com.oney.gcm.GCMReceiveNotification} DELIVERED for app ProcessRecord{188f5355 8870:com.testgcm/u0a511}
D/ActivityManager( 2765): startService callerProcessName:com.testgcm, calleePkgName: com.testgcm
D/ActivityManager( 2765): caller:android.app.ApplicationThreadProxy@128e4e09, r.packageName :com.testgcm
D/BackgroundService( 8870): onStartCommand
I/Sensors ( 2765): HAL:flush - mFlushSensorEnabledVector=2 res=0
V/BroadcastQueue( 2765): [background] Process cur broadcast BroadcastRecord{32bfb310 u0 com.oney.gcm.GCMReceiveNotification} DELIVERED for app ProcessRecord{389d13e0 8850:com.wmmycityapp/u0a515}
I/Sensors ( 2765): HAL:readEvents - Stored flush complete event for sensor=2, fl_cnt=0
D/SensorManager( 8870): registerListener :: 2, MPL Accelerometer, 66667, 0,
D/ActivityManager( 2765): startService callerProcessName:com.wmmycityapp, calleePkgName: com.wmmycityapp
D/ActivityManager( 2765): caller:android.app.ApplicationThreadProxy@3edd822f, r.packageName :com.wmmycityapp
D/BackgroundService( 8850): onStartCommand
I/Sensors ( 2765): HAL:flush - mFlushSensorEnabledVector=2 res=0
D/SensorManager( 8850): registerListener :: 2, MPL Accelerometer, 66667, 0,
W/unknown:React( 8850): You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
W/unknown:React( 8850): You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
I/Sensors ( 2765): HAL:readEvents - Sent flush complete events 1 times
I/Sensors ( 2765): HAL:readEvents - Stored flush complete event for sensor=2, fl_cnt=0
I/Sensors ( 2765): HAL:readEvents - Sent flush complete events 1 times
D/StatusBar.NetworkController( 3003): refreshViews connected={ wifi } level=2 combinedSignalIconId=0x7f0206ac/com.android.systemui:drawable/stat_sys_wifi_signal_4 mobileLabel=NOS wifiLabel="MATRIX" emergencyOnly=false combinedLabel="MATRIX" mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId=0x7f0205d9/com.android.systemui:drawable/stat_sys_signal_2_auto_rotate mQSPhoneSignalIconId=0x7f0201ae/com.android.systemui:drawable/ic_qs_signal_2 mDataDirectionIconId=0x0/(null) mDataSignalIconId=0x7f0205d9/com.android.systemui:drawable/stat_sys_signal_2_auto_rotate mDataTypeIconId=0x7f020488/com.android.systemui:drawable/stat_sys_data_connected_h mQSDataTypeIconId=0x7f0201bb/com.android.systemui:drawable/ic_qs_signal_h mNoSimIconId=0x0/(null) mWifiIconId=0x7f0206ac/com.android.systemui:drawable/stat_sys_wifi_signal_4 mQSWifiIconId=0x7f020370/com.android.systemui:drawable/qs_tile_wifi_signal_4 mWifiActivityIconId=0x7f020660/com.android.systemui:drawable/stat_sys_signal_inout mBluetoothTetherIconId=0x7f020689/com.android.systemui:drawable/stat_sys_tether_bluetooth
D/StatusBar.NetworkController( 3003): refreshNwBoosterIndicator - setNWBoosterIndicators(false)
D/StatusBar.NetworkController( 3003): refreshNwBoosterIndicator - setNWBoosterIndicators(false)
D/StatusBar.NetworkController( 3003): refreshNwBoosterIndicator - setNWBoosterIndicators(false)
D/StatusBar.NetworkController( 3003): refreshNwBoosterIndicator - setNWBoosterIndicators(false)
I/ReactNativeJS( 8870): 'GcmAndroid.launchNotification:', { info: '{"subject":"Hello GCM2","message":"Hello from the server side!"}',
I/ReactNativeJS( 8870):   collapse_key: 'do_not_collapse' }
D/ApplicationPolicy( 2765): isStatusBarNotificationAllowedAsUser: packageName = com.testgcm,userId = 0
I/ReactSystemNotification( 8870): Notification Show: 5309
I/ReactSystemNotification( 8870): Notification Created: 5309
D/WindowManager( 2765): showStatusBarByNotification() mOpenByNotification=false
D/AudioService( 2765): getStreamVolume 5 index 30
D/MotionRecognitionService( 2765):  open api 0
E/MotionRecognitionService( 2765): enable_sensor
D/MotionRecognitionService( 2765):   .registerCallback : 1, motion_sensors=3, client=
D/MotionEngine( 2765): [MotionEngine]->Build Binary Type(user):0
D/MotionRecognitionService( 2765):   .isMotionEngineEnabled : true
D/MotionEngine( 2765): [@@@ Motion Engine @@@] InitializeMotionManager ALL, DPS setting 1
D/MotionRecognitionService( 2765):   .initializeMotionEngine
D/MREngine( 2765): [@@@@@SR Motion Engine @@@] CRM Initialize!!!!!
V/MotionRecognitionService( 2765):  .updateOrientation : 28
D/MotionEngine( 2765): [@@@SR Motion Engine @@@] init
D/MotionRecognitionService( 2765): Acquire sensors : Settings = 1100101000000000000101
D/SensorService( 2765): [SO] changed settle time [1]
D/MotionRecognitionService( 2765): Acquired sensors for motion : 11
D/SensorService( 2765): [SO] setDelay [66000000]
D/SensorService( 2765): [SO] activate (ident=0x85608100, enabled=1)
D/SensorManager( 2765): registerListener :: 1600221811, Screen Orientation Sensor, 66667, 0,
E/MotionRecognitionService( 2765): setMotionCMD 300
I/Sensors ( 2765): HAL:batch called - handle=2, flags=0, period=5000000, timeout=0
I/Sensors ( 2765): HAL:resetDataRates mEnabled=4
I/Sensors ( 2765): CompassSensor::setDelay, delay=10000000
V/MediaPlayer-JNI( 3003): native_setup
V/MediaPlayer( 3003): constructor
D/AkmSensor( 2765): Magnetic_Set_Delay , delay = 20000000
V/MediaPlayer( 3003): setListener
V/MediaPlayer-JNI( 3003): setParameter: key 1400
V/MediaPlayer( 3003): MediaPlayer::setParameter(1400)
V/MediaPlayer-JNI( 3003): setAudioStreamType: 5
V/MediaPlayer( 3003): MediaPlayer::setAudioStreamType
D/RingtoneManager( 3003): getActualDefaultRingtoneUri  type    :2
I/Sensors ( 2765): MPLSensor::resetDataRates, gyro_delay=5000000, accel_delay=5000000, mag_delay=20000000 orient_delay=5000000 grv_delay=5000000
D/RingtoneManager( 3003): checkDefaultRingtoneProperUri : path and URI match to each other
D/RingtoneManager( 3003): setCacheUri uri:content://media/external/audio/media/19806, external path:/storage/extSdCard, path:/storage/emulated/0/zedge/notification_sound/BBM_Tone-notification_sound-1715642.mp3
I/Sensors ( 2765): HAL:flush - mFlushSensorEnabledVector=2 res=0
I/Sensors ( 2765): HAL:batch called - handle=2, flags=0, period=20000000, timeout=0
D/SensorService( 2765): [SO] Reset Rotation Old [100], Init [1]
I/Sensors ( 2765): HAL:readEvents - Stored flush complete event for sensor=2, fl_cnt=0
I/Sensors ( 2765): HAL:resetDataRates mEnabled=4
I/Sensors ( 2765): CompassSensor::setDelay, delay=20000000
D/AkmSensor( 2765): Magnetic_Set_Delay , delay = 20000000
I/Sensors ( 2765): MPLSensor::resetDataRates, gyro_delay=20000000, accel_delay=20000000, mag_delay=20000000 orient_delay=20000000 grv_delay=20000000
E/ReactNativeJS( 8850): undefined is not an object (evaluating 'RCTToastAndroid.SHORT')
V/MediaPlayer-JNI( 3003): setDataSourceFD: fd 66
V/MediaPlayer( 3003): setDataSource(66, 0, 576460752303423487)
V/MediaPlayerService( 2171): Create new client(35) from pid 3003, uid 10023,
V/MediaPlayerService( 2171): setDataSource fd=35, offset=0, length=576460752303423487
V/MediaPlayerService( 2171): st_dev  = 66317
V/MediaPlayerService( 2171): st_ino  = 267427
V/MediaPlayerService( 2171): st_mode = 33204
V/MediaPlayerService( 2171): st_uid  = 1023
V/MediaPlayerService( 2171): st_gid  = 1023
V/MediaPlayerService( 2171): st_size = 30963
V/MediaPlayerService( 2171): calculated length = 30963

from react-native-gcm-android.

nbastoWM avatar nbastoWM commented on July 19, 2024

OK, new test. I uninstalled the TestGCM app and now my app doesn't catch the if (GcmAndroid.launchNotification) { event if the app is closed.
I keep getting the undefined is not an object (evaluating 'RCTToastAndroid.SHORT') but now the console.log GcmAndroid.launchNotification: doesn't show.

I would like to test with the signed APK to exclude problems with connections to the packager, but as mentioned before I can't generate it with this module installed.

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Edit:
You are using React Native 0.17, right?
Please give me some code snippets of index.android.js in your app. Uninstall TestGCM to test your app only, so we can solve problem more easily.

from react-native-gcm-android.

nbastoWM avatar nbastoWM commented on July 19, 2024

I'm on RN 0.17.

index.android.js:

'use strict';

var React = require('react-native');
var WMWrapperAndroid = require('./components/WMWrapperAndroid');
var WMMenu = require('./components/WMMenu');
. . .

var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  DrawerLayoutAndroid,
  ToolbarAndroid,
  ScrollView,
  Navigator,
  BackAndroid,
  DeviceEventEmitter,

} = React;

var GcmAndroid = require('react-native-gcm-android');
import Notification from 'react-native-system-notification';

var _navigator;
BackAndroid.addEventListener('hardwareBackPress', function() {
    if (_navigator && _navigator.getCurrentRoutes().length > 1) {
        _navigator.pop();
        return true;
    }
    return false;
});

if (GcmAndroid.launchNotification) {
  console.log('WM GcmAndroid.launchNotification:', GcmAndroid.launchNotification);

  var notification = GcmAndroid.launchNotification;
  var info = JSON.parse(notification.info);
  Notification.create({
    subject: info.subject,
    message: info.message,
  });
  GcmAndroid.stopService();
} else {

class WMMyCityApp extends React.Component{
  constructor(props) {
    super(props);
    this.state = {
      user:null,
    }
    this._loadUser();
  }

  componentDidMount(){

    GcmAndroid.addEventListener('register', function(token){
       console.log('send gcm token to server', token);
     });
     GcmAndroid.addEventListener('notification', function(notification){
       console.log('WM receive gcm notification', notification);
       var info = JSON.parse(notification.data.info);
       if (!GcmAndroid.isInForeground) {
         Notification.create({
           subject: info.subject,
           message: info.message,
         });
       }
     });

     DeviceEventEmitter.addListener('sysNotificationClick', function(e) {
       console.log('sysNotificationClick', e);
     });

     GcmAndroid.requestPermissions();

  }

  async _loadUser(){
     . . .
  }

  _setUser(user){
    this.setState({
      user,
    });
  }

  _clearUser(){
    console.log("clear user");
    this.setState({
      user:null,
    });
  }

  openDrawer() {
    this.refs['DRAWER'].openDrawer()
  }

  render() {

    return (
      <Navigator
         initialRoute={{screenType: 'start', title: 'Home'}}
         renderScene={this._renderScene.bind(this)}
         configureScene={(route) => {
           if (route.sceneConfig) {
             return route.sceneConfig;
           }
           return Navigator.SceneConfigs.FadeAndroid;
         }} />
    );
  }

  onActionSelected(position) {
    if (position === 0) { // index of 'Settings'
      showSettings();
    }
  }

  _renderScene(route, navigator) {

    . . .

    }
    return (
      <WMWrapperAndroid {...route} user={this.state.user}>
      {Content}
      </WMWrapperAndroid>
    );

  }
}

var styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('WMMyCityApp', () => WMMyCityApp);


} // end else

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

Please try change to the following codes in android/app/src/main/AndroidManifest.xml

  <receiver
    android:exported="false"
    android:name="com.oney.gcm.GcmBroadcastReceiver">
    <intent-filter>
      <action android:name="com.oney.gcm.GCMReceiveNotification" />
      </intent-filter>
  </receiver>

from react-native-gcm-android.

nbastoWM avatar nbastoWM commented on July 19, 2024

No success. :( Exactly the same error.

I/InputDispatcher( 2765): Delivering touch to (3356): action: 0x1, toolType: 1
I/InputDispatcher( 2765): Delivering touch to (3275): action: 0x1, toolType: 1
I/GCM     ( 4002): GCM message com.wmmycityapp 0:1453485151851316%41b09ea7f9fd7ecd
V/BroadcastQueue( 2765): [background] Process cur broadcast BroadcastRecord{37e12903 u0 com.google.android.c2dm.intent.RECEIVE} DELIVERED for app ProcessRecord{27d91a12 30259:com.wmmycityapp/u0a515}
D/ActivityManager( 2765): caller:android.app.ApplicationThreadProxy@20af9080, r.packageName :com.wmmycityapp
D/RNGcmListenerService(30259): sendNotification
V/BroadcastQueue( 2765): [background] Process cur broadcast BroadcastRecord{9cb5afe u0 com.oney.gcm.GCMReceiveNotification} DELIVERED for app ProcessRecord{27d91a12 30259:com.wmmycityapp/u0a515}
D/ActivityManager( 2765): startService callerProcessName:com.wmmycityapp, calleePkgName: com.wmmycityapp
D/ActivityManager( 2765): caller:android.app.ApplicationThreadProxy@3fc3525f, r.packageName :com.wmmycityapp
D/BackgroundService(30259): onStartCommand
I/Sensors ( 2765): HAL:flush - mFlushSensorEnabledVector=2 res=0
I/Sensors ( 2765): HAL:readEvents - Stored flush complete event for sensor=2, fl_cnt=0
D/SensorManager(30259): registerListener :: 2, MPL Accelerometer, 66667, 0,
W/unknown:React(30259): You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
W/unknown:React(30259): You seem to be running on device. Run 'adb reverse tcp:8081 tcp:8081' to forward the debug server's port to the device.
I/Sensors ( 2765): HAL:readEvents - Sent flush complete events 1 times
D/StatusBar.NetworkController( 3003): refreshViews connected={ wifi } level=2 combinedSignalIconId=0x7f0206ac/com.android.systemui:drawable/stat_sys_wifi_signal_4 mobileLabel=NOS wifiLabel="MATRIX" emergencyOnly=false combinedLabel="MATRIX" mAirplaneMode=false mDataActivity=0 mPhoneSignalIconId=0x7f0205d9/com.android.systemui:drawable/stat_sys_signal_2_auto_rotate mQSPhoneSignalIconId=0x7f0201ae/com.android.systemui:drawable/ic_qs_signal_2 mDataDirectionIconId=0x0/(null) mDataSignalIconId=0x7f0205d9/com.android.systemui:drawable/stat_sys_signal_2_auto_rotate mDataTypeIconId=0x7f020488/com.android.systemui:drawable/stat_sys_data_connected_h mQSDataTypeIconId=0x7f0201bb/com.android.systemui:drawable/ic_qs_signal_h mNoSimIconId=0x0/(null) mWifiIconId=0x7f0206ac/com.android.systemui:drawable/stat_sys_wifi_signal_4 mQSWifiIconId=0x7f020370/com.android.systemui:drawable/qs_tile_wifi_signal_4 mWifiActivityIconId=0x7f020660/com.android.systemui:drawable/stat_sys_signal_inout mBluetoothTetherIconId=0x7f020689/com.android.systemui:drawable/stat_sys_tether_bluetooth
D/StatusBar.NetworkController( 3003): refreshNwBoosterIndicator - setNWBoosterIndicators(false)
D/StatusBar.NetworkController( 3003): refreshNwBoosterIndicator - setNWBoosterIndicators(false)
D/StatusBar.NetworkController( 3003): refreshNwBoosterIndicator - setNWBoosterIndicators(false)
D/StatusBar.NetworkController( 3003): refreshNwBoosterIndicator - setNWBoosterIndicators(false)
D/SensorService( 2765): cleanupWithoutDisableLocked - size : 6, ref : 3
I/Sensors ( 2765): HAL:batch called - handle=2, flags=0, period=66000000, timeout=0
I/Sensors ( 2765): HAL:resetDataRates mEnabled=4
I/Sensors ( 2765): CompassSensor::setDelay, delay=65000000
D/AkmSensor( 2765): Magnetic_Set_Delay , delay = 65000000
I/Sensors ( 2765): MPLSensor::resetDataRates, gyro_delay=65000000, accel_delay=65000000, mag_delay=65000000 orient_delay=66666666 grv_delay=66666666
E/Sensors ( 4002): ~SensorEventQueue 0
E/        ( 4002): BitTube(): close receivedFd (162)
D/SensorManager( 4002): unregisterListener ::
D/SensorService( 2765): cleanupConnection - size : 6, ref : 0
E/        ( 2765): BitTube(): close sendFd (426)
I/GCoreUlr( 4002): Starting service, intent=Intent { act=com.google.android.location.reporting.ACTION_UPDATE_ACTIVE_STATE cmp=com.google.android.gms/com.google.android.location.reporting.service.DispatchingService (has extras) }, extras=Bundle[{source=PowerModeReceiver}]
D/ActivityManager( 2765): startService callerProcessName:com.google.android.gms, calleePkgName: com.google.android.gms
D/ActivityManager( 2765): caller:android.app.ApplicationThreadProxy@23ddcbd6, r.packageName :com.google.android.gms
D/ActivityManager( 2765): caller:null, r.packageName :com.google.android.gms
D/ActivityManager( 2765): caller:null, r.packageName :com.google.android.gms
D/ActivityManager( 2765): caller:null, r.packageName :com.google.android.gms
D/ActivityManager( 2765): caller:null, r.packageName :com.google.android.gms
V/BroadcastQueue( 2765): [background] Process cur broadcast BroadcastRecord{1fdf6d44 u0 com.google.android.apps.gsa.search.core.location.ACTIVITY_DETECTION} DELIVERED for app ProcessRecord{3e43a62b 32083:com.google.android.googlequicksearchbox:search/u0a66}
I/Sensors ( 2765): HAL:batch called - handle=11, flags=0, period=5000000, timeout=0
I/Sensors ( 2765): HAL:resetDataRates mEnabled=4
I/Sensors ( 2765): CompassSensor::setDelay, delay=65000000
D/AkmSensor( 2765): Magnetic_Set_Delay , delay = 65000000
I/Sensors ( 2765): MPLSensor::resetDataRates, gyro_delay=65000000, accel_delay=65000000, mag_delay=65000000 orient_delay=66666666 grv_delay=66666666
I/Sensors ( 2765): HAL:enable handle=11, en=1
I/Sensors ( 2765): HAL:resetDataRates mEnabled=4
I/Sensors ( 2765): CompassSensor::setDelay, delay=65000000
D/AkmSensor( 2765): Magnetic_Set_Delay , delay = 65000000
I/Sensors ( 2765): MPLSensor::resetDataRates, gyro_delay=65000000, accel_delay=65000000, mag_delay=65000000 orient_delay=66666666 grv_delay=66666666
D/SensorManager( 4002): requestTrigger :: 11, MPL Significant Motion,
I/WebViewFactory(30259): Loading com.google.android.webview version 47.0.2526.100 (code 252610000)
I/GCoreUlr( 4002): DispatchingService.updateActiveState+PowerModeReceiver: Ensuring that reporting is active for [account#10#]
I/cr_LibraryLoader(30259): Time to load native libraries: 2 ms (timestamps 815-817)
I/cr_LibraryLoader(30259): Expected native library version number "47.0.2526.100", actual native library version number "47.0.2526.100"
D/ActivityManager( 2765): caller:android.app.ApplicationThreadProxy@2c046e2d, r.packageName :com.google.android.gms
I/GCoreUlr( 4002): GMS FLP location and AR updates requested: {"description":"stationary","newRequest":true,"samplePeriodMs":2160000,"sampleReason":"stationary","sampleSource":"internal","timestampMs":1453485152858}
D/ActivityManager( 2765): caller:null, r.packageName :com.google.android.gms
E/ReactNativeJS(30259): undefined is not an object (evaluating 'RCTToastAndroid.SHORT')
D/ActivityManager( 2765): caller:android.app.ApplicationThreadProxy@3b42cf62, r.packageName :com.google.android.gms
I/GCoreUlr( 4002): GMS BLE scans enabled.
I/GCoreUlr( 4002): Place inference reporting - stopped
D/PhoneWindow(30259): *FMB* installDecor mIsFloating : false
D/PhoneWindow(30259): *FMB* installDecor flags : -2139029248
D/AbsListView(30259): Get MotionRecognitionManager

from react-native-gcm-android.

oney avatar oney commented on July 19, 2024

I have tried recreating a new RN project and failed to reproduce your issue. But, there is really a issue that you mentioned.

However I'm getting another weird behaviour: I have installed the TestGcm app and my app with different tokens and Authorizations keys. However if both apps are closed and I send a notification to my app (my token and my authorization key) the crash occurs but when I click the notification your app is the one that opens. Actually, I didn't have the console log of GcmAndroid.launchNotification so it's the TestGcm app that receives the if (GcmAndroid.launchNotification) {.

The solution is adding android:exported="false" to com.oney.gcm.GcmBroadcastReceiver in TestGcm and your project. I already corrected it in README.

  <receiver
    android:exported="false"
    android:name="com.oney.gcm.GcmBroadcastReceiver">
    <intent-filter>
      <action android:name="com.oney.gcm.GCMReceiveNotification" />
      </intent-filter>
  </receiver>

I also publish new version 0.2.0. In this version, I print many logs to make debugging more easily. Please try new version module. Make sure to re-read README and delete TestGcm. Then, give me some logs when the crash happens.

from react-native-gcm-android.

nbastoWM avatar nbastoWM commented on July 19, 2024

I uninstalled your module and reinstalled but there was an warning:

[email protected] /Users/wiremaze/wm/dev/teste2
├── [email protected]
└── UNMET PEER DEPENDENCY react-native-system-notification@^0.1.2

npm WARN EPEERINVALID [email protected] requires a peer of react-native-system-notification@^0.1.2 but none was installed.

I then installed manually system-notification:

[email protected] /Users/wiremaze/wm/dev/teste2
├── UNMET PEER DEPENDENCY [email protected]
└── [email protected]

npm WARN EPEERINVALID [email protected] requires a peer of react-native-gcm-android@^0.1.8 but none was installed.

Anyway, with this new version I keep getting the Execution failed for task ':app:transformClassesWithDexForDebug'. error. I had to change to:

compile "com.google.android.gms:play-services-gcm:8.3.0"

and

classpath 'com.google.gms:google-services:1.5.0-beta3'

But with tha app closed, I keep getting:

I/GCM     ( 8151): GCM message com.wmmycityapp 0:1453715024152854%41b09ea7f9fd7ecd
E/ReactNativeJS(25067): undefined is not an object (evaluating 'i.SHORT')

I also can't still generate a signed APK:

Execution failed for task ':app:processReleaseResources'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/local/opt/android-sdk/build-tools/23.0.1/aapt'' finished with non-zero exit value 1

I don't know, maybe another module is conflicting:

  "dependencies": {
    "autobind-decorator": "^1.3.2",
    "react-native": "^0.17.0",
    "react-native-action-button": "^1.1.1",
    "react-native-checkbox": "^1.0.8",
    "react-native-contacts": "^0.2.0",
    "react-native-date": "^1.0.2",
    "react-native-gcm-android": "^0.2.0",
    "react-native-google-analytics": "^1.0.1",
    "react-native-google-analytics-bridge": "^0.2.0",
    "react-native-icons": "^0.7.0",
    "react-native-image-picker": "^0.13.0",
    "react-native-mapbox-gl": "^3.0.0",
    "react-native-system-notification": "^0.1.6",
    "react-native-tabbar": "^0.2.1",
    "react-timer-mixin": "^0.13.3"
  }

from react-native-gcm-android.

paulbao avatar paulbao commented on July 19, 2024

This issue is tricky. Unfortunately, I met it also and have no idea how to fix it.
Check BackgroundService.java first.
The reason is that you have to add packages that you've add in your MainActivity.jave.

from react-native-gcm-android.

notlose avatar notlose commented on July 19, 2024

for my case
the app crash while it run
var info = JSON.parse(notification.info);
JSON Paese error: Unexpected identifier "undefined"

any idea to fix?

from react-native-gcm-android.

dcflow avatar dcflow commented on July 19, 2024

@oney
This one console.log('GcmAndroid.launchNotification internal', GcmAndroid.launchNotification); from your index.js gets called and GcmAndroid.launchNotification is undefined.
Also this logs out com.oney.gcm.GcmModule: mIntent is null: false.
In your index.js there is a GcmModule.launchNotification and GcmAndroid.launchNotification. Maybe there is a mismatch somewhere.

from react-native-gcm-android.

udfalkso avatar udfalkso commented on July 19, 2024

I just wrote about a possible workaround for this issue here: #51 (comment)

from react-native-gcm-android.

savioseb avatar savioseb commented on July 19, 2024

Comment the
GcmAndroid.stopService();

line.

It should work.

My index.android.js snippet:

`
if (GcmAndroid.launchNotification) {
console.log('Before entering function:', GcmAndroid.launchNotification);
//GcmAndroid.stopService();
console.log('GcmAndroid.launchNotification:', GcmAndroid.launchNotification);
var notification = GcmAndroid.launchNotification;
var info = JSON.parse(notification.info);
Notification.create({
subject: info.subject,
message: info.message,
});

//GcmAndroid.stopService();
} else {
class Savio extends Component {

from react-native-gcm-android.

edo1493 avatar edo1493 commented on July 19, 2024

I am getting the same:
"undefined is not an object (evaluating 'RCTToastAndroid.SHORT')".

I tried @savioseb suggestion but it didn't work out.

06-04 20:46:01.771 1603 2138 I GCM : GCM message com.canddi 0:1465069585784159%2ccbd326f9fd7ecd 06-04 20:46:01.783 2878 2897 D RNGcmListenerService: sendNotification 06-04 20:46:01.789 2878 2878 E FirebaseInstanceId: Failed to resolve target intent service, skipping classname enforcement 06-04 20:46:01.789 1283 1739 W ActivityManager: Unable to start service Intent { act=com.google.firebase.MESSAGING_EVENT pkg=com.canddi (has extras) } U=0: not found 06-04 20:46:01.789 2878 2878 E FirebaseInstanceId: Error while delivering the message: ServiceIntent not found. 06-04 20:46:01.792 2878 2878 D com.oney.gcm.GcmModule: onReceive 06-04 20:46:01.793 2878 2878 D BackgroundService: onStartCommand 06-04 20:46:01.799 2878 2895 D com.oney.gcm.GcmModule: mIntent is null: false 06-04 20:46:01.805 2878 2994 D com.oney.gcm.GcmModule: bundleString: {"url":"www.amazon.com","message":"Check out these awesome deals!","collapse_key":"do_not_collapse"} 06-04 20:46:02.049 2878 2994 E ReactNativeJS: undefined is not an object (evaluating 'RCTToastAndroid.SHORT')

Is this relevant "Failed to resolve target intent service, skipping classname enforcement" ?

from react-native-gcm-android.

jojonarte avatar jojonarte commented on July 19, 2024

this is a tricky issue, what I did was to create my own GCMListener service.

from react-native-gcm-android.

edo1493 avatar edo1493 commented on July 19, 2024

@jojonarte yes, but I don't understand why it works for other people? We all seem to have an error on ToastAndroid?

from react-native-gcm-android.

savioseb avatar savioseb commented on July 19, 2024

@edo1493 I'm not sure but I think the issue is because you aren't sending the message correctly...

The JSON should have a "subject" and "message", at least that's what in my Intent

My JSON that I curl on GCM Server:


{
  "data": {
    "info": {
      "subject": "I really hope this works",
      "message": "Please work"
    }
  },
  "to" : "gcmToken"
}

from react-native-gcm-android.

Related Issues (20)

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.