How to use appcenter-push - 10 common examples

To help you get started, we’ve selected a few appcenter-push examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github syun0216 / goforeat / index.js View on Github external
import { AppRegistry,AppState,Alert } from 'react-native';
import App from './App';
import Push from 'appcenter-push';


AppRegistry.registerComponent('goforeat_app', () => App);

Push.setListener({
	onPushNotificationReceived: pushNotification => {
    console.log(112312321321312321);
		let message = pushNotification.message;
		let title = pushNotification.title;
		let customProperties = [];
		let timestamp = Date.now();

		// Custom name/value pairs set in the App Center web portal are in customProperties
		if (
			pushNotification.customProperties &&
			Object.keys(pushNotification.customProperties).length > 0
		) {
			customProperties = pushNotification.customProperties;
		}

		Alert.alert(title, message);
github microsoft / appcenter-sdk-react-native / TestApp34 / MainScreen.js View on Github external
return (
      
    );
  }
}

Push.setListener({
  onPushNotificationReceived(pushNotification) {
    let message = pushNotification.message;
    let title = pushNotification.title;

    if (message === null || message === undefined) {
      // Android messages received in the background don't include a message. On Android, that fact can be used to
      // check if the message was received in the background or foreground. For iOS the message is always present.
      title = 'Android background';
      message = '';
    }

    // Any custom name/value pairs added in the portal are in customProperties
    if (pushNotification.customProperties && Object.keys(pushNotification.customProperties).length > 0) {
      message += `\nCustom properties:\n${JSON.stringify(pushNotification.customProperties)}`;
    }
github microsoft / appcenter-sdk-react-native / TestApp / app / App.js View on Github external
AppCenter: AppCenterScreen,
    Analytics: AnalyticsScreen,
    Transmission: TransmissionScreen,
    Crashes: CrashesScreen
  },
  {
    tabBarOptions: {
      activeBackgroundColor: 'white',
      inactiveBackgroundColor: 'white',
    },
  }
);

export default createAppContainer(TabNavigator);

Push.setListener({
  onPushNotificationReceived(pushNotification) {
    let message = pushNotification.message;
    const title = pushNotification.title;

    // Message can be null on iOS silent push or Android background notifications.
    if (message === null) {
      message = '';
    } else {
      message += '\n';
    }

    // Any custom name/value pairs added in the portal are in customProperties
    if (pushNotification.customProperties && Object.keys(pushNotification.customProperties).length > 0) {
      message += `Custom properties:\n${JSON.stringify(pushNotification.customProperties)}`;
    }
github microsoft / appcenter-sdk-react-native / DemoApp / app / App.js View on Github external
Analytics: AnalyticsScreen,
    Transmission: TransmissionScreen,
    Crashes: CrashesScreen,
    Data: DataScreen
  },
  {
    tabBarOptions: {
      activeBackgroundColor: 'white',
      inactiveBackgroundColor: 'white',
    },
  }
);

export default createAppContainer(TabNavigator);

Push.setListener({
  onPushNotificationReceived(pushNotification) {
    let message = pushNotification.message;
    const title = pushNotification.title;

    // Message can be null on iOS silent push or Android background notifications.
    if (message === null) {
      message = '';
    } else {
      message += '\n';
    }

    // Any custom name/value pairs added in the portal are in customProperties
    if (pushNotification.customProperties && Object.keys(pushNotification.customProperties).length > 0) {
      message += `Custom properties:\n${JSON.stringify(pushNotification.customProperties)}`;
    }
github microsoft / appcenter-sdk-react-native / TestAppTypescript / src / MainScreen.tsx View on Github external
<button title="Test Crashes"> navigate("Crashes")} /&gt;
        </button><button title="Test Analytics"> navigate("Analytics")} /&gt;
        </button><button title="Test Push"> navigate("Push")} /&gt;
        </button><button title="Test Other AppCenter APIs"> navigate("AppCenter")}
        /&gt;
      
    );
  }
}

Push.setListener({
  onPushNotificationReceived(pushNotification) {
    let message = pushNotification.message;
    let title = pushNotification.title;
    if (title === null) {
      title = "";
    }

    if (message === null) {
      message = "";
    } else {
      message += "\n";
    }

    // Any custom name/value pairs added in the portal are in customProperties
    if (
      pushNotification.customProperties &amp;&amp;</button>
github microsoft / appcenter-sdk-react-native / DemoApp / app / screens / AppCenterScreen.js View on Github external
async refreshUI() {
    const appCenterEnabled = await AppCenter.isEnabled();
    this.setState({ appCenterEnabled });

    const authEnabled = await Auth.isEnabled();
    this.setState({ authEnabled });

    const pushEnabled = await Push.isEnabled();
    this.setState({ pushEnabled });

    const installId = await AppCenter.getInstallId();
    this.setState({ installId });
  }
github microsoft / appcenter-sdk-react-native / TestApp / app / screens / AppCenterScreen.js View on Github external
async refreshUI() {
    const appCenterEnabled = await AppCenter.isEnabled();
    this.setState({ appCenterEnabled });

    const authEnabled = await Auth.isEnabled();
    this.setState({ authEnabled });

    const pushEnabled = await Push.isEnabled();
    this.setState({ pushEnabled });

    const installId = await AppCenter.getInstallId();
    this.setState({ installId });
  }
github microsoft / appcenter-sdk-react-native / TestApp / PushScreen.js View on Github external
async componentDidMount() {
    const component = this;

    const pushEnabled = await Push.isEnabled();
    component.setState({ pushEnabled });
  }

appcenter-push

React Native plugin for AppCenter Push

MIT
Latest version published 4 years ago

Package Health Score

52 / 100
Full package analysis