registerUserData method

Future<void> registerUserData()

Implementation

Future<void> registerUserData() async {
  DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
  AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;

  _fbm.getToken().then((token) async {
    var getIPInfoUrl = "https://ipinfo.io/json";
    var IPurl = Uri.parse(getIPInfoUrl);
    var getData = await http.get(IPurl);
    var res = jsonDecode(getData.body);
    String city = res['city'];
    String region = res['region'];
    String country = res['country'];
    var fullUrl = "https://apiapps.props.id/registerUser?deviceId=${androidInfo.model}&city=$city&region=$region&country=$country&brand=${androidInfo.brand}&uuid=${androidInfo.androidId}&messagingToken=$token";
    var url = Uri.parse(fullUrl);
    Map<String, String> headers = {
      "Authorization": PropsFlutterNotificationsdk.instance.getCoriginKeys()!
    };
    try {
      var test = await http.get(url, headers: headers);
    } catch (e) {
      // print(e);
    }
    return;
  });
}